← Back to Algo Snake

How Algo Snake Is Made

A note on rendering a generative art snake in plain Canvas 2D.

Algo Snake is a generative art snake game: instead of a block snake, every run grows a unique creature whose body is drawn fresh each frame. This page is a short technical tour of how that works. You can browse the species in the gallery or just play it.

The body is drawn, not stored as sprites

The snake's body is a procedurally generated organism rendered along the snake's moving spine — there are no sprites, textures, or meshes. Each frame:

1 · recent path 2 · resample + wave 3 · ornaments per step
Each frame: the recent path → resampled to even spacing with a distance-bound wave → per-archetype ornaments hung off every step.

Glow comes from density, not blur

Everything is just additively-blended points: globalCompositeOperation = 'lighter'. There are no gradients, shadows, or blur filters. The glow is an emergent property of point density — wherever strokes overlap, light accumulates. A practical consequence: tuning "brightness" really means tuning how densely points are scattered, which couples brightness to cell size and took a fair amount of iteration to balance across species.

one point — faint many overlapping — bright
Additive blending (lighter): where strokes overlap, light accumulates. Brightness is an emergent property of point density — no blur or glow filter involved.

38 species from one seed

There are 38 archetypes, but they're all one parametric system driven by a single integer seed through a small PRNG (mulberry32). The same seed always produces the same creature, deterministically. That's what makes seeds shareable as ?seed=12345 links, and it's also why the start-screen preview and the share card can render the same organism the game does.

seed 12345 mulberry32 PRNG shape genes ω · ribLen · hue · archetype
One integer seeds a small PRNG that fills in every shape gene — so the same seed always grows the same creature, deterministically.

Play Algo Snake  ·  Browse the species gallery