Friday, June 23, 2006

Vdrift - Racing Simulator

After getting the FlightGear working right using DTK, I was asked to get Vdrift doing the same. Vdrift doesnt come with many command line arguments and built in programs like FlightGear so a lot of the stuff had to be done from scratch.
First I had to modify the Vdrift source to record accelerations in all 6 dimensions. This was easy enough to do. This had to be done in the same format defined in the xml file written for FlightGear. After re-compiling the source, and running the game, the car was bouncing like a bunny all over my screen! After a quick check on the Vdrift forum I found out it that it requires an older compiler than what Fedora 4 or 5 come with. I got hold on some Slackware 10.2 CDs after MvM suggested that I use that instead since most of the packages we need have a slackware version which should avoid problems. Anyway after doing that, the vdrift source compiled fine and I got all the required drivers (joystick & Nvidia) and software/libraries (Fltk, DTK) installed properly.

All that was left is to get the UDP listener I wrote for FlightGear listening to the same port vdrift is writing to. I added two new command lines to vdrift to control the frequency of writing to the UDP and the host it should write to.

I produced this screenshot while running everything together on localhost.

The scope at the bottom comes built in with the DTK-Diverse program. The blue lin in the middle is supposed to be the force of gravity (in the Z-axis) but for some reason it comes out very close to 0 from vdrift, so it never moves. This can't be right as it should move at least when I am driving over mountains or down a hill. Anyway I will figure this out later, the physics engine for Vdrift is buggy anyway and nowhere as good as the one that comes with FlightGear.

No comments:

Post a Comment