Things that went wrong building a 1000-stage action platformer that runs in a browser tab, and what fixed them.
I build Samurai Vengeance on my own, in plain JavaScript with no engine, and the whole game is one HTML file. These are write-ups of the problems that cost me the most time. Each one has the actual code involved, so if you're making a browser game you can check whether yours has the same bug.
A canvas gradient that got a negative number, and a skin missing from one table. Either one
froze the game solid with nothing on screen, because an exception inside a
requestAnimationFrame loop means the next frame never gets asked for. How it happens
and the two-line change that stops it.
Swinging at empty air filled the Ki bar. Every boss from stage 100 to 1000 was the same boss. And a hit box width was declared on every attack and never read. None of them crashed anything, which is exactly why they lasted.
▸ Read the full postEvery constant in my update loop was a per-frame value, which is correct on a 60Hz display and wrong on every other one. On a 120Hz phone the game ran twice as fast, and on a 144Hz monitor 2.4 times. It took a rejection letter to find it, and a fixed timestep to fix it without retuning anything.
▸ Read the full postIf you're here for the game rather than the code, the Boss Guide and Enemy Guide cover how everything in it actually works.
Play the game