Building a browser game with Phaser and Firebase: lessons from a solo project

By the Runofan developer · 21 November 2026

Runofan is made by one person, which means every technical choice has to save time. This article describes the tools behind the game, why they were picked, and what turned out to matter most. If you are thinking of building a small web game yourself, it might save you a few weekends.

The stack

Lesson 1: keep the game and the menus separate

The gameplay runs inside a Phaser canvas, but all the menus, the country picker, the results screen and the leaderboards are ordinary HTML laid over the top. Text in HTML is sharp on every screen, works with screen readers and translation tools, and is far easier to style than text drawn on a canvas. The canvas only does what it is good at: fast, smooth movement.

Lesson 2: write your own physics when the game is simple

Phaser comes with a physics engine, and the first version of Runofan used it. The rebuilt version does not. Runo only moves up and down, and the poles only move left, so a few lines of arithmetic each frame are enough: add gravity to the vertical speed, move Runo, move the poles, check for overlaps. Writing it by hand made the behaviour completely predictable and easy to tune.

Lesson 3: limit the time step

Games update many times per second, and each update moves things according to how much time has passed. If a phone pauses for half a second, a naive game would move everything half a second's worth in one jump, sending Runo through a pole. Runofan caps each step at about a thirtieth of a second, so a hiccup slows the game down briefly instead of breaking it. It also pauses automatically when you switch tabs or apps.

Lesson 4: the database is public, so protect it

When a browser game talks directly to a database, anyone can read the code and send requests of their own. The answer is not to hide the code but to write strict rules on the database side. Runofan's rules only accept score increases that a real run could produce, only for countries on the official list, and only for the current month. The details are in our article on keeping a leaderboard fair.

Lesson 5: draw what you can

Images are often the heaviest part of a web game. Runofan draws its stadium, poles and effects in code at start-up, which keeps the download small and the art sharp. The pixel stadium article explains how.

Lesson 6: phones first

Most players arrive on a phone, often from a link in a social app. That means the game has to load quickly on a mobile connection, respond to a tap with no delay, and fit a tall screen. Testing on a real phone early would have saved several rounds of fixes.

Lesson 7: ship, then improve

The first version of Runofan had mismatched art and a leaderboard anyone could fill with fake scores. It was still worth releasing, because real players showed which ideas worked. The country table, the part that felt most like a gamble, turned out to be the reason people kept playing. You only learn that by putting something out.

Play Runofan now →