DEV Community

ludy.dev
ludy.dev

Posted on

Designing the Race Loop for a Browser Drag Game

I built Zelis Racing as a free, unofficial browser drag game with a ZelisRacing wiki on the same site. The interesting engineering problem wasn’t fitting a lot of actions on one screen. It was making a small set of actions feel clear when the player has very little time to think.

Start with the race phases

I find it useful to sketch the loop as phases: burnout, staging, green, and the run itself. That’s a browser-side design model, not a list of frameworks. It gives each input a context. A launch input before green and the same input after green are two different events from the player’s point of view, even if they arrive through the same control.

The practical design question is who gets to decide what phase the game is in. If the visuals and input handling infer it separately, they can disagree right when the player is paying the most attention. A single race state is a cleaner model: the presentation reflects the current phase, and input is interpreted against that phase.

Treat timing and rendering as separate jobs

The browser draws frames when it can. A timing rule shouldn’t quietly change because one device draws fewer of them. A useful way to reason about the launch is to compare elapsed time against the go signal rather than count rendered frames. The visual cue still matters, of course: the player is reacting to what they can see, not to an internal clock.

For a game like this, I’d test the boundary cases first. What happens when an input lands right as the light changes? Does holding a control behave differently from tapping it? If a tab loses focus mid-run, is the next input interpreted in a way the player can understand? Those tests tell you more than a clean run on a fast laptop.

Keep the wiki off the critical path

The wiki is a separate job for the same site. Someone who wants a race shouldn’t have to navigate a guide, and someone opening a reference shouldn’t have to start a run. That separation is as much an architecture decision as a navigation decision: it keeps the race screen focused on time-sensitive feedback and leaves the reading experience to pages built for browsing.

Top comments (0)