Working on Artificial Intelligence in Racing Simulations again!

I have started working on the Artificial Intelligence in Racing Simulations project again, still using Live For Speed as the base physics simulation because it is fairly accurate and reasonably accessible. Here is a short recording of the artificial driver, Jared, driving at Fern Bay Club in the XRG. A fantasy car similar to a low powered rear-wheel drive sports car.

The second version/iteration of driving logic was written last year, March 2015, but my PC at the time was getting outdated and overloaded as it tried running everything it needed, plus AIRS logic could use some optimizations. I lost motivation after writing “Driving Logic version 2” (DLv2 for short), since it didn’t behave as well as I had hoped.

The driver got faster than DLv1, and learned a track safely so he could do better in more than a single car, but eventually he would start failing and couldn’t run endless laps. I lost motivation and gave up. Upon coming back I find it interesting that those issues are gone. Despite not touching any logic related to the learning and reference point modification process, the driver did not fail anymore. I believe this is because the driver can more reliably hit marks with the frame rate boost on the new PC. AIRS had been running at 20fps where it now runs nearly 1400fps.

Tonight I have been focusing on getting the driver to launch the car better. The last two nights I had focused on getting the driver to recognize when the track when live (green lights) more reliably and finally got that down well. Today I got the launch state to not be so jerky, he would nearly, sometimes actually, stall the car when trying to pull away from the line. I’ve been sim racing for almost 10 years now, and launching is actually one of my strengths. Trying to teach the artificial driver how to do it however, is a different story.

//
// Teach the art of launching a car to an artificial driver.
//
if (currentRPM < torqueRPM)
{
  ApplySmoothThrottle(1.0f, kRateQuickly);
  if (currentRPM < torqueRPM - 1000)
  {
    ApplySmoothClutch(1.0f, kRateNormal);
  }
}
else
{
  if (mDriver.IsOverThrottle())
  {
    ApplySmoothThrottle(0.2f, kRateQuickly);
    ApplySmoothClutch(0.0f, kRateVerySlowly);
  }
  else
  {
    ApplySmoothThrottle(1.0f, kRateNormal);
    ApplySmoothClutch(0.0f, kRateSlowly);
  }
}

This bit of code basically gives the driver three different conditions to consider, first, if the engine speed is dropping below the speed where most torque lives, apply more throttle! Quickly! If the engine still slows down, start putting the clutch back in slowly, ride the clutch a little bit for a launch. If the engine rpm is good, check if the drive tires are spinning, and release throttle quickly and slow down the release of the clutch. It may actually be worth applying more clutch slowly in this situation, and again ride it out a bit. Final case is just keep releasing the clutch while applying more throttle because the wheels are not yet spinning.

Comments are closed.