Skip to content

Latest commit

 

History

History
185 lines (117 loc) · 9.56 KB

README.md

File metadata and controls

185 lines (117 loc) · 9.56 KB

billiards

codecov CodeFactor Code Smells Tests Open in Gitpod GitHub

Demo and Screenshot

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.

Features

  • 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.

Online Demo

Demos run in all major desktop and mobile browsers and uses WebGL

Reference material

Key equations

Based on Han 2005 paper

surface velocity

equation

sliding motion

equation

equation

equation

rolling motion

equation

equation

where

equation ,equation

cushion bounce

Future work on Mathaven cushion paper.

Useful commands

Install

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)

Run

yarn serve

Then open http://localhost:8080/ in your browser to play

Test

yarn test
yarn coverage

Maintain

yarn deps
yarn upgrade -L
yarn prettify

Two player

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

Controls

Use mouse, touch screen or keyboard:

Aim

Control Fine aim

Topspin and backspin

Shift Side spin

Space Hit - hold for more power

Progress snapshots

July 2018

2018

July 2019

2019

March 2021

2021

August 2023 (mobile)

top aim
2023 2023

Star History

Star History Chart

Licence

This project is open source and licensed under the GNU General Public License - see the LICENSE file for details. Contributions welcome.