Pinball algorithm

I have always been fascinated in how a pinball sim works and have always wondered about the algorithm(s) that enable the realistic bouncy movements of a falling pinball.

If I am able to wrap my mind around it then I may attempt a simple pinball game using Java.

If anybody has attempted this in the past and has good advice or has links to good resources that explain the math then I would be grateful.

[421 byte] By [maple_shafta] at [2007-11-27 4:40:35]
# 1

angle of deflection is simple geometry, mirror angle projected onto the adjacent plane, and bounce is a simple dampeing expression, pervious amplitute*.67, and acceleration is instantanious, from bumper, and gravity acts simply speed = accelerationi due to gravity * time. Since most pinball machines are on an angle, the gravitational constant is lessened by the incline of the machine, sin(angle of table)*gravitational acceleration.

morgalra at 2007-7-12 9:51:46 > top of Java-index,Other Topics,Java Game Development...
# 2

maybe you should do something similar, but simpler, to get you thinking about all the physics involved...something like the original Pong.

There is a lot to think about. You have:

the angles the the ball bounces off of walls

the constant force of gravity

the force from bumpers

the angle at which a ball bounces off the bumber (need some tangent math here)

other forces that may be included into the game like magnetism, tipping and bumping the table, holes (used to catch and release the balls)

robtafta at 2007-7-12 9:51:46 > top of Java-index,Other Topics,Java Game Development...
# 3

I was thinking about doing a prototype of a ball in a rectangle box.

Angle of deflection seems like the easiest one to grasp right now.

I haven't been in trig for a really long time so that adds a whole other level of difficulty. I have a feeling though that if I can build a simple ball in a box prototype then I can take it from there.

I have fuzzy math right now though. I wish there was some kind of tutorial for ball physics out on the web but I couldn't find anything substantial.

maple_shafta at 2007-7-12 9:51:46 > top of Java-index,Other Topics,Java Game Development...
# 4
Take a look here, it will get you started. The old Atari stuff-- http://www.atariarchives.org/cgp/Ch03_Sec07.php
morgalra at 2007-7-12 9:51:46 > top of Java-index,Other Topics,Java Game Development...
# 5
Pick up almost any fundamentals book on programming computer graphics and it will probably have what you want.
morgalra at 2007-7-12 9:51:46 > top of Java-index,Other Topics,Java Game Development...
# 6

Thanks a lot!

I have got a ball bouncing around a box now at a 45 degree angle, and while that is a FAR cry away from a realistic moving pinball, it gets me one step closer and i have something to build upon right now.

I will look for a book on graphics programming, that will help me out greatly.

maple_shafta at 2007-7-12 9:51:46 > top of Java-index,Other Topics,Java Game Development...