Appendix: Glossary¶
The words this book uses for the ideas of game programming, each with a short explanation and where to read more: first the chapter where the idea came up in a game, then the section of the engine manual that describes the engine's part for it. The engine's classes are listed by purpose in chapter 40.
A¶
A* (A star). A search for the cheapest way from one tile to another when tiles cost differently to enter. It looks first at the tiles that seem closest to the goal, so it finds the way while looking at few tiles. Maze, manual.
Action. What a player wants to do, such as "move up" or "fire", as the rules see it. Keys and gamepad buttons are bound to actions, so the rules never ask for a key. Paddle, manual.
Active rendering. The game draws a frame when its loop wants one, into a hidden buffer that is then shown at once, instead of asking Swing to repaint() some time later. Paddle, manual.
Alpha (interpolation). How far the time of a frame lies between the last two steps of the rules, from 0 to 1. Things that move are drawn that share of the way from their previous to their current position, so movement looks smooth at any frame rate. Paddle, manual.
Animation. A picture that changes over time: the frames of a sprite sheet shown one after the other, or a thing moved from one place to another by a tween. Solitaire, Swarm, manual.
Antialiasing. Smooth edges for shapes and text, computed pixel by pixel. It looks better and costs time; turn it off for straight-edged fills. Swarm, appendix.
ARPAbet. A way of writing the sounds of speech in plain letters, one name per phoneme: k ae1 b is "cab". American speech research has used it since the 1970s; the engine's speech is written in it. Hover Cab, manual.
B¶
Back buffer. The hidden picture a frame is drawn into before it is shown on the screen, so the player never sees a half-drawn frame. Paddle, appendix.
Bang-bang control. Steering with switches that are only on or off: in each step a jet fires if that brings the speed nearer the wanted one. Switched often enough, the pushes average out to just what is needed. Hover Cab.
Bézier curve. A smooth curve defined by four points: it starts at the first, ends at the last, and the two in between pull it into shape. Flight paths are built from them. Swarm, manual.
Box selection. A drag with the mouse opens a rectangle, and every unit of the player's side inside it is chosen. Sands, manual.
Breadth-first search. A search that spreads from the goals like a wave, one step at a time, and so finds for every tile the number of steps to the nearest goal. Maze, manual.
C¶
Camera. The part of a world larger than the screen that is shown. The game draws the world shifted by the camera's position, and turns mouse positions on the screen back into positions in the world. Jump, Towers, manual.
Carrier. A settler who takes wares along one stretch of road, from flag to flag. Colony.
Cell. One square of a tile map, given by its column and row. Mines, manual.
Collision detection. Finding out which things touch or overlap: boxes, circles, or anything near something else on a grid. Paddle, manual.
Compatible image. An image in the screen's own pixel format, so copying it to the screen needs no conversion. Bricks, appendix.
Component. One part of an entity: a body, a flight along a path, hit points. What an entity is and does follows from the components it has right now. Swarm, manual.
Computer opponent. A player whose decisions the program makes. In this book it gets the same information and the same controls as a human player wherever possible. Paddle, Sands.
Coverage. How well a tile is served by places that reach a circle around them, such as schools, fire stations and parks: how many reach it, and how strongly. Town, manual.
D¶
Data file. A plain text file that holds what a designer changes without a compiler: levels, waves, stages, the properties of units and buildings. Swarm, Towers, manual.
Demand. What a game's places need and ask for: a building site that needs planks, a town that wants more homes or shops. Colony, Town.
Depth sorting. Drawing the things of a view from back to front, so what stands in front covers what stands behind; also called the painter's algorithm. Town, manual.
Determinism. The same seed and the same input give the same game, step by step, on every computer. Replays, tests of whole games and loaded saves depend on it. Snake, manual.
Distance map. For every tile, the number of steps to the nearest of one or more goals; the first step of a shortest way is then always downhill. Maze, manual.
Domain. The rules of a game as plain Java, without Swing, so they can be tested without a screen. Structure.
Drag. The slowing of a thing by the air it moves through: each second it loses a part of its speed. It makes a craft on jets steerable. Hover Cab, manual.
E¶
Easing. How a movement feels over its time: starting fast and landing gently, or slow at both ends. An easing maps the share of the time to the share of the way. Solitaire, manual.
Entity. A thing of the game world that is little more than a number and a bag of components. Swarm, manual.
Event queue. A list of things that happened and must be handled, first in, first out. Handling one event may add new ones, which is how chain reactions work. Blast, manual.
F¶
Fixed time step. The rules always advance by the same amount of time, usually 1/120 of a second, however fast the computer draws. That makes the rules the same on every computer and testable. Paddle, manual.
Flag. A point on the map where roads meet and wares wait to be carried on. A new flag on a road splits it in two. Colony, manual.
Flood fill. Opening or colouring all connected cells from one start, as Mines opens an empty area. Mines.
Flow field. For every tile of a map, the direction that leads to a goal. Any number of units follow the arrows, and the whole field costs one search. Towers, manual.
Fog of war. What one side knows of the map: tiles never seen are black, tiles seen once are dimmed, and only what the side's units see now shows enemies. Sands, manual.
Formant. A frequency at which the mouth and throat ring while speaking. Where the first two formants are decides which vowel is heard. Hover Cab, manual.
Formation. Where each unit of a group stands when it arrives: a slot of its own near the target, chosen so that the units do not cross each other's way. Sands, manual.
Frame. One picture on the screen. A game draws up to 60 frames a second; at that rate a frame has 16.7 ms. Paddle.
Frame time. How long a frame took to draw. The frame-time display, F12 in every game, shows the average and the worst frame of the last second. Bricks, manual.
G¶
Game loop. The heart of a real-time game: a thread that runs the rules in fixed steps and draws frames, again and again, until the game ends. Paddle, manual.
Garbage collection. Java frees objects nobody uses any more by itself, and may pause the program to do it. A game avoids making objects in every frame, so the collector has nothing to do while it runs. Bricks, appendix.
Gamepad. A game controller with buttons and sticks, read from a device file on Linux and through XInput on Windows. Blast, manual.
H¶
Hard edges. Scaling a picture without blending neighbouring pixels, so pixel art stays crisp instead of blurred. Swarm, manual.
Heavyweight component. An AWT component such as Canvas that is a native window of its own inside the Swing window. It is drawn over Swing's lightweight components, which needs care with popup menus and keys. Paddle.
I¶
Influence map. A map of where a side is strong: each unit and building spreads its strength around it, and the sums show strong and weak places at a glance. Sands, manual.
Intonation. The tune of a spoken phrase: the pitch sinks as the breath runs out, rises on stressed syllables, and rises at the end of a question. Hover Cab.
Isometric view. A tile map seen from a corner and from above: each square tile becomes a diamond twice as wide as high, and buildings show two walls and a roof. The rules stay square. Town, manual.
K¶
Key repeat. A held key is sent again and again; on X11 even as release, press, release, press. The engine believes a release only when no press of the same key follows within 25 ms, so a held key stays held. Paddle, manual.
L¶
Logical coordinates. The fixed size a game draws in, 640 × 400 in most games of this book, whatever the size of the window. The canvas scales the picture; the rules and the mouse never see real pixels. Paddle, manual.
M¶
Managed image. An image that Java2D keeps a copy of in video memory, so it is copied fast. Touching its pixel array directly ends that for good. Appendix.
Minimap. The whole map, small, in a corner of the screen, with a box for what the camera shows. A click on it moves the camera. Sands, manual.
Mixer. The part that adds several sounds into one stream for the sound card, so effects and music play at the same time. Paddle, manual.
Model-View-Presenter (MVP). The rules (model) and the window (view) never talk to each other directly; a presenter without Swing sits between them. Structure.
O¶
Object pool. A fixed number of objects made at the start and used again and again, such as shots, instead of new objects for each. Rocks, manual.
Overlay. What is drawn on top of the world: score, texts, menus. In pixel mode it stays sharp over a world of big pixels. Bricks, manual.
Overlay menu. A menu drawn inside the game's picture, beside the thing it is about, such as the towers that may be built on a tile. Towers, manual.
P¶
Parallax. Background layers that scroll slower the further away they are, which gives a flat game depth. Jump, manual.
Particle. A small, short-lived square that flies, falls and fades: a splinter, a spark, dust. Bricks, manual.
Passable. Whether a tile may be entered, asked by every search for a way. Maze, manual.
Phoneme. One sound of speech, such as the k, ae and b of "cab". A speech synthesizer makes words from phonemes. Hover Cab, manual.
Pixel mask. Which pixels of a thing are solid, one bit each. Two masks collide where both have a solid pixel, which is as exact as the pictures. Hover Cab, manual.
Pixel mode. A render mode that draws the world at its logical size and enlarges it by a whole factor, so each logical pixel becomes a square block. Fast on large screens, and the look of old games. Bricks, manual.
Polling. Asking an input device for its state at a fixed moment, once per step, instead of acting on each event when it arrives. All questions of one step get the same answers. Paddle, manual.
Production queue. Orders worked off one after the other, each paid while it is made. Sands, manual.
R¶
Recipe. What a workshop makes of what: its inputs, the good made and the time it takes. Colony, manual.
Render mode. How the world reaches the screen: DIRECT, scaled to any size and sharp, or PIXEL. Bricks, manual.
Replay. A whole game kept as a seed and the player's actions with the tick of each. Fed to the rules again, they play the same game. Snake, manual.
Resonator. A filter that rings at one frequency: a tone at that frequency builds up in it, others die away. Five of them in a row are the mouth of the speech synthesizer. Hover Cab.
S¶
Save file. A player's progress, or a whole running game, on disk, written so that a crash while writing never loses the old file. Jump, Sands, manual.
Scene. One screen of a real-time game: the title, the match, the pause screen, the end. Scenes lie on a stack; the top one runs. Paddle, manual.
Seed. The number a random generator starts from. The same seed gives the same numbers. Snake, manual.
Shroud. The black over the parts of the map a side has never seen. Sands, manual.
Snapshot. A whole game written down as keys and values, exact enough that a loaded game goes on as the saved one would have. Sands, manual.
Source-filter model. Speech as a sound source, the vocal folds' puffs and the hiss of narrow places, shaped by a filter, the mouth and throat. The source sets the pitch, the filter the vowel. Hover Cab.
Spatial grid. Things sorted into the squares of a coarse grid, so each one is tested only against its neighbours instead of against everything. Swarm, manual.
Speech synthesis. Making speech by computation instead of playing recordings. The engine's synthesizer models the voice with formants, as the talking machines of the early 1980s did. Hover Cab, manual.
Sprite. A picture with a size in logical coordinates, scaled once to the screen and then copied in every frame. Bricks, manual.
Sprite sheet. Many small pictures in one image, in a grid of equal cells, such as the frames of an animation. Swarm, manual.
State machine. Something that is always in exactly one of a few states and changes between them only along ways allowed in advance, such as a ghost that waits, hunts, flees or flies home. Maze, manual.
Supply network. Tiles that carry something from where it is made to where it is used, such as power from plants through lines to homes. Town, manual.
Swept collision. A collision test for a thing that moves: not "do they overlap now?" but "when during this step did they first touch?", so a fast ball never passes through a paddle. Paddle, Bricks, manual.
T¶
Territory. The land inside a border of circles that a side's buildings claim. Buildings may stand only inside. Colony, manual.
Thrust. The push of a jet: an acceleration, like gravity, for as long as the jet burns. Hover Cab, manual.
Tick. One step of rules that move at a pace of their own, slower than the game loop, such as the snake moving one cell. Snake, manual.
Tile map. Columns and rows of squares, each holding one value such as WALL or ROAD. The rules of maze, puzzle and strategy games live on it in whole cells. Maze, manual.
Tiled. A free map editor whose TMX files the engine reads. Jump, manual.
Touchdown. The moment a craft comes down on a landing place, graded by its speed as soft, hard or a crash. Hover Cab, manual.
Tween. One movement from one value to another in a given time, with an easing. Solitaire, manual.
U¶
Undo by snapshots. Before each move the game keeps a copy of its state; undo hands the last copy back. Solitaire, manual.
V¶
Vector. A point or a direction in the plane, with operations such as adding, scaling and turning. Rocks, manual.
Volatile image. An image in video memory that can lose its contents when the system needs the memory, and must be checked and drawn again. Appendix.
W¶
Wrap-around. A field without edges: what leaves on one side comes back on the other, and distances take the short way across an edge. Rocks, manual.
Z¶
Zone. Land the player marks for homes, shops or industry. The town builds on it by itself when there is demand. Town.