Skip to content

Techniques

91 articles

Programming and graphics techniques, from raster interrupts to sprite multiplexing.

Why do the colours clash?On the Spectrum, shape and colour live in separate blocks of memory. When a sprite moves, they do not always agree.Dizzy moving into the platform’s colour cells, with part of his sprite turning red.

Follow a question.

All techniques.

91 articles

AGSP

Any Given Screen Position

About this article

A Commodore 64 trick that puts the whole screen, colours included, at any position without copying it: VSP sets the horizontal offset, linecrunch the vertical one, and the fine-scroll bits finish the job to the pixel. The scene's list of firsts records the combination in the demo Bonanza in November 1988, and its tell-tale sign is a band of blank lines at the top of the screen.

Arbitrary Code Execution

When game data becomes instructions

About this article

An exploit that redirects a game into machine code prepared through its own inputs, illustrated by Pokémon's 8F item and a Super Mario World demonstration.

Arpeggio

Chords from a single channel

About this article

A sound chip with three voices cannot spare three of them for a chord. An arpeggio plays the chord's notes one after another on a single voice, changing pitch every frame or every tick, so fast that listeners hear a buzzing chord. It became part of the sound of the C64's SID, the AY chips, the NES and Amiga trackers.

ASCII Art

Pictures from punctuation

About this article

ASCII art is a picture made of printable text characters. Radio amateurs sent teletype pictures long before home computers; by 1980 CompuServe offered line-printer pictures for download, the Snoopy calendar was a byword, and the bulletin boards went on to add ANSI colour art, signatures and the :-) smiley, which Scott Fahlman proposed in 1982.

Attribute-Aware Design

Designing for the ZX Spectrum's two-colours-per-cell rule

About this article

How Spectrum designers and programmers worked with the rule that each 8×8 cell has one ink and one paper colour: one-colour rooms, colour kept where the sprites are not, sprites that wear the background's colour, black masks, whole-cell movement, and the attribute byte reused as a map.

Audio Programming

Sound from code

About this article

Home computers and consoles of the 1980s and early 1990s had no sound library to call. A program made music by writing numbers into a sound chip's registers, usually fifty or sixty times a second, or, on the 48K Spectrum, by switching a speaker on and off itself. Each chip set different limits, from the SID's three synthesiser voices to Paula's four sample channels.

Bank Switching

More memory than the processor can see

About this article

An 8-bit processor can address 64K at most, and some far less. Bank switching puts extra ROM or RAM behind a window in the address map and lets the program choose which bank shows through, by touching a special address on an Atari 2600 cartridge, writing to an NES mapper, or setting bits in a port on the C64, Spectrum 128 and CPC6128.

Beeper Music

Tunes and chords from the 48K ZX Spectrum's one-bit speaker

About this article

The 48K Spectrum has no sound chip: the processor makes every note by flipping one bit of port $FE at the right moments. Its manual said that meant one note at a time. Within a few years programmers were playing continuous in-game tunes and three-voice chords through the same bit.

BOBs: Blitter Objects

Software sprites on the Amiga

About this article

A BOB is an image the Amiga's blitter draws into the playfield itself, through a mask, after saving the background it covers. BOBs can be any size and use every colour of the screen, which the eight 16-pixel hardware sprites cannot, but each one costs three blits a frame for every bitplane.

BSP Trees

Sorting a level's walls once, so every frame draws them in order

About this article

A binary space partitioning tree cuts a level into convex pieces in advance, so that from any viewpoint the renderer can visit its walls in depth order with one side-of-line test per branch. Graphics researchers described it in 1980; John Carmack adopted it in 1993 for the Super Nintendo Wolfenstein 3D and then rebuilt Doom's renderer around it, walking the tree front to back so that no wall pixel was drawn twice. Quake took the tree into three dimensions and added a pre-computed Potentially Visible Set.

Cel Shading

3D drawn to look like a cartoon

About this article

Cel shading draws 3D models with a few flat bands of colour and a heavy outline, so that they look like hand-drawn animation. LightWave 3D shipped a Cel Shader for television animators by 1997; Sega's Jet Set Radio brought the look to games in 2000, Nintendo's cartoon Link divided the press at Spaceworld in 2001, and by 2003 magazines were calling cel shading a fad.

Character Graphics

Building worlds from 8×8 blocks

About this article

Redefining a computer's text characters as game graphics, so that a whole screen is a list of a thousand character codes. On machines with a character mode, such as the Commodore 64 and VIC-20, it saved memory and made moving the screen eight times cheaper than a bitmap; on the Spectrum and BBC Micro the same idea was drawn into a bitmap by the operating system.

Character-Shift Parallax

Parallax by redrawing the font

About this article

The C64 scrolls one character screen, so its games faked a second layer by rolling the pixel definitions of a few background characters against the scroll. Achim's Codebase64 routine names Bounder, Parallax and Marauder; John Rowlands added it to Mayhem in Monsterland in an hour.

Client-Side Prediction

Moving before the server replies

About this article

Client-side prediction makes local movement respond immediately while a server remains in charge of the game. QuakeWorld's code and contemporary coverage show both the benefit and its limits.

Collision Detection

When objects meet

About this article

Collision detection decides when game objects touch: rectangle tests, circle tests, tile lookups and pixel checks, each trading accuracy against processor time. The Commodore 64 and Atari 8-bit machines could spot overlapping pixels in hardware, but the C64's registers said only that a sprite had hit something, and many programmers did the sums themselves.

Colour Clash

Two colours per 8×8 cell, and what happened when things moved

About this article

The ZX Spectrum stores colour for each 8×8 cell of the screen, not for each pixel, so anything drawn into a cell shares that cell's two colours with whatever is already there. Sinclair chose it to save memory; the period press called the result "attribute problems" and graded games on how they handled it.

Cycle Accuracy

Emulation timing tiers

About this article

A cycle-accurate emulator reproduces what every chip in a machine does on each clock cycle, not just what each instruction does. Most games never notice the difference; the ones that do hang, lose their raster effects or fail their copy protection, and the accuracy costs up to ten times the processing power.

Data Compression

Fitting more into less

About this article

Compression stores data in fewer bytes and restores it when needed, at the cost of a decoder and the time it takes to run. Run-length encoding, LZ77-style back-references and Huffman codes did most of the work on 8-bit and 16-bit machines: in C64 and Amiga crunchers, in the tile data of NES and Mega Drive cartridges, and in the executable packers that make 4K and 64K demo-scene intros possible.

Digitised Sprites

Real actors, pixel form

About this article

Digitised sprites are video frames or photographs of real people, captured, cut out and reduced to a machine's palette. Bally/Midway's Journey had digitised faces in 1983, Williams built a video pipeline for NARC in 1988, Atari's Pit-Fighter made whole fighters from it in 1990, and Mortal Kombat made it famous. Not to be confused with Rare's rendered sprites or full motion video.

Dirty Rectangles

Redraw only what changed

About this article

Keep a list of the screen areas that changed since the last frame, rebuild only those, and copy only those to the display. Windowing systems of the 1980s made it a system service (the Macintosh's update region, GEM's rectangle list, the Amiga's DamageList, Windows' invalid rectangle), and games used it wherever most of the screen stood still; Doom (1993) still kept a 'dirtybox'.

Dithering

More colours from fewer

About this article

Dithering mixes dots of the colours a machine has so that, from a distance, the eye sees colours it does not have. Ordered patterns were cheap enough for printers and paint programs; error diffusion, such as Floyd–Steinberg, gave smoother results. Amiga artists used it by hand for shading and texture, and C64 converters used it to fit photographs into the machine's 16 colours.

Double Buffering

Draw where the player can't see, then show it all at once

About this article

Double buffering draws the next picture somewhere the display is not reading and then shows it in one step, so the player never sees a half-drawn frame. The C64 flips it with $D018 and $DD00, the Amiga with its bitplane pointers, and the Spectrum 128 with bit 3 of port $7FFD; the 48K Spectrum has one fixed screen and has to copy.

DYCP

Different Y Character Position

About this article

The C64 demo scroller in which every letter bobs up and down on its own point of a sine wave as the text crosses the screen. It fakes a small bitmap out of redefined characters, because eight sprites are too few and a real bitmap is too slow to clear. Pasi 'Albert' Ojala wrote the method down in 1991, and C= Hacking published it in 1993.

Emulation Techniques

Software becoming hardware

About this article

How an emulator runs another machine's software: interpreting or recompiling the old processor's code, rebuilding its display, keeping its chips in step, sometimes replacing whole routines with native ones, and reading its original media. Explained through what the programmers and reviewers of the 1990s and 2000s said about their own emulators.

Filter Sweeps

Moving the SID's cutoff while a note plays

About this article

A filter sweep changes a filter's cutoff frequency while a note sounds, so the tone opens up or closes down. The C64's SID put a resonant analogue filter on the chip with an 11-bit cutoff a program could rewrite at any moment, and its data sheet recommended doing exactly that. The catch was the filter itself: it varied from chip to chip, and Martin Galway refused to use it.

Fixed-Point Maths

Smooth movement without floating point

About this article

Fixed-point arithmetic stores fractions in ordinary integers by agreeing where the binary point sits. It gave 8-bit games and demos sub-pixel movement, gravity and 3D rotation using only the processor's integer add, subtract and shift, at a fraction of the cost of the floating-point routines in ROM.

FLD

Flexible Line Distance

About this article

A Commodore 64 trick that holds back the VIC-II's badlines so that the next character row starts lower down, opening a gap of any number of raster lines and pushing everything below it down the screen without moving a byte of memory. It needs no exact timing, and the scene's own list of firsts records it in commercial games before it appeared in demos.

FLI

Flexible Line Interpretation

About this article

A C64 graphics trick that makes the VIC-II fetch fresh colour data on every pixel line of a bitmap instead of every eighth, by forcing a badline on each line and switching to a different screen each time. It gives far more colours per character cell, at the cost of eight screens of memory, almost all of the processor's time during the picture and a stripe down the left edge that cannot be used freely.

FPP

Flexible Pixel Position

About this article

A Commodore 64 trick that lets a program choose which line of graphics the VIC-II shows on every raster line, so a picture can be turned upside down, repeated or stretched. It is built from the same badline tricks as FLD and linecrunch, and the scene's list of firsts gives it to the demo Random, released in June 1989.

Frame Animation

Movement from a series of drawings

About this article

Frame animation shows a series of still drawings one after another, so a character seems to walk, fly or fight. Every drawing costs memory, and on machines without sprites drawing time too, so 8-bit programmers rationed them: Manic Miner's Willy walks on four drawings a direction, and Sensible Software's construction kit taught users to reuse and mirror frames. By the late 1980s publishers were advertising frame counts in the hundreds.

Frameskipping and Interpolation

Running the logic slower than the screen

About this article

When a C64 game runs out of raster time it can draw less often than it thinks (frameskipping) or think less often than it draws, filling the gaps by moving sprites in straight lines (interpolation). Cadaver set out both in his Rant 9 and used interpolation in Metal Warrior 4.

Ghost AI

Pac-Man's four personalities

About this article

Pac-Man's ghosts do not plan or search the maze. At each junction a ghost takes the turn that brings it closest to one target square, and the four ghosts choose their squares differently. Toru Iwatani built it that way so they would not follow each other "like a string of beads"; the rules are so regular that players learned routes through them.

Hard restart

Working around the SID's ADSR delay bug

About this article

Many C64 music players silence a SID voice and zero its envelope settings a couple of frames before the next note. The SID's envelope generator can otherwise stall for up to 32,768 cycles, a little over one and a half PAL frames, when its attack, decay or release rate is lowered, so a note starts late by an unpredictable amount. Rob Hubbard's 1985 player already did it; the mechanism was pinned down years later.

Hardware Scrolling

Moving the picture by changing where the chip starts drawing

About this article

Scroll registers let a video chip start drawing the picture a few pixels later, so one register write moves the whole screen. The Atari 400/800's ANTIC, the C64's VIC-II, the NES PPU, the Master System's VDP and the Amiga's bitplane DMA each did it differently, and each left the program a different amount of work when the fine scroll ran out.

Hitboxes

Collision boundaries

About this article

A hitbox is the invisible rectangle a game tests instead of the drawn shape. Designers sized them by hand: Dave Jones shrank Menace's alien boxes to fit the smaller aliens, C64 coders kept a box per sprite type, and bullet-hell shooters cut the player's box to a few pixels so dense bullet patterns could be dodged.

Interrupt-Driven Music

Sound without blocking

About this article

A music driver called from an interrupt fifty or sixty times a second keeps a tune playing at a steady tempo while the main program runs the game. The C64's raster and CIA timer interrupts, the Spectrum 128's interrupt mode 2, the NES's vertical blank NMI and the Amiga's level 3 and CIA interrupts all served, and the composers of the period wrote their own drivers to fit into the few hundred cycles each call was allowed.

Isometric Projection

Solid-looking 3D rooms drawn with flat 2D graphics

About this article

An isometric view shows a 3D world from a fixed angle above one corner, so that it can be drawn from flat, unscaled pictures. Zaxxon brought it to the arcades in 1982; on the ZX Spectrum, Ant Attack, Knight Lore, Batman and Head Over Heels made it the look of the arcade adventure. They drew it with a slope of two pixels across for one down rather than a true 30°, and on machines without hardware sprites they depended on masked drawing and on working out which object was in front.

KERNAL I/O Routines

The Commodore 64's jump table for screen, keyboard, tape, disk and serial I/O

About this article

The last page of the C64's ROM holds 39 three-byte JMP instructions, the KERNAL jump table. Commodore promised the addresses would never move, so JSR $FFD2 prints a character on the PET, VIC-20, C64, Plus/4 and C128 alike, and ten of the jumps go through RAM so that cartridges and fastloaders can take them over.

Linecrunch

Squeezing a character row into one raster line

About this article

A Commodore 64 trick that makes the VIC-II treat a whole character row as finished after a single raster line, so everything below it moves up the screen without a byte of memory being copied. It is FLD's partner in the opposite direction, it needs much tighter timing, and the scene's own list of firsts records it on a cracked game's intro in July 1987.

Lookup Tables

Trading memory for speed

About this article

A lookup table works an answer out in advance, once for every input a program will need, so that at run time one indexed read replaces a calculation. On 8-bit processors with no multiply instruction it turned sines, products, screen addresses and mirror-image graphics into a few cycles each, at the price of the memory the table filled.

Memory Management

Making the most of limited RAM

About this article

On machines with a few kilobytes of RAM, deciding where every byte went was part of designing the game. Programmers reclaimed memory from the system, chose formats such as character graphics that cost less, put data where the hardware could reach it, and sometimes cut whole levels when the budget ran out.

Memory Mapping

Addresses for everything

About this article

Memory-mapped I/O gives each hardware register an address, so a program drives the video chip, the sound chip and the joystick ports with the same loads and stores it uses for memory. The 6502 and 68000 had no other way; the Z80 had separate I/O ports as well. The addresses behave unlike memory: some registers cannot be read back, and reading others changes them.

Multidirectional Scrolling

Eight ways, or any way

About this article

On the Commodore 64, scrolling in every direction means moving up to 1,000 bytes of screen memory and 1,000 of colour memory each time the fine scroll runs out, which takes more than half a frame. Programmers spread the copy over several frames, hid it on a second screen, and chose between locking the scroll to eight directions and letting it go any way.

Object Pooling

Reuse, don't reallocate

About this article

Object pooling sets aside a fixed number of slots for things like bullets and particles and recycles them, instead of creating and destroying objects as the game runs. On 8-bit machines it was simply how games were written; modern engines keep it to avoid allocation costs and memory fragmentation.

Opening the borders

Drawing outside the frame the VIC-II reserves

About this article

The C64's border is not a frame but a switch: the VIC-II turns it on and off at fixed beam positions. Changing the screen height or width at the right moment makes the chip miss the switch, so sprites can be shown where the border should be. The top and bottom borders need a write on the right raster line; the side borders need one on an exact cycle of every line.

Palette Cycling

Animation by changing colours, not pixels

About this article

On machines whose pixels store a colour number rather than a colour, a program can animate a picture by rotating the colours held in a range of palette registers. Waterfalls flow and lights pulse while the bitmap stays untouched. Deluxe Paint offered it on the Amiga from 1985, the Boing Ball spun by it, and VGA programmers used the same idea; on the Commodore 64, with its fixed colours, the nearest equivalent was changing the shared colour registers.

Parallax Scrolling

Depth through motion

About this article

Parallax scrolling moves layers of scenery at different speeds so that a flat picture seems to have depth. Irem's Moon Patrol (1982) is widely credited as the first mainstream game to use it. Machines with two or more scrolling layers, such as the Amiga, Mega Drive and Super Nintendo, did much of the work in hardware; on the C64, NES and Spectrum programmers faked the extra layers with raster splits, redefined characters and software.

Pixel Art

Painting with squares

About this article

Drawing by placing each dot of a low-resolution, limited-colour screen by hand. Two Xerox researchers used the phrase as a title in 1982; Antic used it for Lucasfilm's games artist in 1984. Spectrum and C64 artists planned their graphics on graph paper; Amiga artists worked in 16 colours in Deluxe Paint; by 1994 studios were advertising for 'pixel artists'.

Position-Independent Code

Code that runs anywhere

About this article

Machine code that runs correctly wherever it is loaded, because it never names its own addresses. The 6809's architects made it one of their highest-priority design goals (BYTE, 1979), Motorola's manual made it a rule, and Microware's OS-9 relied on it. On the 6502, Apple asked the makers of expansion cards for it, and programmers got there with branches and a trick with the stack.

Pre-Rendered Backgrounds

Pictures made once, played in for ever

About this article

A pre-rendered background is a picture of a place, drawn or rendered in advance, with characters drawn over it at run time from a camera that matches the picture. Alone in the Dark built its rooms that way in 1992, Myst and Donkey Kong Country rendered theirs on expensive workstations, Resident Evil adopted them when the PlayStation could not draw its mansion in real time, and Final Fantasy VII made them the look of the PlayStation's biggest game. The price was a camera that never moves.

PRINT vs POKE

Why games don't use PRINT statements

About this article

C64 programmers are often told that games POKE to screen memory because POKE is faster than PRINT. Timed, a BASIC POKE loop is slower than PRINT. What POKE gives is control over exactly which cell changes and what colour it is; the speed that games needed came from machine code, which filled the screen about 650 times faster than the POKE loop.

Procedural Generation

Worlds made by a program instead of stored on the disk

About this article

Procedural generation builds game content with an algorithm instead of storing it. In the home-computer era it let Elite fit eight galaxies into a 32K BBC Micro, gave The Sentinel 10,000 landscapes, River Raid an endless river in a 4K cartridge and Captive tens of thousands of bases; Rogue made a new dungeon every game. The same ideas run through Frontier, Spelunky, No Man's Sky and Elite Dangerous.

Pseudo-3D Road

How Turbo, Pole Position and Out Run drew a road to the horizon

About this article

A perspective road drawn without 3D geometry: each screen line below the horizon stands for one distance ahead, shifted sideways for bends and up or down for hills, with cars and scenery as pictures scaled by distance. Sega's Turbo had it in arcades by 1982, a year before Pole Position took over the charts, and Out Run made it the look every home computer tried to copy. Programmers converting those games wrote the road routine first.

Pulse Width Modulation

Changing a square wave's shape while it plays

About this article

A pulse wave's tone depends on how much of each cycle it spends high. The C64's SID sets that with a 12-bit number per voice, and music players changed it every frame to make notes move; Rob Hubbard's first player swept it between a square and a narrow pulse. The NES offers four fixed shapes, and Spectrum programmers used pulse width on the one-bit beeper as a volume control.

Ragdoll Physics

Dynamic death

About this article

Ragdoll physics hands a jointed character to the physics engine so it falls as the forces dictate. Chris Hecker described it in Edge in 1998; Hitman: Codename 47 (2000) shipped physics-driven corpses; Unreal Tournament 2003 made ragdolls a selling point through MathEngine's Karma; and Gabe Newell dismissed the result as flopping-around corpses once Half-Life 2 had made physics a tool instead.

Random Numbers

RND, its seed, and the SID's noise

About this article

Home computers made their random numbers by arithmetic, so they were not random at all. A Commodore 64 prints the same RND(1) value every time it is switched on, its RND(0) reads hardware timers that Mapping the Commodore 64 found badly flawed, and its SID chip offers a third source in voice 3's noise. The ZX Spectrum's manual, by contrast, printed its generator's formula as an exercise.

Raster Effects

Changing the picture while it is being drawn

About this article

A raster effect changes a video register partway down the screen, so the part of the picture below the change looks different. Colour bars, split screens, opened borders and extra sprites all come from it. The Commodore 64 does it with a raster interrupt, the Amiga with its copper, and the Spectrum, which has neither, by counting clock cycles from its one interrupt a frame.

Raster Interrupts

Precision timing with the video beam

About this article

A raster interrupt stops the main program when the television picture reaches a chosen line, so a handler can change colours, scroll registers or sprites partway down the screen. On the Commodore 64 the VIC-II chip provides it directly; the Amiga gets the same effect from its copper, and the NES from interrupts built into some cartridges.

Ring Buffer

Reusing a fixed stretch of memory

About this article

A ring buffer wraps back to its first slot instead of growing. Period documentation and Follin's music source show its use for queued input and an echo history.

Rotoscoping

Animation from life

About this article

Tracing frames of filmed movement to make animation: a 1915 cartoon technique that Jordan Mechner brought to Karateka and Prince of Persia with a Super 8 camera and a VHS player, that Éric Chahi redrew in polygons for Another World, and that Delphine sold at 24 frames a second in Flashback.

Run-Length Encoding

Simple compression

About this article

Run-length encoding stores a run of identical values as a count and the value. Its decoder is tiny and fast, which is why it turns up everywhere from CompuServe's weather maps to C64 packers, Amiga IFF pictures, Spectrum snapshots and NES tile data, and why most real formats spend their cleverness on handling data that does not repeat.

Screen Memory

How the Commodore 64 and the ZX Spectrum keep their pictures in memory

About this article

On the C64 and the ZX Spectrum the picture is ordinary memory that the video chip reads every frame. The C64's text screen is 1000 character codes that can move to any 1K boundary, beside 1000 nybbles of colour memory that never move. The Spectrum's is a fixed 6,144-byte bitmap in an interleaved order, followed by 768 attribute bytes, all in memory the ULA shares with the processor.

Scrolling

Moving through game worlds

About this article

Scrolling slides the picture so that a game world can be bigger than the screen. Every machine splits the job into a fine pixel offset and a coarse jump, and the cost of the coarse jump decided who could scroll smoothly: nearly free on the Amiga and the consoles, more than half a frame on the C64, and several frames on the Spectrum, which had to do all of it in software.

Self-Modifying Code

Code that rewrites itself

About this article

A program that changes its own instructions as it runs, usually the address or value inside one. On 8-bit machines with no cache it was an everyday way to save cycles and registers, and Commodore's BASIC relied on it; programs in ROM could not do it, and the instruction caches of later processors broke it.

Size Coding

Programs built to fit a fixed number of bytes

About this article

Size coding is writing a program to fit a fixed byte limit, usually for a demo party competition: 64K and 4K intros had their own competitions by 1994, and 256-byte and smaller categories followed. It rewards generating content with code, synthesising music, and packers such as pucrunch, kkrunchy and Crinkler.

Software Scrolling

When hardware won't help

About this article

The ZX Spectrum has no scroll hardware, so scrolling means the Z80 moving screen bytes itself: whole characters with LDIR, single pixels with rotates, or the stack-pointer "push-scroll" that Sinclair User said Ghosts 'n Goblins was among the first to use. Every method costs a large share of a 69,888-T-state frame, and the choice shaped how Spectrum games moved.

Sound Drivers

The code that makes the music data run

About this article

A sound driver is the small program inside a game that reads a composer's music data and feeds the sound chip, usually fifty or sixty times a second. On 8-bit machines it had to fit in a few kilobytes, and composers such as Rob Hubbard, Martin Galway, David Whittaker and Chris Hülsbeck wrote their own; later, studios and console makers supplied drivers such as Software Creations' house driver, Sega's GEMS and Nintendo's standard SNES driver.

Speedcode

Loop unrolling, taken to its conclusion

About this article

Replacing a loop with long runs of straight-line instructions, so the processor never pays for counting and branching. On the C64 demo scene it bought the extra cycles that raster effects needed, at the cost of memory, and the code was usually generated rather than typed.

Sprite Animation

Bringing pixels to life

About this article

Showing a sequence of drawings one after another, at a slower rate than the screen refreshes. With hardware sprites a new frame is often a single write, a pointer on the Commodore 64, a tile number on the NES, an address in the Copper list on the Amiga; on the Spectrum the program redraws the frame itself.

Sprite crunching

Scrambling the VIC-II's sprite counter on one exact cycle

About this article

Clear a Commodore 64 sprite's Y-expand bit on cycle 15 of a raster line and the VIC-II's sprite counter jumps to a strange new value, sometimes forwards and sometimes back. Pernod of Fairlight used it in Rutig Banan in 1989; Crossbow of Crest mapped every jump, named the trick and used it to cut sprites from 21 lines to 17 in Krestage (1997); later coders found loops as short as four lines.

Sprite Flicker

Sharing too few sprites between too many objects, one frame at a time

About this article

Video chips could draw only a fixed number of sprites on each line of the picture: four on the TMS9918, eight on the NES and Master System, eight in all on the C64 and two on the Atari 2600. When a game needed more, it changed which objects got drawn from one frame to the next, so that everything appeared some of the time. The result was flicker, and reviewers complained about it for years.

Sprite Multiplexing

More sprites than hardware allows

About this article

A sprite multiplexer shows more moving objects than a machine has hardware sprites, by moving each sprite further down the screen once the beam has finished drawing it. On the Commodore 64 it meant sorting objects by height and a chain of raster interrupts every frame; the Amiga's sprite hardware could reuse sprites by itself; the NES rotated its sprite list and accepted flicker.

Sprite Scaling

Pseudo-3D depth

About this article

Sprite scaling created the illusion of 3D depth by drawing sprites at different sizes based on distance, enabling racing games, shooters, and flight simulators on 2D hardware.

Sprite stretching

Making the VIC-II draw the same sprite row again and again

About this article

A Commodore 64 trick that clears and sets a sprite's Y-expansion bit in $D017 on every raster line, so the VIC-II draws the same row of sprite data again and the sprite can be stretched to any height, row by row. The writes can land anywhere in a wide part of the line, unlike its relative sprite crunching, and the scene's own list of firsts records it in a Triad demo in February 1989.

Sprites

Hardware-accelerated game objects

About this article

A sprite is a small picture that the video chip draws over the background at a position the program sets, so moving it costs a few register writes instead of a redraw. Every chip that had them set its own limits on how many, how big, how colourful and how many on one line, and those limits shaped the games written for it. Machines without them, such as the ZX Spectrum, drew their moving objects in software.

Stable Raster

Taking the wobble out of raster interrupts

About this article

A raster interrupt on the Commodore 64 starts its work a few cycles late, by a different amount each time, because the processor must finish the instruction it is running. Stable raster routines, most often built from two interrupts in a row, remove that last jitter so a program can change the screen on an exact cycle.

State Machines

One variable that says what the game is doing

About this article

A state machine organises a program around a single value that records what it is doing now (title screen, playing, paused, game over) and a set of rules for moving from one state to the next. Pac-Man's ghosts switch between chasing, scattering and running away this way, and the same idea scales from a byte and a jump table on an 8-bit machine to the AI of F.E.A.R.

Tech-tech

Making a logo wave a line at a time

About this article

The C64 demo effect where a logo or picture ripples sideways, every raster line shifted by its own amount. The hardware scroll register moves the screen only eight pixels, so coders combined it with a different character set, or a different screen, on every line.

Texture Mapping

Images on polygons

About this article

Texture mapping paints a flat picture onto a polygon by looking up a colour in the picture for every pixel drawn. Doing it fast meant stepping evenly across the texture, which is only right when depth does not change along the line: Doom arranged its walls and floors so that it never did, Quake corrected every 8 or 16 pixels, the PlayStation did not correct at all, and the Nintendo 64 and the PC accelerators did it in hardware.

The Game Loop

One frame at a time, fifty or sixty times a second

About this article

A game reads the controls, moves everything, draws the result and waits for the next frame, over and over. On 8- and 16-bit machines the television set the pace: the Spectrum's HALT, the C64's raster interrupt, the NES's NMI and the Amiga's vertical blank interrupt all hand the program a fixed budget of cycles per frame, and a game that overruns it slows down.

Tile Maps

Building worlds from blocks

About this article

A tile map describes a level as a grid of numbers, each naming a small reusable picture. The NES stored one screen as 960 tile numbers and 64 bytes of colour; Commodore 64 programmers built maps from 4×4 blocks of characters; and games from Super Mario Bros. onwards squeezed levels further by storing larger blocks, or whole objects, instead of single tiles.

Tile-Based Collision

Asking the map what is there

About this article

Instead of testing a character against every wall and platform, a tile-based game turns a position into a map cell and looks up what the tile there is: solid, a ledge, a ladder, a hazard. 1980s home programmers did it in BASIC by asking the screen; C64 coders read the character under a sprite; Cadaver's Metal Warrior 3 made the map cell the high byte of every coordinate.

Tile-Based Graphics

Building worlds from small pieces

About this article

Tile hardware draws the screen from a set of small pictures, usually 8×8 pixels, and a grid saying which goes where. It let the NES show a 256×240 screen from 2K of video RAM, gave the Game Boy 384 tile patterns in 6K, and turned the Commodore 64's character set into a game's scenery, and sometimes its moving objects too.

Trainers

+5 and counting

About this article

A trainer is a set of cheats patched into a game, such as infinite lives, energy or time, usually offered from a menu before it starts. Crackers added them to pirated releases and counted the options with plus signs; an Italian magazine was mentioning crackers' trainers by 1989, the year Silkworm used the word for its own cheat, and Datel's Amiga Action Replay sold a trainer mode from 1990.

Twister

Making a column appear to twist, one horizontal slice at a time

About this article

A twister makes a column appear to rotate by giving its horizontal slices different angles. The visual effect can be calculated during rendering or assembled from prepared graphics, as in Bitbreaker's C64 example.

Unit Pathfinding

Finding a route, then following it

About this article

A unit needs both a route to its destination and rules for following it when other units get in the way. Period reviews, a development diary and released code show the distinction.

User Defined Graphics (UDGs)

Custom 8×8 character glyphs on the Sinclair ZX Spectrum

About this article

Twenty-one programmer-supplied 8×8 patterns, codes 144 to 164, that the Spectrum's print routine treats as ordinary letters: the manual's route from BASIC into pixel graphics, and the name a generation of type-ins used for redefined characters on other machines too.

Variables and Memory

How BASIC stores its variables

About this article

Where a home computer's BASIC keeps a program's variables, how many bytes each kind costs, and why string handling made Commodore 64 programs pause while Spectrum programs did not: Microsoft's BASIC parks strings in a heap and collects the garbage, while Sinclair's moves memory on every assignment.

VSP

Variable screen positioning, or DMA delay

About this article

A Commodore 64 trick that starts a badline late, so the VIC-II's character fetches fall out of step and the whole screen, colours included, moves sideways by one character for every cycle of delay. It was used for full-colour scrolling in games such as Mayhem in Monsterland, and on some machines it corrupts memory, a fault Linus Åkesson traced to the DRAM in 2013.

VSync

Synchronising with the display

About this article

A game that waits for the vertical blank, the gap between one television frame and the next, can change the picture while none of it is being drawn and moves at a steady fifty or sixty steps a second. The Atari 2600 made its programs generate the gap themselves; later machines announced it with an interrupt, and every one of them gave the program only a few thousand cycles in it.

Y-Depth Sorting

Drawing whatever stands lowest on the screen last

About this article

In a beat 'em up or a top-down game, an object lower on the screen is nearer the viewer, so a program can decide what hides what by sorting its objects on their screen Y position and drawing the nearest last. Software sprites only need the drawing order; hardware sprites have fixed priorities, by sprite number on the C64 and NES and by a linked list on the Mega Drive, so the sort decides which object goes in which slot. The Amiga's own animation system sorted its Bobs this way by default.