MillionBalls
The best way to get good at pool is to hit a million balls. The MillionBalls app is the second-best way.
MillionBalls is a web-based simulator that improves your real-life pool game. While there is no real substitute for practice time at the pool table, there are times when you just can’t get to one.
The Ghost of an Idea
Remember COVID-19? Pool halls abruptly shut down along with everything else. This left a big void in my life because I’d been playing pool in leagues for years and a big part of my social and recreational life revolved around pool.
This got me thinking about ways to continue to develop my skills and find ways to improve without access to a pool table.
My initial idea was pretty simple. Draw an image of a shot and predict if the aim was true and where the cue ball would go. That way I could continue training my eye to see shots correctly and keep improving my shotmaking ability even without access to a pool table.
I had never really done any 3D graphics at that point, but I was aware of WebGL. I figured that would be a good way to get started quickly. A bit of research quickly led me to three.js.
Okay, this would be a quick little weekend project. All I need to do is draw a plane to represent the pool table, a few spheres to represent the balls, and I’d have a little toy project to play with.
The Uncanny Valley of Pool
The first concept was easy enough, and I did get it built pretty quickly. The initial version didn’t even draw a complete table… just a phantom target. There wasn’t really a physics engine to simulate the motion of the balls, it just used Dr. Dave’s 30° rule to draw out the path of the balls.
I quickly discovered that this crude approximation was awful and unsatisfying. It turns out that pool player use cues from the table geometry, diamonds, shadows, etc. to build up a mental picture of a shot and the required angles. Our brain is tuned to observing acceleration and following parabolic motion. Things look totally unnatural when those effects are missing.
Down the Rabbit Hole
Okay, clearly a crude approximation wasn’t good enough. Time to break out the high school physics. I dusted off the parts of my brain where I had stored math concepts I hadn’t used in a couple of decades and got to work.
Fortunately, Dr. Dave’s book and website are treasure troves of information about pool physics and were great starting points.
At first glance, a billiards simulator is an intimidating thing. There are potentially 16 balls on the table in various states of motion. They could be sliding, rolling, spinning and interacting with each other as well as table elements like the cloth, cushions, and pockets.
Like other people before me, I quickly realized that the motion of balls on a pool table could be divided into distinct phases like sliding and rolling and the acceleration in each phase is constant to a high degree of precision.
For example, a sliding ball will be decelerated by friction with the cloth while picking up angular velocity. This force disappears when loss of linear velocity and gain in angular velocity cause the ball to start rolling. At this point, the ball experiences a much smaller rolling resistance, which can also be modeled
easily. Crucially, it’s possible to derive a closed-form expression for the position of ball as a function of time within each phase. That also makes it straightforward to predict the time a ball will collide with another object.
All I had to do was derive the equations of motion for each phase of motion,
predict the time each ball would collide with another object or change its
phase of motion, do some relatively straightforward math to calculate the
new velocities post-collision and repeat until all balls reach the STATIONARY
state.
The rest, as Neal Stephenson described it in Cryptonomicon, is making license plates.
Making License Plates
As with so many other side-projects, I eagerly dived into the interesting parts of it. I was working on Facteroid at the time and that took up most of my days. As the COVID pandemic eased and things reopened real pool and other social activities took precedence over simulated pool in my limited free time.
When I decided to put Facteroid on the backburner and look for a full-time gig, I decided to take the time to do the few extra bits and pieces needed to turn the pool simulator from an experiment to a working web-based service.
There was a bunch of nuts-and-bolts stuff to be done. Informational pages. Signups and all the associated things that come with it like password resets. Luckily that’s all stuff I’ve done a million times before, so I was able to knock those out pretty quickly, and MillionBalls was born.
Whither MillionBalls?
Ultimately, I don’t think there is enough for a market for this to be a full-fledged company. I’m not sure thre are enough people who are serious enough about pool to use an app like this, but aren’t too advanced to benefit.
Adding more advanced features like patterns and spin might broaden the appeal a bit. I’ll definitely keep working on it in my spare time, and might even add paid features some day.
Go check it out, and let me know if ideas for things you’d like to see.