Thursday, June 25, 2009

Leaderboard changes

I've added some more functionality to the TORCS-NG leaderboard display lately. For clarificaion, the leaderboard is displayed in the lower left area, showing 10 (by default) drivers and their times.

First improvement I've developed was to have a 'rolling' leaderboard, so if there are more cars in the race than the leaderboard can hold, it can be switched to scroll the roster upwards. After reaching the last racer, it shows an empty line and then starts again from the first one. Each driver name is shown using his/her own colours, defined in the XML file of that driver (or robot). See SVN rev 970.

Then I started working on a horizontally scrolling leaderboard, the ones you often see in TV broadcasts. I've committed it in rev 1007 although it still has some glitches to be sorted out. It hasn't been thoroughly tested with very few cars, a short track, a very long track, many cars, etc... the extremes you may say. Then it is a little bit annoying that the roster to be displayed is generated at the moment the leader crosses the start/finish line in each lap. And this newly generated roster is scrolled horizontally through the screen, so it can happen that you see a car in position eg #8 and the roster says it is #13... Need more time to clear these issues.

Well and as Xavier has put the Kilo robot in the repo I've also committed some maintenance work on that, making it work on the tracks it has been set up with. Next TODO is make it able to drive around any track, then handle skills, like the 'big boys' USR and Simplix does.

Plenty of plans...

Wednesday, June 10, 2009

TORCS Championships 2009 - Forza

Gentlemen, start your engines! The TORCS Racing Board Championship 2009 racing has started at last, on the fast Forza track. As I have issues with my laptop, I had to borrow a PC to run the race, but it meant it was a clean setup for sure :)

Kilo 1 & 2 qualified as #11 and #12, then came Dotty and Fuzzy. In the first lap both Kilos were involved in a small crash with one of the JDIs and by lap 10 Fuzzy was 10th, while Dotty, Kilo 1 and Kilo 2 were running 14th and further back.

On lap 14 Dotty Doe and Lobo Malo were heavily damaged in an accident and both spent about a minute in the pits - too bad Dotty smashed into the horrid wall 4 laps later, together with Bender 09.
Fuzzy Foe was driving smoothly in poisiton 7, then 6, then after pitting it came back as #9.


On lap 27 Kilo 1 called it a day and joined Dotty resting in the wall.
On lap 32 Berniw 1 & 2 both ran out of fuel and drove slowly midlane, Fuzzy was stuck behind both quite a bit, Wolverine 1, 2, JDI 1,2 passed him easily and that left him in pos #10. Then in lap 37 R.Giskard passed Fuzzy as he wanted to let Lobo Malo & Lupo Bianco lap him. This is something that happens quite often to my robots :(



Lap 55 almost made my heart stop, Fuzzy (#11) wanted to overtake Giskard and slammed into the wall, but escaped it luckily - phew. Meanwhile Kilo 2 was running as 12th, a lap behind Fuzzy.
In lap 78 Kilo 2 wanted to take a lap back from Fuzzy, causing Fuzzy to go into the wall again, but this time he was able to recover quickly. Then Kilo 2 had a pit stop, so Fuzzy lapped him again, and they almost repeated the previous scene in lap 85, but Fuzzy missed the wall by inches this time. Slow learner :D
As a closing act, Kilo 2 set his own best lap in the last lap of the race while Lupo Bianco snatched the silver medal from Dummy.


So that means Kilo 1 and Dotty was lost due to the wall, Fuzzy Foe finished #11 and Kilo 2 #12. It was a fun race to watch, Wdbee's, USR and dummy robots seem very strong, while JDI is reaching up to their level soon. Team Polimi's Wolverinnes can be caught if my teams don't do all these silly strategical errors. As both Hymies slammed into the wall, I can not decide what they are able to do yet. Check the results here.

Main issues to deal with: get back on road from the wall, take over very slow cars more easily, handle situations when being overlapped a little bit smarter.

Monday, June 8, 2009

Committed patch & SVN access

Jean-Philippe liked my recent patch and granted SVN access to the TORCS-NG project. So I could commit it myself.
I feel kinda proud to have been included in the team. After years with TORCS now I can do something for the project for real, not 'only' creating some tracks, as my limited graphic talent keeps me from producing quality tracks with nice surroundings.

And I've also commited a small patch that won't let GfCreateDir() change the parameter path, as it is now declared as const char *.

Happy team member \o/

Friday, June 5, 2009

Patch - code review @ race results

My previous patch was committed \o/

My editor still had the file raceresults.cpp open and I found some ways to make it more simple & robust:

ReUpdateStandings() is used to read the existing results, update them with the most recent race's standings and write the updated results back. So basically you look for a driver, if he/she has previous results then add the points from the last race; if he/she does not have and previous results, create a record of it and put it between the results.
The original code went through the list of the recent race's results and sorted the array based on points with a bubble sort after each update. Now that it is luxury, sorting can be done after the updates have finished. That means we sort 1 time, not eg 20 times.
Then I thought - hey we are in the 21st century, let's not sort with a hand-written bubble sort when we have complete libraries for that. So I took a big breath and changed the array to a STL vector, then used STL sort() to handle sorting and find() to search for drivers. Result is: much simpler code. Oh and while I was there I changed the char* things to C++ strings, too.

I've sent the patch to Jean-Philippe, we'll see if he likes it or not. The patch can be applied to both trunk or sdl-port as the file is the same in both.