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) ?