This is an open-source project bringing unsophisticated billiards physics written in typescript to the browser. Play pool, snooker, or 3-cushion online right here.
- Backspin and sidespin well modeled.
- Presentation using WebGL in any modern browser on mobile, linux, mac or windows.
- Record and playback breaks.
- Two player online mode with node websocket server.
- Nine ball, Snooker and three cushion billiards rules.
- Deploys to github pages, vercel.com and render.com with github actions.
Demos run in all major desktop and mobile browsers and uses WebGL
- Nine ball ⬀ make a break and share replay link with friends
- Three cushion billiards ⬀ the ultimate test of physics and player (average on both counts)
- Snooker ⬀ we await the first 147 submission to the leaderboard.
- 4-ball Straight pool ⬀.
- Inspect physics and tweak constants using diagrams.
- Try to get on the leaderboard of highest breaks hosted on vercel.com
- Try two player online hosted on render.com
- Papers on ball mechanics Han 2005 with important corrections by Kiefl.
- cushions, max spin, simulation and constants 1 2 3 4 5
- 3D graphics uses three.js
- Inline LaTeX editor for equations in README.md
Based on Han 2005 paper
where
This is based on a paper by Mathaven. Many of the figures from the paper are recreated to confirm correctness.
Slip velocity at cushion contact point I
Slip velocity at table contact point C
Numerical solutions for the centroid velocity of the ball during compression and resititution phases.
Numerical solutions for angular velocity of ball
Work done by the normal force at contact point
The ball is assumed to be bouncing in the +y cushion. Compression phase iterates until
For the restitution phase the iteration continues until the work done is
Some of the Mathaven equations not supplied by the paper were inferred by LLMs and the code for them was initially generated by a combination of Claude, Qwen and GPT-4o.
nvm use v18.17.1
yarn install
yarn dev
yarn gltfpack
This generates artefacts in /dist for prod deployment (e.g. on github static pages)
yarn serve
Then open http://localhost:8080/ in your browser to play
yarn test
yarn coverage
yarn deps
yarn upgrade -L
yarn prettify
yarn websocket
the client uses query parameter ?websocketserver=wss://some-host
to locate
a websocket server, open http://localhost:8888/dist/multi.html to see options
Use mouse, touch screen or keyboard:
⇦ ⇨ Aim
Control ⇦ ⇨ Fine aim
⇧ ⇩ Topspin and backspin
Shift ⇦ ⇨ Side spin
Space Hit - hold for more power
July 2018
July 2019
March 2021
August 2023 (mobile)
top | aim |
---|---|
Star History
This project is open source and licensed under the GNU General Public License - see the LICENSE file for details. Contributions welcome.