GAME DEVELOPMENT · GO · 8 LESSONS
Worlds, AI and multiplayer
Tilemaps and cameras, A* pathfinding, seeded generation, tweens, save files, authoritative servers, prediction and frame budgets.
A camera is a coordinate transform: follow the target, clamp to the map, draw only visible tiles
Convert between tile, world and screen coordinates, keep a following camera inside the map and compute the exact range of tiles to draw.
6 min · Worked lesson
A* on a grid: a heap, a heuristic that matches the moves, and tie-breaking you can replay
Implement grid A* with container/heap, choose a heuristic that matches the movement rules, make equal-cost choices deterministic and decide when a flow field beats per-unit searches.
7 min · Worked lesson
Reproducible worlds: one seed, one random stream per system, and no global rand
Generate a seeded cave with a math/rand/v2 PCG source, keep each system on its own derived stream and explain why global or shared randomness breaks replays.
5 min · Worked lesson
Tweens and sprite frames advance with the simulation tick, not the wall clock
Drive easing curves, chained and retargeted tweens and sprite animation clips from tick counts so motion is deterministic, pausable and free of jumps.
5 min · Worked lesson
Save files are untrusted input: version them, migrate forward, validate and write atomically
Design a versioned JSON save format, migrate v1 saves to v2, reject unknown fields and out-of-range values, and replace a save file without ever leaving it half-written.
6 min · Worked lesson
An authoritative server owns the world in one goroutine and accepts only validated intent
Build a server tick loop in which one goroutine owns all game state, clients send inputs over channels, movement is validated against speed and rate limits, and snapshots are copies in a deterministic order.
6 min · Worked lesson
Client prediction replays unacknowledged inputs; remote players are interpolated from the past
Hide round-trip latency by predicting local movement, reconcile with acknowledged server snapshots by replaying pending inputs, and draw remote players by interpolating a snapshot buffer.
5 min · Worked lesson
A 16.6 ms frame budget: measure allocations per update and make the steady state allocate nothing
Turn refresh rates into frame budgets, count allocations per update with testing.AllocsPerRun, remove per-frame slices, maps, closures and strings, and profile a game loop with pprof and execution traces.
7 min · Worked lesson