All work

Pool

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

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.jsBilliards engine: collisions, friction, pockets
  • src/scene.jsRendering with PixiJS
  • src/net.jsPeer-to-peer multiplayer with PeerJS
  • src/main.jsGame loop, input and turns
  • src/ui.jsMenu, HUD and dialogs
  • src/audio.jsSound effects
  • src/i18n.jsEnglish and Spanish text
  • src/config.jsTable, ball and physics constants