28 Jul The Quest for Great Pinball Physics
I am making the Game Physics for Project Momonga. The game will have pinball physics and mechanics, which means we are dealing with very high speeds and collisions. So when I started, I knew this wasn’t going to be an easy task. The fact that it needs to perform well on a mobile device only makes it harder. Here’s how I did it:
The basics are simple. You take a ball and flippers, set up a table at an angle and let gravity do the rest.
So it wasn’t long before I got a basic setup working and I was able to shoot some balls.
But the tricky part in physics is always in the details… and this is where you go one step forward and then 2 steps back.
When I had the basics working I started to create the first level. We had made some design on paper and I was trying to implement them in the game. In an ideal world, you have full control over where you want the ball to go, and the ball can go just about anywhere. However, we quickly found out that some places were impossible to reach. The angle of the ball was limited: It was very hard to flip the ball to the sides of the level.
How to solve such a problem?
There are a lot of variables you can tweak:
– Flipper rest angle
– Flipper maximum angle
– Flipper strength
– Flipper material (friction, bounciness)
– Ball material
– Ball weight
– Ball drag
– Table material
– Gravity strength
– …and many more.
Of course changing any of them affects the whole game… and this is where Game Physics starts to hover between science and art 🙂
I created an isolated test setup to determine exactly how all these things influence the ball trajectory. In this test a ball gets spawned every couple of miliseconds, and the flipper is activated automatically. We then trace the ball to see where it goes.
Now I could change one setting at a time, and see clearly how it affects the ball trajectory.
Using this way of testing I came up with settings that gives the player a lot of control.
Now we have this one off the list, we can make more crazy and exciting levels!