TORCS runtime track selector

2 views
Skip to first unread message

ChrisB

unread,
Dec 6, 2009, 11:12:27 PM12/6/09
to Car Racing Competition
Hey guys, I've created a Java class to edit the track/driver/race
configuration for practice and quickrace modes.

If anyone's interested, email me and I'll send you across a copy. I've
included a sample of how to use it here, so you can evaluate its
usefulness...

This should help anyone doing a Genetic Algorithm across different
tracks. At the moment you need to restart TORCS in order for it to
reread the XML, and update the race.

The one change you will need to use it is to copy the file
"params.dtd"

from
"torcs\config"

to
"torcs\config\raceman"

(for some reason the XML files expect it to be on the same level,
whereas it's actually stored a level above)

X x = new X();
x.open("D:\\torcs\\runtime\\config\\raceman\\quickrace.xml");

System.out.println("Setting laps qty to 12");
x.setLaps(12);
System.out.println("Changing track to forza on road");
x.setTrack("road", "forza");
x.setDistance(10101);
System.out.println("Deleting drivers");
x.clearAllDrivers();
System.out.println("Adding driver berniw - 1");
x.addDriver("berniw", 1);
System.out.println("Adding driver Tita - 7");
x.addDriver("tita", 7);
System.out.println("Making realtime");
x.setRealtime(true);
System.out.println("Done");
Reply all
Reply to author
Forward
0 new messages