Closed ironchestgames closed 7 years ago
Hi. One way is to speed things up is to increase gravity (and adjust other velocities/forces accordingly). Note that you probably have to decrease the time step size too, to minimize body overlaps.
Another approach is to literally speed up time - if you instead of ’world.step(dt)’ run ’world.step(2*dt)’ the simulation will run 2x faster. However, the performance will be 2x worse.
Pro tip. Speeding up the physics is generally bad for performance. There is a reason why many physics-heavy games have moon gravity.
Thanks for the reply!
When you say it is bad for performance, is that related to having CCD enabled for certain bodies? or is there a performance hit even without CCD?
There would be a performance hit even without CCD.
CCD makes each step heavier. If you increase game speed you probably need more steps per second (aka smaller time step).
It's all really about time step size. If you can make the game faster without using a smaller time step, performance will be the same. But it's usually a tricky job.
Ah, ok, so it is basically how much overlap I'm comfortable with vs performance?
Yes!
okelidokeli! Thanks for taking the time!
Hello,
I have a platformer using p2, but the game is just a tad bit too slow. If I just want everything to run faster (or slower) what are the ways to go about it?
Kind Regards,