Cross-Platform
Production-ready patterns for Cross-Platform development
Rendering
2 patternsBlink on a Clock
PRESS START winks on a 32-frame beat read straight off a frame counter — one AND instruction selects draw or clear. A blink is two renderers taking turns on a clock you already had.
Sprite Animation
Cycle through animation frames with configurable timing. Walk cycles, explosions, idle animations.
Input
1 patternAudio
2 patternsFour Ways to Make a Sound
The tune driver is the same on every machine — but what it talks to isn't. Paula streams a sample, the APU synthesises fixed voices, the SID shapes a rich one, and the Spectrum toggles a single bit. Four answers to 'how does a computer make a sound?', and each one shaped the music.
Tune Sequencer with Two Terminators
A melody is a table of pitch and duration; a once-per-frame tick serves it. One terminator loops (title music), the other stops (fanfares and stings) — win and lose having voices costs one extra marker.
Physics
3 patternsAABB Collision Detection
Axis-Aligned Bounding Box collision — fast rectangle overlap test for sprites and objects.
Fixed-Point Math
Fractional values without floating point. Essential for smooth movement and physics on 8/16-bit CPUs.
The Grace Window
A second of invulnerability after every respawn, covering every damage source, made visible by blinking the player. Without it, dying once where a hazard sits can spend every life in as many frames.
Framework
5 patternsEscalation as Data
Difficulty lives in a table; a level-up pokes the next row into live tuning variables the systems read fresh every frame. The systems never learn that levels exist.
Game State Machine
Organise game flow with distinct states (title, playing, game over). Clean separation of game phases.
LFSR Random Numbers
Linear Feedback Shift Register for fast, deterministic pseudo-random numbers.
The Ending Dwell
Win or lose, the screen holds for a beat before any button is believed. The pause is the punctuation that lets the player read their own ending — and it stops a held button blowing through three screens in three frames.
Three Caps: Counter, Index, Digit
A level counter, a table index, and a HUD digit are three different numbers with three different caps. The counter never stops, the index clamps for safety, the digit caps for display — conflate them and the game lies about one of them.