A learning algorithm on suspension. Nice! Reminds me of BoxCar2D.
When you’re doing simulations like this, sometimes it’s best to forget about the rendering and go far more mathermatical. With some effort you should be able to seperate your calculation of loads and impacts from the actual draw cycle. This will allow BGE to run at 60FPS, but the simulation to run at 100,000 ticks per second.
Unfortunately to do so, you’ll have to roll your own physics engine somewhat, but it looks like you’re doing that anyway with your suspension geometry.
How would this be done:
- Pick a number of simulation steps per frame
- Per step, calculate the physics collisions (namely wheels with ground followed by suspension response)
- To get wheel collisions, use a raycast vertically down. Get the horizontal force from the normal the ray hits. So long as your wheel is smaller than the bumps of the surface you are using in your simulation this will be an accurate approximation.
Pretty much it comes down to using BGE as a display/visualization system.
BUT. I highly doubt timestep is your problem. Most cars have response rates of about 1-10Hz on their suspension, so even 200Hz of simulation should be pretty accurate. So it sounds like you have other issues that just happen to converge on a solution when you’re simulating it fast enough.
Floats work by storing a number (eg 2.65925) and a power (eg x10^30). This allows them to store small numbers with high precision and large numbers with low precision. I’ve found it plenty accurate enough for everything I’ve done. If you’re not concerned about the nano-newtons on your car, it’s probably accurate enough.
“simulate a realistic pneumatic tire” If you’re calculating the physics using the raycast method as I described (slightly) above, you can easily insert a tire model into the simulation. Tires can be represented accurately enough by a first order system.
I’m going to mirror what others have said: Just simulate it in matlab/octave/some other system designed for simulating this sort of thing. You can still do your genetic-algorithm tweaks as it’s all just math. All you’ll lose are the pretty visuals.