Time to let the cat out of the bag on this one! For over a month now, I've been hard at work on an overhaul of the VP physics engine, and my hiatus from the DX9 port has allowed me to make much better progress on this recently. What started with some simple tweaks and bugfixes has developed into an extensive modification, with several crucial parts completely rewritten. I'm very excited to present this to the world since I'm convinced that this will be a huge step forward for VP in terms of realism.
Here are the main changes from mainline VP:
- Physics framerate raised from 100 Hz to 1000 Hz. This may seem excessive, but performance is still surprisingly good, and further optimizations are possible in the future. After experiencing the smoothness and precision that this affords, I didn't really want to go back.
- Physics now always use a fixed timestep. This eliminates all FPS dependence of the physics code. In particular, gameplay with vsync at 60fps seems very smooth now for the first time.
- Proper simulation of ball spin. VP9 had some rudimentary ball spin code, but it was only for visual effect and had no effect on ball behavior. Now, rotational effects are fully simulated: the ball will properly pick up spin from moving over the playfield and other objects, and collisions with playfield objects will take the spin into account to deflect the ball properly.
- Simulation of friction on contact and collisions. This goes hand in hand with the previous point since friction with the playfield is the main source of ball spin, and frictional effects during collisions cause the ball to deflect according to spin. VP9 has a pretty simplistic friction model which simply slows down the ball, but this is way more realistic now. In particular, the ball will now properly transition from sliding over the playfield to rolling on it. This means that it will first convert some translational kinetic energy into rotational energy until it enters a natural roll, at which point friction doesn't do much anymore and the ball is free to roll. The stored up rotational energy has the effect that the ball needs a bit more force put into it to get it to move or stop it again, which is exactly the effect that JF has been trying to emulate with his BMPR routine. You'll see that with this physics mod, BMPR is not needed anymore.
- Flippers have been pretty much rewritten from scratch. They are now simulated as true dynamic rigid bodies which have forces from the solenoid, the return spring and the ball acting on them and accelerate accordingly. They will also properly bounce off their stoppers instead of just moving to maximum extension and then stopping. In practice, this means that flipper/ball interaction is now much more realistic and less binary. Post passes, light taps, cradle separations, drop and live catches: those are now all possible, and without any special scripting hacks. Another real eye opener was the addition of friction to flippers: aiming is greatly improved, and all shots on the playfield (including center shots and backhands) are immediately attainable without any oblique correction!
There's still quite a bit of stuff to do (better nudging is a big one), but the gain in realism and nuance is already huge at this point in my humble opinion. After playing some tables with this mod for a while, going back to vanilla VP physics feels floaty, slippery and generally a bit wonky.
Unfortunately, with so many drastic changes, this new physics engine is not completely backwards compatible with old tables. Several physics parameters have to be retuned for these new features to work. I'll however shortly post a test build with which you can play around a bit.
Latest version download: Physmod5
Test table CFTBL (Melon/UncleWilly): http://www.vpforums....=27#entry264695
General information and parameter tuning guide: https://github.com/c...ki/VP10-Physics
Edited by mukuste, 18 May 2014 - 11:29 AM.