TORCS time steps

  • Is there a way to have fixed time steps in TORCS? I'm attempting to use TORCS for some machine learning experiments, and I don't (at the moment) want my learning algorithm to be presented with variable-length time steps.

    I also don't care if I can watch it in real time: it's ok with me to start an experiment and have 1 race take literally all night while my agents learn.

    I've been looking at the file src/libs/raceengineclient/raceengine.cpp, and have noted the ReOneStep function, which accepts a deltaTimeIncrement as parameter. Maybe such functionality already exists and I need to only change the value for RCM_MAX_DT_SIMU ... like I said, not really sure though.


    • Hi

      In TORCS the internal time steps ARE fixed. The only variation happens through floating point error accumulation. For the physics it is 500Hz, for the AI drive(...) calls 50Hz. If the physics catches up with real time, TORCS renders a frame. The physical simulation and the AI call frequency are totally decoupled from real time, they just depend on simulation time.

      If the physics would have variable timesteps the simulation would suffer from weird behaviour, because the parametrisation would not fit with the different integration error (in realtime simulations usually Euler is used, so if the timestep is not very small the integration error is big).

      Bye, Bernhard.

      define RCM_MAX_DT_ROBOTS 0.02

      define RCM_MAX_DT_SIMU 0.002