Pool Shot Simulator

To me, the real challenge is getting all of the physics right; otherwise, people might be disappointed by the results (which won't look real).

Good luck,
Dave

Just so we are on the same page looking real means that if I programming a lag shot. That the ball will not land in the same place everytime. Or it will land in the same place everytime because we all shoot like machines. And of course I am assuming the shot is stroked in the exact same style.
 
Just so we are on the same page looking real means that if I programming a lag shot. That the ball will not land in the same place everytime. Or it will land in the same place everytime because we all shoot like machines. And of course I am assuming the shot is stroked in the exact same style.
A "real" pool simulator will accurately model all of the physics stuff described in all of the links I provided earlier (squirt, swerve, throw, cloth sliding, rolling, and spin friction, ball friction and COR, all rail rebound effects, etc.). A lag shot does not experience much physics.

I look forward to seeing what you come up with, and I hope it becomes a centerpiece of AZB.

Good luck ... this is a big project,
Dave
 
A "real" pool simulator will accurately model all of the physics stuff described in all of the links I provided earlier (squirt, swerve, throw, cloth sliding, rolling, and spin friction, ball friction and COR, all rail rebound effects, etc.). A lag shot does not experience much physics.

I look forward to seeing what you come up with, and I hope it becomes a centerpiece of AZB.

Good luck ... this is a big project,
Dave

Its great you have suggestions and supporting references.

The software cycle I plan to follow is:
1. Lag shot first.
2. Center ball shot.
3. Center ball shot aimed at an object ball on a different centerline.

I can deliver behavior simulating my pool table and physics based collisions.

What I am not promising is a grand program that looks real. I do not have plans for developing the graphics of the program, which I think will turn a lot of people off.


This :smile: is what the 1 ball would look like without the details of the eyes and smiles.
 
Bob Jewett:
It would be nice if we could get a version of Virtual Pool here.

VP already has the ability to record individual shots for playback. We'd just need the playback engine.

pj
chgo
 
VP already has the ability to record individual shots for playback. We'd just need the playback engine.

pj
chgo

That is a great idea for the moderator. It can solve the problem, or it creates new ones based on who does maintenance for AZ.
 
VP3 was a great game. But I wonder how well it would hold up under the scrutiny of the billiards community. I wish there was a way we could all buy it.
 
View attachment 148237

Here is the first version of a billiard table.

I am interested in your input for controls.
I can place three buttons for soft shot, medium shot, and hard shot.
Or I can create a bar where you can click to decide how much acceleration you plan to hit the cue ball with.
Do you like the thing where you accelerate the mouse to decide the acceleration?

What is possible if you don't like the image of the pool table is I can use an overhead photo and make that the pool table. The same goes for the balls.

Decisions like that are slowing me down from completion.
 
Last edited:
Update:

The development process requires parameterization of position, velocity and acceleration. The first two are textbook calculations. The last is not needed because as the ball rolls it is under constant decceleration. The velocity changes continuously this is a problem because the distance between intervals changes over each interval. The solution is a recursive loop. Think about creating a smooth display, best guess is use many small intervals.

Problems on the horizon:

Creating an efficient collision detection method, the distance between two balls during collision is exactly twice the radius, a loop checking distance between all objects seems costly. Maybe a motion and distance condition will enhance the efficiency.
 
Last edited:
they made a 3???
only played the 1st
Virtual Pool, Virtual Pool Hall, VP2 and VP3. The original version of VP3 came out with a Jeanette Lee book and character. There are also versions available for some game machines and palmtop computers, I think, as well as a way to play matches on-line.

Virtual Pool (1) did not keep track of whether objects interfered with the stick, so you could play a draw shot with a level stick even if you were frozen to the cushion. VPH solved that and other problems. I think it also added carom billiards with all of the artistic shots (from the competition) pre-programmed, so it had to include jump and masse shots. Snooker may have been added at the same time. I think VP3 was the first with a "career" mode.
 
How do you model the ball-cushion interaction? Do you include the curve of the object ball as it comes off the cushion?

The ball-cushion interaction will be modeled based on the vector calculated from the motion of the ball. I will use the change in x position and change in y position to act as a vector force, when the ball touches the wall, the program will calculate the angle of the vector and then negate the displacement vector.

For realistic effects I will decrease the magnitude of the displacement vector and vary the angle after the collision.
 
The pool shot simulator for a 2-d platform is a quick exercise in object oriented programming. Once you define the ball class and its methods, the whole runtime environment is finished, it is just discrete recursions of physics equations of two-dimensions.

Programming the game as a server application might take a few books before I get something operational.

http://www.pygame.org/news.html {Game Design}
http://www.kongregate.com/developer_center/docs/kongregate-api {Client/Server Processing for Flash Apps}
http://www.brighthub.com/internet/web-development/articles/11010.aspx {Game Programming}
 
Last edited:
Far and away the greatest simulator I've found is made by a French mathematician/billiards enthusiast named Laurent Buchard. Contact him and see if he will make a pool version. The carom one is at:

http://laurent.buchard.pagesperso-orange.fr/journal.html

Honestly ... I can't over-emphasize how realistic I find simulator to be. I'd love to hear the opinion of other three cushion players with respect to how they find it.

And yeah, pool tables aren't gonna play the same way, and since I don't know anything about code it's probably going to require someone getting in touch with him to discuss the difference.
 
Far and away the greatest simulator I've found is made by a French mathematician/billiards enthusiast named Laurent Buchard. Contact him and see if he will make a pool version. The carom one is at:

http://laurent.buchard.pagesperso-orange.fr/journal.html

Honestly ... I can't over-emphasize how realistic I find simulator to be. I'd love to hear the opinion of other three cushion players with respect to how they find it.

And yeah, pool tables aren't gonna play the same way, and since I don't know anything about code it's probably going to require someone getting in touch with him to discuss the difference.

A link to the newest version I know of:

http://www.umb.org/simulator.htm

It really is quite good.
 
This could be a really cool project. Best of luck.

A few questions:

What language, IDE, and OS are you using for development? What graphics package would be used for display?

Are you prototyping this as a desktop application initially?

If this would be a desktop application, would processing be targeted to the CPU(s), or also to the GPU(s)?

Would the server or client handle the processing? (If the server handles the processing, how many simultaneous users would it support?)

Would this be an open source project?

Is there a plan to model different rail geometries (e.g. flat-faced snooker rail) and different rail stiffnesses?

The pool shot simulator for a 2-d platform is a quick exercise in object oriented programming.

Out of curiosity, do you have any favorite design patterns (e.g. from the GoF book)? Do you see a good fit for particular patterns for this project?

Once you define the ball class and its methods, the whole runtime environment is finished, it is just discrete recursions of physics equations of two-dimensions.

Would you also model masse shots, half masse shots, and jumps? Or break shots in which the cue ball can fly off the table?

Of the different papers and books on the physics of billiards, is there one you've found particularly helpful?

What I am not promising is a grand program that looks real. I do not have plans for developing the graphics of the program, which I think will turn a lot of people off.

If you develop a fully functional simulator, then I could provide some guidance and/or code for the UI. My time is already stretched pretty thin, but I could probably help you find someone to develop the GUI and design the user interaction.

Do you have experience writing APIs for UI designers to use?

The development process requires parameterization of position, velocity and acceleration. The first two are textbook calculations. The last is not needed because as the ball rolls it is under constant decceleration. The velocity changes continuously this is a problem because the distance between intervals changes over each interval. The solution is a recursive loop. Think about creating a smooth display, best guess is use many small intervals.

I'd be particularly interested to see a drag-draw shot modeled properly. If a striped cue ball were used to demonstrate a drag-draw shot, then the motion of the stripe could make it more clear to the user how the cue ball starts with backspin, then slides, then takes on natural roll.

I'd also be curious to see bank shots modeled well. If I could take my copy of Banking with the Beard (thanks, Freddy!) and reproduce many of the shots in a simulator--varying cue ball spin & speed for each shot--that would be cool.

Creating an efficient collision detection method, the distance between two balls during collision is exactly twice the radius, a loop checking distance between all objects seems costly. Maybe a motion and distance condition will enhance the efficiency.

Perhaps I'm misunderstanding something here.

Unless all balls are moving simultaneously, why would you check for collisions with all balls rather than just
1. the ball(s) in motion, and
2. the balls within one radius distance (+ a smidgen) of the projected path(s) of the ball(s) in motion?

For example, if the cue ball is shot from one corner pocket towards an object ball hanging in the opposite corner pocket, and if no balls are located in the ball-width path, then the other balls can be ignored for collision detection. Is that what you meant?

Of course, modeling all 15 balls in the rack for the break shot would be a different matter. Although I've yet to read Joe Tucker's Racking Secrets (but hope to soon), I'd be pleased if the simulator could reproduce Joe's work. Of course, I'd still buy Joe's DVD.

Again, best of luck with the project. Sounds fun.
 
I guess the AZ admin has solved the problem. I wonder what challenges were solved or are being solved?

I doubt if there is an online billiards server program that could be bought which features a simple connection interface to an existing user database. The AZ admin I think might favor a program that doesn't require special software because of the technical threats it presents.

If you had questions about programming a billiards simulator here are the equations
vf = vi + 0.5at^2 and delta_x = vi*t + 0.5a*t^2, just loop through those equations recursively and use a fixed time interval, unless you can program continuously in a discrete programming language. Another important equation is tan theta = opp/adj, you can use that to work out the angles at collision. A vector class as a ball property should provide the rest of the answers. If you are interested modelling realism as opposed to a pool simulation you would have to provide a programming language that operates continuously and not as looped logic statements.

Running simple tests, calculating the distance and velocity of the ball during motion illustrated the programs lack of efficiency, the computer wasn't ready for realism.
 
Last edited:
If you had questions about programming a billiards simulator here are the equations
vf = vi + 0.5at^2 and delta_x = vi*t + 0.5a*t^2, just loop through those equations recursively and use a fixed time interval, unless you can program continuously in a discrete programming language. Another important equation is tan theta = opp/adj, you can use that to work out the angles at collision.

The simplified form of the distance equation won't model the physics of billiards well enough to satisfy AzB members. Re-check your equation for final velocity, "vf = vi + 0.5at^2", and look for the error.

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.
 
Last edited:
Back
Top