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.

Tuesday, May 26, 2009

Patch - results not saved

I've sent a patch to Jean-Philippe, it fixes TORCS-NG's faulty behaviour not saving the results file if the directory structure to hold it was not created yet. I made the patch against the sdl-port branch, AFAIK the trunk is expected to be released soon.

The cause is plain simple, saving the XML file (GfParmWriteFile) uses fopen() and fopen isn't expected to create the directories. However I think the directory path should have been created when first running the program...
Well the patch fixes the fault explicitly creating the directories in the path if they do not exist. I've tested it under Linux but can't test it under Windows.

Scanning the TODO file a similar error is still there, not saving screenshots when the directories are not created yet. I'll look at it, this may be the same problem.

Set for this year

Phew, I've been able to set up TORCS and my robot today.
I was really worried I would not get there in time.

I've created a development user environment, for testing the robot. Then I've created a separate user only for running the races. The latter one will get clean a TORCS install right before each race, so nothing can be left over and harm the results. At least I hope so :D

The only remaining issue is - my laptop's ATI Mobility Radeon X200 and Ubuntu 9.04 do not like eachother. I guess you know the story - Ubuntu moved to the new X server, ATI dropped support for 'legacy' cards, so their fglrx does not like the X200 now. That leaves me with the free radeon driver, that is ... khm ... not so strong when we speak about 3D. Framerates can drop to 1-2/s :( I guess I'll have to wait a bit and hope someone comes up with a solution for decent 3D. Or should I downgrade to 8.10 where all was fine yet?

Wednesday, May 20, 2009

2009 season preview

The TORCS Endurance World Championship 2009 season start is almost here.

I don't particularly like the tracks selected for this year - I like Forza, E-track 4 and Street 1, but really hate Dirt-3, E-Track-1 or Aalborg. I miss Brondehach, Wheel-2, E-track-6 or Corkscrew. But well, maybe my robots have a different opinion :D

I have some issues with my laptop so cannot run TORCS and test the robots at the moment. I expect them to be on the skill level of last December, while many code enhancements were committed, mainly in the raceline section. But none of these changes has been tested against the 1.3.1 release so I only expect the robots to drive as good as they have did near the close of last year's championships.

First race is due on 4th of June, so - from coder's viewpoint - almost an eternity to get everything going.

Friday, November 28, 2008

TORCS Championships 2008 - Corkscrew

The TORCS robots moved across the US, from Michigan to sunny California this time. Testing their skills at the dreaded Corkscrew complex, on a newrunner track (erm created by... me?). It was a fun race, one that I enjoyed the most so far I guess, and not because it was on 'my' track.

Ah right, forgot to write about Michigan... oval racing, going round and round lotsa times. My robots did quite well, being speedy, but their technique in the corners would need some more work. Ah and at one point they tend to miss a pit visit so can run out of fuel. That was solved with a temporary hack for Corkscrew, telling them to start thinking about pitting when they still have fuel enough for 3 laps :)

So came qualifiers and the kilo bots finished #13-14 while the dotty ones #17-18 (by design). In fact the Dots were some hundredths faster on test runs than the Kilos but I preferred the Kilos to gain points, so made the qualy setting of Dots a little bit slower. That is a programmer, playing God :D
Start went fine and the first hairpin was solved without any big amounts of damage, but Turn 3, a sweeping right-hander prooved fatal for some top teams. USR lost R.Giskard who though he should pit each and every lap after the accident, a JDI was thrown back and Bea Benz had to fight her way back to the top 10, too.

Kilo 2 and Fuzzy Foe got in top 10 somehow while the other halves of my teams had to jog a bit in the second half of the field. The track prooved to be quite entertaining, there was always something happening somewhere, there were not many boring empty minutes.

Like here: Kilo 1 (blue+yellow) overlaps the orange R.Giskard, Dotty laps them both, while they were all lapped by the wdbee team (on the far left):

Team Inferno's aggressive driving style caused them to spend quite some time in the pits, obviously loosing too many places, also with the (not so occasional) spins:

The Corkscrew turn complex produced some hot moments:

As I've said before, the race was full of action, takeovers, overlapping, taking a lap back, it was hard sometimes to decide who fights who, the pit was crowded, entering cars caused some trouble, too:

All in all it was an exciting race - too bad the scenery is dull, it definitely needs some Blender work.