< Back 

Baller

2024-03-01

An experimental pool system from 2024, in the style of 8 Ball Pool. You aim with the mouse, charge the shot with Shift and right click, and a few lines show you where the cue ball and the ball you hit are going to go.

LuauRobloxGameplayPhysics

Note

Unlike most of my old projects, I will improve this one in the future.

Pool with Roblox physics

The aiming guide: the cue behind the cue ball, the line to the ghost ball next to the 9, a yellow arrow showing where the 9 goes and a short line showing where the cue ball goes

Baller is a pool system I made in March 2024 to see how far I could get with Roblox’s regular physics. It’s experimental and has plenty of bugs, but there’s a lot of maths and research behind it. It plays almost like Miniclip’s 8 Ball Pool: you click and move the mouse to aim, and to shoot you hold Shift and right click. The longer you hold it, the harder the cue ball goes, up to 4 seconds. Pressing Q switches to a camera that looks down at the table.

The aiming guide

The guide is what took the most work. A spherecast the size of the ball goes out from the cue ball in the direction of the cue, and where it hits, a ghost ball appears, marking exactly where the cue ball will be at the moment of impact. If it hits another ball, two more lines show up. The object ball’s line follows the straight line through the centre of the ghost ball and the centre of that ball, because that’s the direction the hit pushes it. The cue ball’s line comes out perpendicular to it, which is the 90-degree rule from real pool. The length of both lines also tries to reflect how full the hit is: hit it straight on and the object ball takes almost all the power, so the cue ball’s line gets shorter.

The table seen from above after the break, with the balls spread out and the guide aiming at the 9

The physics

The balls are regular Roblox spheres with very little friction and elasticity turned all the way up. To make them slow down like they would on cloth, each one has a LinearVelocity and an AngularVelocity that aim for zero speed with a very low maximum force, so they act as constant drag. When you’re about to shoot, the client asks the server for permission, and the server hands it network ownership of every ball. That way the shooter’s computer runs the physics and the shot feels instant, with no waiting for the server. If you pot the cue ball, it goes back to its spot after two seconds.

What’s still unfinished

Sometimes the balls veer off when they’re moving slowly. I suspected the brakes, but after testing one ball at a time, everything points to the cloth: the table is a single UnionOperation with holes for the pockets, and for collisions Roblox splits it internally into convex pieces. Where two pieces meet there’s an invisible step that knocks the ball sideways, and at low speed that knock is much more noticeable. There are other things too: the collision sound script looks for its module in a folder that doesn’t exist, so the balls hit each other in silence, and there are no turns, because anyone in the server can shoot.