Billiards Save

billiards physics in the browser

Project README

billiards

codecov CodeFactor Code Smells Tests Open in Gitpod

Demo

Features

Unsophisticated billiards with spinning ball physics written in typescript.

  • Backspin and sidespin well modeled.
  • Presentation using WebGL in any modern browser or mobile.
  • Record and playback breaks.
  • Two player online mode with node websocket server.
  • Nine ball and three cushion billiards rules

Online Demo

Demos run in all major browsers and use 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

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

Open Source Agenda is not affiliated with "Billiards" Project. README Source: tailuge/billiards

Open Source Agenda Badge

Open Source Agenda Rating