Pool Shot Simulator

"vf = vi + at", and delta_x = v_inital * time + 0.5at^2

Dr. Dave and Bob Jewett have written accessible articles on the physics of billiards. They also post on AzB regularly and are walking, talking warehouses of useful information about the game. (As always, big thanks go out to both of them.) Dr. Dave has posted a list of useful resources about the physics of billiards:

http://billiards.colostate.edu/physics/index.html

There are several textbooks that examine the physics of billiards in detail. I have Wayland Marlow's The Physics of Pocket Billiards from 1994, which is one of the books listed on Dr. Dave's page.

In addition to the basic physics, Marlow covers collisions, table tilt, squirt, jump shots, masse, and other topics. He even has a chapter on Optimum Break Cue Weight. (I haven't checked his break cue weight calculations against the tests Bob Jewett and others conducted in the 90's and reported in Billiards Digest.) Marlow's work isn't purely theoretical; the book also includes empirical data.

If you don't already have an undergraduate degree in physics or mathematics (or at least engineering) then the math could prove daunting. No single equation in the book is hard to read, but understanding the real world meaning of each equation requires effort. Looking at the math is one thing; checking the math and reproducing it from memory is another. (If you buy the book, don't lose the Errata sheet!)

And how many other math books would give credit to "Ears" Yingling?

For a code reference, take a look at the open source project FooBillard by Florian Berger. The software demonstrates collisions, ray tracing, and rudimentary controls. That's a good start.
http://en.wikipedia.org/wiki/FooBillard

You would need to be proficient in OpenGL and C to modify the code. If you look at "ball.c", you'll notice that there are very few comments in the code, and that's unfortunate. With a good debugger, the OpenGL SuperBible (or equivalent), and a lot of patience you might still have fun with the code.
http://sourceforge.net/projects/foobillard/

Good luck.

I was disappointed when I programmed the one dimensional motion. I used the simple physics model to see how quickly the python compiler can recursively calculate and update the screen. I varied my fixed time interval from 1, 0.1, 0.01 anything smaller and the computational work exhausted the processor, I assumed acceleration was -2 and positions were based on pixels. The simulation part looked good. I will give it another shot. I slacked off a bit because of poor project planning, there are many technical issues to solve, the order to solve them challenges me. The problem in my code was the screen flickering, developing efficient code is challenging, but I will redesign it again.

Elastic collisions are easy to program. Inelastic collisions will require me to calculate the KE before impact, I still have to come up with a way to decide how much energy is transferred. [edit] The only forces involved will be the cue contact with cue ball, the position of the cue contact maps to the amount of kinetic energy transferred, stop shots are elastic, draw and follow are inelastic, based on initial position of cue striking line I can set up a ratio to determine the transfer amount.

The programming part isn't so bad. Designing the efficient code is challenging and a one man team doesn't have many opportunities for discussion on trying things differently. First I will program the type of motion that would occur in a vacuum then I will add the delicacies of gravity and friction. The great thing about programming is object oriented solutions is if you can solve the problem for two objects the solution is the same for 100001, but that's when the efficiency of the code matters.
 
Last edited:
Thanks for the support, so far I can say the sitting down and coding is the most challenging issue.

Objectives completed:
1. Cue ball lag shot
2. Follow, Draw and stop shot between two objects completed.
3. Cut shots (incomplete)
4. Pocketing Balls (incomplete)

New Ideas:
Program shots from magazine diagrams, in the style of a puzzle based game.
Find users to scrutinize the program and all its faults.

Review:
I know why games do not respond to commands in specific occasions.

Discussion Topics:
None
 
... stop shots are elastic, draw and follow are inelastic, ...
Actually, the elasticity of the collision does not seem to vary with the spin on the cue ball, but with follow and draw, the path of the cue ball will curve. It may be useful to know that the coefficient of friction between the ball and the cloth is somewhere around 0.15 -- that determines the extent and sharpness of the curved path.
 
Actually, the elasticity of the collision does not seem to vary with the spin on the cue ball, but with follow and draw, the path of the cue ball will curve. It may be useful to know that the coefficient of friction between the ball and the cloth is somewhere around 0.15 -- that determines the extent and sharpness of the curved path.

Thanks. Because computers are slow I am against a design that is computationally heavy. A program to compute friction and all its effects slows the computer processing time. However I will assume that the friction and gravity act as a constant negative acceleration. Various frictions would translate to various accelerations. The idea that will solve velocity of the balls after a collision could be as simple as using the conservation of kinetic energy and conservation of momentum. I understand extent and sharpness of path as the wobbling induced by the cloth, I can work that as a displacement based on distance, like if it travels 10 m it moves 0.5 m in a perpendicular direction.

On a side note, when I did my simulation the ball does not have a sharp path, I don't think its the cloth. My calculations required trigonometry to define components of motion. When the computer calculated sine and cosine it approximated the near zero values and demonstrated a preference for rolling in a perpendicular direction to motion. I am guessing that the real world and the computer world are more alike than the perfect theoretical models. They look amazingly similar. When I saw the computer wobble the ball on its own, I was shocked too, I had to rework the program to be more real, the wobble was very bad. I programmed it to roll half way across the screen and it rolled down the screen about 10% the distance it traveled. I set it to bounce back and forth and eventually it rolled off the simulated table area.

Thanks for reminding about the spin equations. I can finally get to work on it. I just checked over the equations for spin and they are of the same form of two dimensional motion with constant acceleration. This is great I might be able to reuse the same functions and save memory.

Programmers Discussion: I am having trouble with making the simulation processor independent. I am using a time object to determine time between calculations so that the game runs at the same speed regardless of processor. My question is do you think it is worth solving or should I just program at the speed of the processor? The clients are pool players what do you recommend? To the client the effect is the ball will roll across the screen at different speeds based on your processor but if I spend time programming I can make it run at the same speed regardless of processor, what do you think?
 
Last edited:
Thanks. Because computers are slow I am against a design that is computationally heavy. A program to compute friction and all its effects slows the computer processing time. However I will assume that the friction and gravity act as a constant negative acceleration. Various frictions would translate to various accelerations. The idea that will solve velocity of the balls after a collision could be as simple as using the conservation of kinetic energy and conservation of momentum. I understand extent and sharpness of path as the wobbling induced by the cloth, I can work that as a displacement based on distance, like if it travels 10 m it moves 0.5 m in a perpendicular direction.

On a side note, when I did my simulation the ball does not have a sharp path, I don't think its the cloth. My calculations required trigonometry to define components of motion. When the computer calculated sine and cosine it approximated the near zero values and demonstrated a preference for rolling in a perpendicular direction to motion. I am guessing that the real world and the computer world are more alike than the perfect theoretical models. They look amazingly similar. When I saw the computer wobble the ball on its own, I was shocked too, I had to rework the program to be more real, the wobble was very bad. I programmed it to roll half way across the screen and it rolled down the screen about 10% the distance it traveled. I set it to bounce back and forth and eventually it rolled off the simulated table area.

Thanks for reminding about the spin equations. I can finally get to work on it. I just checked over the equations for spin and they are of the same form for two dimensional motion. This is great.

Programmers Discussion: I am having trouble with making the simulation processor independent. I am using a time object to determine time between calculations so that the game runs at the same speed regardless of processor. My question is do you think it is worth solving or should I just program at the speed of the processor? The clients are pool players what do you recommend? To the client the effect is the ball might roll across the screen at different speeds based on your processor but if I spend time programming I can make it run at the same speed regardless of processor, what do you think?

Sorry if this has already been asked, but what do you hope to accomplish with this simulator that hasn't already been done with programs like VP3?

pj
chgo
 
Sorry if this has already been asked, but what do you hope to accomplish with this simulator that hasn't already been done with programs like VP3?

pj
chgo

I don't have to buy VP3. I can talk about it at job interviews. I can customize it. I might even be able to distribute it freely. I can reuse the program for students as a physics laboratory on the computer. I can use it to create physics puzzles, like in the billiard magazines asking which sequence to shoot. Those are just the ideas I have now. The main reason is I am unemployed and need something to do. I can use it to do performance testing on computer processors.

Its more fun than turning on a packet analyzer to see who is downloading porn in the neighborhood. Its more fun than port scanning the neighborhood to see who is learning networking. Its more fun that a lot of other things. Porn is the most heavily trafficked data on the web. It is boring seeing only media files in the data stream.
 
Last edited:
I don't have to buy VP3. I can talk about it at job interviews. I can customize it. I might even be able to distribute it freely. I can reuse the program for students as a physics laboratory on the computer. I can use it to create physics puzzles, like in the billiard magazines asking which sequence to shoot. Those are just the ideas I have now. The main reason is I am unemployed and need something to do. I can use it to do performance testing on computer processors.

Its more fun than turning on a packet analyzer to see who is downloading porn in the neighborhood. Its more fun than port scanning the neighborhood to see who is learning networking. Its more fun that a lot of other things. Porn is the most heavily trafficked data on the web. It is almost boring seeing media files in the data stream.

My best students did what you are doing--worked on a self-assigned project outside of class. Keep at it...no matter how good the existing programs are, it's always possible to improve on them.
 
I reversed some gaming software with "physics based" graphics.

The only reason those simulators work so well is because it uses animations to simulate the effect of physics. It is like playing a video repeatedly and sequencing other videos, the programming involved is bridging different animations to create the effect of physics.

I did some initial programming with intense computation and there is no way existing processors can produce a computation based simulation with a graphical output at enjoyable speeds.

Generating the text output of physics positions was slow. I did look into graphics cards that could help produce enhanced effects but that effort required additional hardware.

This was disappointing. Today's computers are just not adequate enough to produce a simulation I am thinking of.

This project is getting scrapped.
 
... I did some initial programming with intense computation and there is no way existing processors can produce a computation based simulation with a graphical output at enjoyable speeds.
Games like Virtual Pool seem to do this or are they doing something else?
 
They do something else.

I would have to buy VP to be sure but I think they are using pre-determined values to determine the "physics."

If I had a copy I would check by bouncing the cueball off the rail and see if it lands in the same place everytime, given the same initial conditions.

Or do that on the break shot of a rack. If it is the exact same each time than there are no computations taking place during the simulation.
 
I don't have the graphics equipment to outsource the calculations. That would be a problem for people that also don't have the graphics equipment.
The pool physics and rules engines here are not graphics-dependent (as far as I know). You can use them to drive any graphics you choose.

Regardless, this is a very ambitious project to do on your own, and to do well.

Regards,
Dave
 
The pool physics and rules engines here are not graphics-dependent (as far as I know). You can use them to drive any graphics you choose.

Regardless, this is a very ambitious project to do on your own, and to do well.

Regards,
Dave

The equipment required to run the software is a new power supply above 400W and a non-standard graphics chip. I can't imagine pool players finding the parts at the store or installing that type of equipment to play a pool simulation. From what I imagine they would prefer a turn it on and just play type software.
 
do u have the choice of using a LD shaft in the game?
In at least one version of the game, various parameters were adjustable, such as cloth slowness and friction. I don't know about squirt, but it was probably in there too.
 
In at least one version of the game, various parameters were adjustable, such as cloth slowness and friction. I don't know about squirt, but it was probably in there too.

Yea.. I had "Virtual Pool Hall" It was a terrific game. I wish I still had it. Its pretty realistic in my opinion.. the only noticeable unrealistic part of the game is that you have a Mike Massey stroke on every shot
 
Back
Top