Pooltool: a sandbox billiards game/tool

logo

Overview

  • pooltool is an open source sandbox game for pool/billiards developed for gamers and researchers alike
  • gamers can play different styles of pool (8-ball, 9-ball, etc.) in a 3D-rendered environment that emphasizes physical realism
  • researchers interested in pool physics, game theory, camera-projector systems, AI, robotics, and other billiards-related research topics can efficiently simulate shots using pooltool’s API, experiment with different physics models and shot evolution algorithms, and visualize programmatically-defined shots

Links

Implementation

  • Shots are evolved analytically, without the need for discrete time stepping (Leckie & Greenspan, 2005). This means that instead of collisions being detected, they are instead predicted, allowing the system to be advanced directly to the next collision/event. I discuss the algorithm extensively in this blog post
  • All physical interactions (ball-cloth, ball-ball interactions, ball-cloth, etc) are described in this blog post

Updates

Blog #1 - 04/21/2020

  • I do a literature review on the physics of billiards
  • I outline and explain the models I plan to use for each physical process

blog1

Blog #2 - 12/20/2020

  • I research different shot evolution algorithms
  • I discover the event-based shot evolution algorithm by Leckie and Greenspan
  • I describe in honestly excruciating detail the ins and outs of the algorithm

blog1

Blog #3 - 03/25/2021

  • I start pooltool
  • I develop a prototypical pool simulator that can evolve shots according to a discrete time stepping algorithm, or the event-based algorithm
  • I create a 2D, non-interactive visualization of simulated shots using pygame

blog3

Blog #4 - 08/11/2021

  • I graduate to panda3d
  • I render all essential objects and HUD (badly)
  • I implement all foreseeable user controls
  • I defined different game modes that the user can play (8-ball and 9-ball)

blog4

Blog #5 - 10/26/2021

  • I learn blender
  • I model a table, balls, a cue, and a room
  • I implement a collision resolver so the cue doesn’t intersect with geometry

blog5

blog5_2

Blog #6 - 05/03/2023

  • A general update with lots of gameplay footage

What’s next?

Implement more realistic physics.

11 Likes

This is pretty cool! And the physics do look quite well-handled, indeed! :slight_smile:

Nice work, I do think! :slight_smile:

1 Like

Great work, especially the attention to detail that you’re undertaking.

1 Like

Nice work, and impressive dedication to showing the math behind the body interactions. I also appreciate the YouTube video, it’s nice to see the original dev play around with a Panda3D game.

1 Like

Big update here.

I finally found the time to write up the fifth blog post of this project.

This represents a major milestone in which I completely transform the graphical state of pooltool.

Check the blog post for a more detailed overview of the changes.

Here are some pretty pictures of the results.

blog5
blog5_2
blog5_2
blog5_2
blog5_2
blog5_2
blog5_2
blog5_2

Next, I’ll be shifting my focus to increasing the realism of the physical interactions.

5 Likes

Overall, quite an impressive update, I do think! And indeed, the visuals of the thing are looking quite good, I feel! :slight_smile:

2 Likes

It’s been almost 2 years since my last update on pooltool. Usually that’s an indication that the project is dead, but I’m here doing CPR. In fact, despite the radio silence, I’ve been working on pooltool alongside what has been an eventful 2 years with finishing my PhD, starting a new job, moving countries, yada, yada, yada. During that time I could never find the energy to give a formal update on the project, but that’s coming to an end right now!

Since it’s been so long, there’s really no hope of giving any satisfyingly detailed report with commit hashes, correlating features with code snippets, etc. Instead I’m keep things relaxed with a devlog update. Please enjoy:

3 Likes

Congrats on finishing your PhD, and related personal achievements!

The usage of Numba looks to have significantly improved performance, to perhaps a fully playable degree!

For fun, I took your pool room and table models and made a quick implementation using Bullet. It’s quite bad! I can see now how your first-principles approach to the pool ball physics is key to supporting such a convincing billiards simulation. The main issue I’m having with Bullet is that the pool balls want to follow the slices of the tristrips as they roll over them, despite the surface ostensibly being perfectly planar.

1 Like

Thanks very much :slight_smile:

Hey, that’s really cool! I wonder it would still be bad if the table had more sensible vertices? I learned Blender specifically for this project, so it’s a bit of a “vertex hell”.

In fact, when the project was nascent I didn’t even think it would ever be rendered in 3D or support user interaction–it was just some python code and matplotlib plots. Then I found Panda3D and the rest is history. But as a result of this, the code for simulation (the python API) and the code for visualization/game have remained uncoupled, so that one can simulate pool without ever opening a Panda3D scene or relying on the vertex data of objects.

But your investigation does have me wondering what kind of simulation could be achievable using Bullet…

First of all, congratulations and well done on completing your PhD! :slight_smile:

And second, this is a pretty solid update: the game looks distinctly more pleasing to the eye, and it seems like the physics have been significantly improved! :slight_smile: