How Runofan's pixel stadium is drawn in code

By the Runofan developer · 21 November 2026

If you open Runofan and look at the stadium behind Runo, you might assume it is a single picture. It is not. Apart from Runo himself and the sound effects, almost everything you see is drawn by the game when it starts, one coloured rectangle at a time.

Why draw it instead of loading an image?

The first version of the game used a large photographic stadium image. It looked impressive in a screenshot but caused three problems. It was several megabytes, which made the game slow to start on a phone. Its realistic style clashed with the pixel-art character. And it could only be shown at one size without becoming blurry or stretched.

Drawing the stadium in code solves all three. The instructions for drawing it are tiny compared to an image file, the style matches Runo exactly, and the pixels stay perfectly sharp at any screen size.

Thinking in "art pixels"

The game screen is 400 by 600 units, but the art is designed on a coarser grid where one art pixel is four units wide. Every shape in the stadium is placed on that grid. This is what gives the scene its chunky, retro look, and it is why the crowd, the steps and the floodlights all line up neatly.

The layers

The stadium is built from separate layers, painted back to front:

Making a crowd that looks the same every time

The crowd uses random colours, but it would be distracting if it changed every time the page loaded. The game uses a seeded random number generator: a formula that produces the same "random" sequence whenever it starts from the same number. So the crowd looks random, but it is identical for every player.

A cheering crowd for free

The game actually draws the stands twice. The second version uses a different seed and moves about half the fans up by one pixel, with two extra pixels for raised arms. When you hit a PERFECT pass or reach a milestone, the game swaps to the cheering version for a quarter of a second. It costs almost nothing, but the stadium suddenly feels alive.

Parallax

The layers do not scroll at the same speed. The pitch moves at the full speed of the game, the advertising boards at under half, and the stands at about an eighth. That difference in speed is called parallax, and it is what makes a flat scene feel deep.

The training poles

The obstacles are drawn the same way: a white and red striped pole with a dark outline, a highlight down one side and a shadow down the other, topped with a gold cap. The top pole is simply the same drawing flipped upside down.

None of this is complicated on its own. The trick is choosing a small set of rules and colours and applying them consistently, which is really what pixel art has always been about.

Play Runofan now →