Torcs CreationsTutorial Robot 'locus'If you want to develop a robot driver for TORCS, but find that BT is too primitive (lacking a raceline among other things) and the other robots too complex, this robot might be of some help. It is quite fast and well-behaved, and its code is easy to work with. You may even decide to join next year's Endurance Championship over at the Torcs Racing Board. Please note that I'm providing this robot as-is - I can't provide support if you run into problems as I'm too busy with other stuff. If you have any general questions about robot programming, the TRB forum is a good place to ask. Also, once you've downloaded locus, please read the README for more information. Enhanced 'Human' DriverThe 'Human' driver library is what TORCS uses to allow you to drive a car in the game. It works very well for people with the full steering wheel, pedals and gear lever setup. If, however, you only have mouse and keyboard (as I do) then you might find it annoying in some respects. Over time I've made various changes to enhance the experience for mouse and keyboard users, including:- * improvements to ABS; it now brakes harder when its safe to do so. * improvements to ASR, making it a lot less timid. * gradual implementation of acceleration and braking (thanks to Christos) * Automatic clutch. A zip containing the source code along with a pre-compiled Windows DLL and 32-bit Intel Linux human.so can be downloaded here (71,575 bytes).
To install, extract the contents of the zip into the drivers/human folder under your TORCS installation. You may want to copy the standard TORCS human.dll/human.so somewhere safe first, just in case you want to restore it later on.
General Notes re Driving with Keyboard and MouseI initially started out in TORCS by trying to drive with the keyboard alone. My experience was that steering with the keys was simply too imprecise. Either the steering increased too much and caused oversteer, or not enough resulting in understeer. Of course its impossible to just steer a small amount - you have to keep hitting and releasing the keys making the car behave in a skittish fashion. As a result, I tried using the mouse to steer, while still using the keyboard for accel, brake and gears. To do this, in Configure Players, go into Controls. Click in the 'left steer' area then move the mouse to the left. It should show a value of "MOUSE_LEFT". Do the same in 'right steer', moving the mouse to the right. Then click Calibrate, where you click at the extreme left and right sides of the TORCS screen. Finally, set Steer Sensibility to something like 0.7, and Dead Zone to 0.04. These values can be adjusted later to suit your driving style.
When racing, assuming you're using a 'bonnet' F2 view, keep the mouse cursor in the middle of the screen vertically. Move it horizontally so its at the part of the track that you'd like the car to drive towards - think of it as a target you're trying to aim at. It takes a little to get used to, but when you do you'll have a lot more control over the car, which means you'll be faster and crash less often :)
|
|
|