I have a working physics code for a -let's say- WipeOut-style vehicle [well, closest approximation]. Some time next year I would like to do a formula game but am struggling to get to tweak my code to behave anywhere near the way the formula (say, like in F1 GP game that ran on 100 MHz Pentiums) behaves in curves.

Visually, think 3D engine and a 3D track (with hills/valleys - but still a track (not a generic heightmap)).

Since the target HW is below 100 MHz and code is written in ASM, we can't use any off-the-shelf physics engines, but it must be written from scratch (initial prototyping will be done in C++ for max productivity and understanding of limitations of the physics component).

Now, I don't have any issue with the following (already working):

  • non-linear acceleration (e.g. each gear range has different constants/behavior)
  • hill-based acceleration/decceleration (how steep hill is)
  • car gets lighter over time (less gas in the tank), affecting acceleration
  • each parameter can have an additional modifier (linear, non-linear) applied to it over the time

My greatest issue is I can't seem to get the thing to over-steer / under-steer in curves. I want to allow the player to choose several different levels of physics - from Arcade, through gradually more realistic features, to a full-blown (as far as manageable by me) physics (like in F1GP game). So far, I have these racing physics modes implemented:

  • Arcade racing (kinda like in Lotus/Outrun)
  • gear-specific non-linear acceleration (each formula has different characteristics)
  • hill-based speed-up/down (steepness)
  • speed-based drag in curves (how quickly car reacts to turning)
  • tire temperature gradually rising (affecting all physics ranges, modifiers and constants)

Through trial&error I found a way how to get the car to turn faster/slower based on current speed. It works pretty well, but it won't realistically skid the car away from the track (like F1GP does).

Also, nowhere in the code, I actually use any vectors. It's all just constants, valid ranges, and type of applied modifier (none/speed-up/down, linear/non-linear) that we use on the desired variable, as that's the fastest possible way on given platform (all these values fit into available CPU's registers, unlike vectors that have to be read from slow RAM).

So, how does one actually get the car to under-steer/over-steer in curves ? What's the actual physics here ? Rigid Body ? I believe it should be perfectly possible to emulate this feature via 2D vectors (car direction + speed) ?

  • \$\begingroup\$ Can you show us the steering code you use now? This will help us target improvements that work together with what you already have. Showing us a diagram of your current steering behaviour versus the behaviour(s) you want can also be a good way to focus answers on achieving that specific goal. \$\endgroup\$
    – DMGregory
    Commented Jul 27, 2020 at 12:19
  • \$\begingroup\$ @DMGregory: I will try to make some summary of the current steering and add it to the thread. I think, however, I may have reached a limit as to how far I can get in my physics without doing full vectors. There's certainly some kind of doable approximation to the understeer/oversteer, assuming I would first understand how it's supposed to work in real life. Which I don't. \$\endgroup\$
    – 3D Coder
    Commented Jul 27, 2020 at 21:33

1 Answer 1


I would add oversteer/understeer control as follows:

  • Have different friction settings for the front tyres and rear tyres (against terrain.)
  • If front tyres have more friction, your car should oversteer.
  • If rear tyres have more friction, your car should understeer.

If that does not work for you, you could play by widening/shorting the track (spacing between the left and right wheels.) I suspect a wider car to oversteer more easily, but you would have to experiment with that. The friction differential is probably a better approach.

Note: that in real-world F1 racing, oversteer can be induced with higher downforce on the front wing.

So if you model downforce in your simulation, you could play with that: shift downforce from the rear to the front for more oversteer.

Lastly, you can also eliminate oversteer by moving from rear-wheel-drive to front-wheel-drive. The latter is typically understeered, the former is typically oversteered.

UPDATE: If you do not use a physics engine, you can fake oversteer by giving the car-rotation some momentum!

So instead of controlling the car's angular velocity with the joystick, you control the angular acceleration of the car with the joystick:

As you move back the joystick to the centre, the car continues its rotation for a while, forcing your players to counter-steer.

pseudo code:

rotvel = rotvel + joystick.x * dt;
rotang = rotang + rotvel * dt;
// bleed off the residual angular velocity
rotvel = 0.80f * rotvel;
// apply the rotation to the car
car.rotation = rotang;
  • \$\begingroup\$ OK, we're getting somewhere. So, I need a separate handling of front and back tires. Which I don't have right now. So, how exactly does steering work then ? In lower speeds, it's easy to turn into the curve, in higher speeds, it gets harder - but why ? Now I could implement that the same way I have right now - a constant modifier to how much I can turn based on speed. But that still won't give me the final vector where the car is supposed to go, based on current speed. Let alone the spin. \$\endgroup\$
    – 3D Coder
    Commented Jul 27, 2020 at 21:39
  • \$\begingroup\$ I think I just realized that by handling front/back tires vectors separately, I could get the car to actually spin (I can't right now, unless I fake it, which I don't want). I think I should experiment with it few days. I guess the speed of turning is constant, it's just that at higher speeds we simply go faster through the curve - so that particular behavior wasn't a separate physics thing - it's merely a side effect of higher speed. \$\endgroup\$
    – 3D Coder
    Commented Jul 27, 2020 at 21:45
  • \$\begingroup\$ This assumes you use a physics engine, either 2D or 3D. Are you doing your simulation in two or three dimensions? For a 2D physics engine, I recommend Chipmunk2D. \$\endgroup\$
    – Bram
    Commented Jul 27, 2020 at 21:48
  • \$\begingroup\$ Thinking about it some more, I believe we could actually simplify the vectors for front&back tires by simply rotating the main heading vector (just an angle, really) either faster or slower - based on speed at which we start turning. It's not going to be full-blown F1GP physics, but it sure will be way more advanced than the classic arcade controls and it can give me over-steer. Even if I modified the computation to always over-steer (kinda like in Screamer series, where each car very heavily over-steered, leading to a significant learning curve, which was great in itself). \$\endgroup\$
    – 3D Coder
    Commented Jul 27, 2020 at 21:49
  • \$\begingroup\$ no, like I said in main post, there is no 3rdparty physics (or any other component) engine. I do all physics computations by myself. Out of curiosity, can you recommend any 68040-based physics engines written in straight 68040 assembler ? I might consider it, assuming it wasn't written in C, but ASM. \$\endgroup\$
    – 3D Coder
    Commented Jul 27, 2020 at 21:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .