How does braking assist of car racing games work?

Posted by Ayush Khemka on Game Development See other posts from Game Development or by Ayush Khemka
Published on 2012-12-20T06:12:33Z Indexed on 2012/12/20 11:14 UTC
Read the original article Hit count: 705

Filed under:
|

There are a lot of PC car racing games around which have this unique driving assist which helps brake your car so that you can safely turn it. While in some games it just an 'assist', it will just help your car brake but won't ensure a safe turn. While in others, the braking assist will help you get a safe turn. I was wondering on what could be the algorithm that is followed to achieve it.

A very basic algorithm I could think of was,

  • Pre-determine the braking distance of an ideal car for every turn of the track, depending on the radius of the turn, and then start braking the car accordingly. For example, for a turn of less than 90o, the car would start braking automatically at 50m distance from the start of the turn.

A more advanced algorithm, which would ensure a safe turn, could be

  1. Pre-determine the speed of the car at the start of each turn, individually for each track, turn and car. Also, pre-determine the deceleration rate of each car individually, which varies because of the car's performance.
  2. The braking assist would keep recording the speed of the car at a certain instant of time.
  3. Start braking the car appropriately so that the car gets to the exact speed needed at the start of the turn.
  4. For example, let the speed of a particular car at the start of a turn 43m in radius, be 120km/h. Let the deceleration rate of the car be 200km/h2. If, at some instant of time, the speed of the car is 200km/h, then the car would automatically start braking at 400m from the start of the turn.

© Game Development or respective owner

Related posts about physics

Related posts about racing