Guide

How Bazoocraft draws all its pixel art with code

There is not a single hand-drawn image in Bazoocraft. Every tile, every enemy, every sound effect is produced by small scripts with no dependencies. Here is how it works, and what we learned.

No image editor, only code

The 24 by 24 pixel tiles, the hero, the enemies, the items and the decorations are all drawn by Node.js scripts that write the PNG sprite sheets the game loads. They run on every build, so changing a color or a shape is a one-line edit followed by a rebuild.

The benefits: a consistent style, quick experiments, and a tiny repository. The cost: drawing a character in code is slower than with a pencil, so it pays off most for tiles and objects that come in many variations.

Color ramps

Each material is defined by a ramp of about seven colors, from darkest to lightest: stone, earth, grass, brick, ice, wood, metal… Drawing functions never pick a color directly: they pick a step on the ramp (shadow, base, highlight). This keeps the whole pixel art palette coherent and makes lighting consistent from one material to another.

Autotiling: tiles that know their neighbors

A level only stores which material is in each cell. When it is displayed, each cell looks at its four neighbors of the same family. With four neighbors, there are 16 possible shapes: exposed edges get an outline, outer corners are rounded, grass only grows on top, icicles hang under ice, platforms get end caps.

This is purely visual: physics, collisions and the recorded traces keep using the raw material of each cell on an invisible layer. Level authors never think about it; they paint “stone”, and the edges draw themselves. The technique is a classic of tile-based games.

Variants without visible repetition

A wall of identical tiles looks like wallpaper. So each tile has several variants, and the variant of a cell is chosen by hashing its x and y position: it is random-looking but deterministic, the same every time the level loads, with nothing for the author to do. Most materials have three weighted variants; organic ones like dirt, grass and foliage have four equally common ones.

The trick that makes variants fit together is edge-locked noise: everything that touches the border of a cell is identical in all variants, and only the center differs. Neighboring tiles always connect seamlessly, yet the eye never spots a repeating pattern. This is a small form of procedural generation.

Sounds are synthesized too

Every sound effect (jump, diamond, key, door, stomp, spring, death…) and the looping music come from a tiny synthesizer of about two hundred lines: oscillators, noise and volume envelopes, written straight into 16-bit mono WAV files at 22,050 Hz. The result is chiptune, the sound of old consoles, which matches the pixel art.

Thumbnails and share images

Level thumbnails are drawn in your browser from a compact description of the level, using the same autotiling rules, so the server never stores images. The only image made on the server is the preview shown when a level link is shared: a 1200 by 630 PNG rendered by a small software renderer with its own PNG encoder and a 5 by 7 pixel font, never written to disk and reduced to 256 colors to stay light.

What we learned

Generating art with code works best for systems: tiles, variants, effects, anything that follows rules. It also forces you to name every design decision, which makes the style easy to keep consistent. The hero’s cape, for instance, is a small physics simulation that is purely visual and never affects the hitbox, so it can never change a recorded time.

Curious about the other technical side of the game? Read how we verify speedrun times, or browse the platformer glossary.