A fixed-step physics loop
The balls do not use a general-purpose physics library. The game runs its own simulation at a fixed step of 1/240 of a second, up to 60 steps per frame, so a shot plays out the same way on a 60 Hz phone and a 144 Hz monitor. Phaser 3.90 draws the table.
Sliding, then rolling
Every ball tracks its velocity and its spin. Right after a strike the ball slides: the point touching the cloth is moving, and friction (coefficient 0.2) both slows the ball and converts the slip into roll. Once the slip is gone the ball rolls, and it slows by a constant amount plus a little drag that grows with speed, until it is slow enough to stop. Simplified from the game's code:
// rolling: lose a fixed amount plus a speed-dependent amount each second
const decel = cfg.rollingDecel + cfg.rollingDrag * speed; // 110 + 0.32 × speed
const newSpeed = speed - decel * dt;
if (newSpeed <= cfg.stopSpeed) stop(ball); // stopSpeed = 6
This two-stage model is what makes spin work. Hit the cue ball dead centre on a straight shot and it slides into the object ball, hands over almost all its speed and stops. Hit it high and it is still turning forward after the collision, so friction drags it on through: a follow shot.
Collisions and cushions
Ball-to-ball collisions have a restitution of 0.95, so each hit loses about 5% of the energy. Cushions return 80% of the ball's speed (restitution 0.8), apply friction of 0.14 along the rail and keep a quarter of the ball's spin, which is why side spin widens or narrows the angle a ball leaves a cushion at.
The table
The table measures 2,240 × 1,120 units, the 2:1 shape of a real pool table. Balls have a radius of 28.6 units. Corner pockets have a radius of 64 and side pockets 54, which is why the career level "Side Door" tells you to aim for the middle of the mouth.
How the computer chooses a shot
Each bot lists candidate shots and scores them. A pot is worth a base of 100 points plus a bonus of 350, with penalties for thin cuts, long distances and balls in the way, minus 600 for a likely foul and plus 10,000 for a shot that wins the frame. It then weighs where the cue ball will end up and how good the position is for its opponent. The three levels differ in how many candidates they consider and how much random error is added to the chosen shot (see the table above). Only the Advanced bot runs its candidates through the physics engine before choosing, which is how it plans position rather than just pots.
Career mode
There are 22 career levels rated from one to five stars. They start with "First Contact", a single straight pot in three shots, and teach one idea at a time: cut shots, banks, speed control, follow (level 12) and draw (level 13). Full matches against the computer appear at level 9 (Beginner), level 17 (Intermediate) and levels 20–21 (Advanced, including a handicap match where you start two balls up). The last level, "Grand Finale", asks you to clear nine balls in fourteen shots and under five minutes.