Arel Kair

Computers & Reverse Engineering

Pool

A 2D pool game for the browser, with online 1v1 multiplayer and a physics engine written for it.

PlaySource

Status
Live
Since
June 2026
Stack
JavaScript, PixiJS, PeerJS, Vite
Languages
English, Spanish
License
MIT
A game of Pool in progress: the green table seen from above, with the shot and potted counters at the top.

Two ways to play

Singleplayer is free practice. Multiplayer is a 1v1 match: one player creates a game and shares a four-letter code, the other joins with it. Turns follow standard 8-ball rules.

To shoot, drag from the cue ball and release. The further you pull, the more power.

No server in the middle

The two players connect to each other peer-to-peer through PeerJS. There are no game servers to run and nothing to set up on the router.

What is inside

The code is split by responsibility. The physics are not a library: collisions, friction and pockets are handled by a billiards engine written for this game, and there is a self-test for it.

src/physics.js
Billiards engine: collisions, friction, pockets
src/scene.js
Rendering with PixiJS
src/net.js
Peer-to-peer multiplayer with PeerJS
src/main.js
Game loop, input and turns
src/ui.js
Menu, HUD and dialogs
src/audio.js
Sound effects
src/i18n.js
English and Spanish text
src/config.js
Table, ball and physics constants