GAME DEVELOPMENT · GO · 8 LESSONS
Game loop, input and physics
Fixed timesteps, Ebitengine structure, vectors, input actions, state machines, components, collisions and spatial hashing.
Fix the timestep: an accumulator turns uneven frames into identical simulation steps
Advance a simulation in fixed steps from variable frame times, draw it with an interpolation factor and cap catch-up work after a stall.
6 min · Worked lesson
Ebitengine's Game interface: Update advances ticks, Draw only reads, Layout fixes the screen
Structure an Ebitengine game so every state change happens in Update, Draw is a read-only view, and the rules run headless in tests.
6 min · Worked lesson
A 2D vector value type: normalized input, acceleration and drag in per-tick units
Write a small value-semantics vector type and move a body with normalized input, per-tick acceleration and drag that behave the same on every display.
5 min · Worked lesson
Input as actions: edge detection, jump buffering and coyote time in a tick-exact simulation
Map physical keys to actions, detect presses on the action level, and implement jump buffering and coyote time as tick counters that can be tested deterministically.
6 min · Worked lesson
Scenes and enemy behavior as explicit state machines instead of boolean flags
Run title, playing, paused and game-over scenes through a scene interface and a transition stack, and drive an enemy with a single-mode behavior machine.
5 min · Worked lesson
Entities as IDs, components in dense generic stores, systems as plain loops
Build a minimal entity-component store with generics, run systems over dense slices, remove with swap-delete, and judge when plain structs are the better design.
5 min · Worked lesson
AABB and circle collisions: detect overlap, push out along the shallow axis, sweep fast movers
Test boxes and circles for overlap, compute the minimum push that separates them, and stop fast objects from tunneling with sub-steps or a swept test.
5 min · Worked lesson
A spatial hash for the broad phase: bucket by cell, query neighbors, check each pair once
Build a uniform-grid spatial hash, insert objects by bounding box, query neighbors with deduplication, and count pair checks against the naive all-pairs loop.
5 min · Worked lesson