The big picture
Once two players are connected, their browsers talk directly. The room code server steps out of the way.
Step by step
Pick fighters and a stage Your browser
23 original fighters, each with their own attacks, specials, throws, costumes and a finishing move, across 8 stages. You can play alone against the computer, with a friend on the same keyboard, or online.
Read the controls Your browser
Each frame, the game reads the keyboard, any gamepads, or the on-screen buttons on a phone. Presses are buffered for a few frames, so an attack pressed slightly early still comes out.
Run the physics Your browser
The engine moves every fighter, checks which attacks connect, and works out damage and knockback. The numbers are tuned against measurements from Smash Ultimate, so a hit at 100% sends you about as far as you'd expect.
Let the computer fight back Your browser
Computer players choose moves from each attack's frame data: how fast it comes out and how far it reaches. Higher levels guard the edge, punish mistakes and recover back to the stage. A 506-game round robin checks they rarely fall off by themselves.
Connect with a room code The internet
For an online match, one player creates a room and shares a short code. PeerJS uses it to connect the two browsers directly over WebRTC, and both check they're running exactly the same version of the game.
Swap inputs, not the game Both browsers
Each frame, each browser sends only the buttons its player is pressing. Both wait for the other's input, then advance one frame. The fight is deterministic, so both screens stay identical, and they compare a fingerprint of the match every two seconds to catch any drift.
The pieces
Canvas and plain JavaScript
Every fighter, effect and menu is drawn by code. No game engine or framework.
It loads instantly in any browser, and I control every frame.
Combat engine
Hitboxes, knockback, hitstun, shields, ledges and throws, modelled on how Smash Ultimate works.
The feel of the hits is the whole game.
Computer opponents
Pick moves from frame data, guard the ledge and steer their recovery.
You can play alone and still get a real fight.
Lockstep netcode
Only inputs cross the internet, with a seeded random generator so both sides make the same "random" choices.
Tiny messages, and no server to pay for or run.
PeerJS and WebRTC
Connects two browsers directly using a short room code.
Online play without accounts or a game server.
Automated test suite
A headless browser plays scripted inputs and checks 56 rules, from double jumps to parries.
Tuning one move can't quietly break another.
Trade-offs I chose
- Online play adds a small delay (about 67 milliseconds) instead of rollback netcode. It's simpler and plays well between nearby players, but feels sluggish over long distances.
- There's no relay server, so a few strict home or work networks can't connect online.
- Online matches are one against one. Up to four can play on one computer.
- Computer players aren't equally strong with every fighter yet.
- The music is synthesised in the browser rather than recorded.
Ultra Brawl