A raycast dungeon crawler that has to run on old phones in a browser: what worked for me

I’m making Embers in the Mist, a free browser RPG where first-person grid dungeons sit next to a village you build and a habit tracker that powers your hero. A few things I learned while getting the first-person part to run smoothly on phones:

• Render small, scale up. The dungeon is raycast column by column into a low-resolution ImageData buffer only about 208 pixels wide (walls, floor and ceiling all textured), then the canvas is scaled up. The pixel art look hides the low resolution.
• A per-column depth buffer is enough for sprites. Monsters, NPCs and props are billboards checked against that buffer, so no real 3D is needed.
• Stop drawing what nobody sees. My iPhone ran warm because the 2.5D village kept animating underneath the first-person walk. Putting the hidden village to sleep fixed it.
• Test on real phone sizes early. I keep a headless browser setup that screenshots every screen at iPhone sizes, because the safe-area insets broke my layout more than any renderer bug.

Mishap of the month: hold-to-walk felt like sprinting. After trying 0.29 s and 0.41 s per step, it now sits at 0.35 s.

Plain JavaScript, no engine. Much of the art is AI-generated (PixelLab) and cleaned up by hand, and I use an AI coding assistant. The game is free and non-commercial.

https://zdravypodnik.cz/mlha-nad-seravou/en/

@gamedev