Data Structures and Algorithms for Game Devs
Pick the right structure and know why: lists, dictionaries, queues, stacks, grids, graphs and Big O, all through game problems.
156 lessons, about 34 h 3 min
Guest mode. Chapter 1 is fully playable. Sign up to open the rest and keep your progress.
Bits and bytes
12 lessons, about 2 h 29 min
How numbers really sit in memory: binary, hex, bit flags, packed values and the glitches that happen when a number runs out of room.
- Counting in binary Demo, +25 XP, 10 min
- Reading binary by hand Challenge, +20 XP, 10 min
- Hexadecimal Challenge, +20 XP, 10 min
- Predict the output: binary and hex Predict, +15 XP, 10 min
- Bit flags Challenge, +20 XP, 13 min
- Shifting bits Challenge, +20 XP, 13 min
- Negative numbers in binary Demo, +25 XP, 14 min
- Under the hood: the level 256 glitch Challenge, +20 XP, 13 min
- Spot the bug: the gold total Challenge, +20 XP, 10 min
- How much memory a map needs Challenge, +20 XP, 11 min
- Quiz: bits and bytes Quiz, +15 XP, 8 min
- Chapter project: Save code Boss, +100 XP, 27 min
Why structure matters
12 lessons, about 2 h 29 min. Pro chapter
The same game, fast and slow: count the work your code does and pick the structure that does less of it.
- Same result, different work Demo, +25 XP, 9 min
- Counting the work Challenge, +20 XP, 9 min
- Predict the output: best case and worst case Predict, +15 XP, 16 min
- How the work grows Challenge, +20 XP, 11 min
- Lookups by key Challenge, +20 XP, 11 min
- Finding duplicates Challenge, +20 XP, 11 min
- Under the hood: how a list grows Challenge, +20 XP, 12 min
- Adding at the front or the back Challenge, +20 XP, 12 min
- Building long text Challenge, +20 XP, 11 min
- Spot the bug: slow on big inputs Challenge, +20 XP, 12 min
- Quiz: picking a structure Quiz, +15 XP, 8 min
- Chapter project: Fast crowd check Boss, +100 XP, 27 min
Big O
12 lessons, about 2 h 43 min. Pro chapter
Big O without the math class: name how the work grows, spot hidden loops and pick the faster plan before you write it.
- Giving growth a name Demo, +25 XP, 9 min
- Constant time Challenge, +20 XP, 13 min
- Linear time Challenge, +20 XP, 13 min
- Predict the output: step counts Predict, +15 XP, 13 min
- Keeping the biggest part Challenge, +20 XP, 14 min
- Quadratic time Challenge, +20 XP, 13 min
- Halving: binary search Challenge, +20 XP, 15 min
- Under the hood: how fast sorting is Challenge, +20 XP, 12 min
- Spot the bug: the hidden loop Challenge, +20 XP, 12 min
- Memory has a cost too Challenge, +20 XP, 13 min
- Quiz: Big O Quiz, +15 XP, 8 min
- Chapter project: Speed report Boss, +100 XP, 28 min
Arrays and lists
12 lessons, about 2 h 50 min. Pro chapter
Inventories and enemy waves: how arrays sit in memory, fast removes, ring buffers, grids, object pools and your own list.
- Items in a row Demo, +25 XP, 11 min
- Swap and remove Challenge, +20 XP, 11 min
- Removing many in one pass Challenge, +20 XP, 12 min
- Predict the output: arrays and lists Predict, +15 XP, 15 min
- A ring buffer Challenge, +20 XP, 14 min
- Grids: 2D arrays Challenge, +20 XP, 14 min
- Under the hood: object pools Challenge, +20 XP, 16 min
- Arrays of structs Challenge, +20 XP, 15 min
- Spot the bug: the swap that skips Challenge, +20 XP, 11 min
- Build your own list Challenge, +20 XP, 12 min
- Quiz: arrays and lists Quiz, +15 XP, 8 min
- Chapter project: Wave manager Boss, +100 XP, 31 min
Dictionaries and hash sets
12 lessons, about 2 h 42 min. Pro chapter
Instant lookups: how a hash table works inside, TryGetValue, counting and grouping, set operations and keys of your own type.
- How a hash table works Demo, +25 XP, 13 min
- Build a tiny hash table Challenge, +20 XP, 12 min
- TryGetValue Challenge, +20 XP, 13 min
- Predict the output: dictionaries and sets Predict, +15 XP, 11 min
- Counting with a dictionary Challenge, +20 XP, 10 min
- Grouping Challenge, +20 XP, 12 min
- Set operations Challenge, +20 XP, 14 min
- Under the hood: keys of your own type Challenge, +20 XP, 16 min
- Spot the bug: the key that changed Challenge, +20 XP, 12 min
- Order is not promised Challenge, +20 XP, 13 min
- Quiz: dictionaries and sets Quiz, +15 XP, 8 min
- Chapter project: Loot tracker Boss, +100 XP, 28 min
Queues and stacks
12 lessons, about 2 h 27 min. Pro chapter
Turn order, spawn lines, undo, menus and replays: two structures that only take from one end, and why that keeps them fast.
- A line and a pile Demo, +25 XP, 8 min
- Turn order with a queue Challenge, +20 XP, 10 min
- Undo with a stack Challenge, +20 XP, 11 min
- Predict the output: queues and stacks Predict, +15 XP, 12 min
- A spawn queue Challenge, +20 XP, 10 min
- Menus and the Back button Challenge, +20 XP, 12 min
- Replaying inputs Challenge, +20 XP, 13 min
- Under the hood: inside a queue Challenge, +20 XP, 13 min
- A fixed-size undo history Challenge, +20 XP, 10 min
- Spot the bug: the redo that came back Challenge, +20 XP, 12 min
- Quiz: queues and stacks Quiz, +15 XP, 8 min
- Chapter project: Turn manager Boss, +100 XP, 28 min
Grids and spatial hashing
12 lessons, about 2 h 27 min. Pro chapter
Collision checks that scale: drop things into cells by position and only compare what is close.
- Only check what is nearby Demo, +25 XP, 9 min
- From position to cell Challenge, +20 XP, 9 min
- A grid of buckets Challenge, +20 XP, 10 min
- A spatial hash Challenge, +20 XP, 10 min
- Predict the output: cells and buckets Predict, +15 XP, 13 min
- Checking the neighbor cells Challenge, +20 XP, 11 min
- Picking a cell size Challenge, +20 XP, 11 min
- Moving objects between cells Challenge, +20 XP, 11 min
- Spot the bug: the blast that missed Challenge, +20 XP, 11 min
- Under the hood: a spatial hash without a Dictionary Challenge, +20 XP, 14 min
- Quiz: grids and spatial hashing Quiz, +15 XP, 10 min
- Chapter project: Collision grid Boss, +100 XP, 28 min
Searching and sorting
12 lessons, about 2 h 36 min. Pro chapter
Leaderboards and loot tables: write sorts by hand, keep ties in order, sort by several keys, find the top few fast and roll weighted drops with binary search.
- Sorting step by step Demo, +25 XP, 8 min
- Selection sort Challenge, +20 XP, 10 min
- Insertion sort Challenge, +20 XP, 10 min
- Predict the output: sorting Predict, +15 XP, 16 min
- Merge sort Challenge, +20 XP, 12 min
- Under the hood: stable and unstable sorts Challenge, +20 XP, 15 min
- Sorting by several keys Challenge, +20 XP, 13 min
- Spot the bug: the second sort Challenge, +20 XP, 10 min
- Finding the top few Challenge, +20 XP, 11 min
- Weighted loot tables Challenge, +20 XP, 14 min
- Quiz: searching and sorting Quiz, +15 XP, 8 min
- Chapter project: Loot and leaderboard Boss, +100 XP, 29 min
Recursion
12 lessons, about 2 h 38 min. Pro chapter
Methods that call themselves: nested menus and folders, flood fill, maze solving, how deep the stack can go and how to turn recursion into a loop.
- Smaller copies of the same problem Demo, +25 XP, 10 min
- Nested menus Challenge, +20 XP, 12 min
- Counting files in folders Challenge, +20 XP, 12 min
- Predict the output: recursion Predict, +15 XP, 17 min
- Flood fill Challenge, +20 XP, 11 min
- Counting rooms Challenge, +20 XP, 11 min
- Spot the bug: the reveal that leaks Challenge, +20 XP, 13 min
- Solving a maze with depth-first search Challenge, +20 XP, 12 min
- Under the hood: how deep the stack goes Challenge, +20 XP, 11 min
- Turning recursion into a loop Challenge, +20 XP, 13 min
- Quiz: recursion Quiz, +15 XP, 8 min
- Chapter project: Cave map Boss, +100 XP, 28 min
Graphs and pathfinding
12 lessons, about 2 h 40 min. Pro chapter
Rooms and doors as a graph: fewest steps with breadth-first search, the cheapest route with Dijkstra, and A* that heads straight for the goal.
- Rooms and doors Demo, +25 XP, 9 min
- Adjacency lists Challenge, +20 XP, 11 min
- Breadth-first search Challenge, +20 XP, 11 min
- Rebuilding the path Challenge, +20 XP, 10 min
- A grid is a graph Challenge, +20 XP, 11 min
- Predict the output: graph search Predict, +15 XP, 15 min
- Weighted edges: Dijkstra's algorithm Challenge, +20 XP, 12 min
- Under the hood: the priority queue Challenge, +20 XP, 13 min
- A* search Challenge, +20 XP, 15 min
- Spot the bug: the guess that is too high Challenge, +20 XP, 17 min
- Quiz: graphs and pathfinding Quiz, +15 XP, 8 min
- Chapter project: Route planner Boss, +100 XP, 28 min
Trees
12 lessons, about 2 h 46 min. Pro chapter
Parents and children: walk a tree two ways, move a scene graph, learn skills in order, keep scores in a search tree and give a goblin a behavior tree.
- Parents and children Demo, +25 XP, 9 min
- Measuring a tree Challenge, +20 XP, 12 min
- Depth first and breadth first Challenge, +20 XP, 12 min
- Predict the output: walk order Predict, +15 XP, 17 min
- A scene graph Challenge, +20 XP, 11 min
- A skill tree Challenge, +20 XP, 12 min
- A binary search tree Challenge, +20 XP, 11 min
- Under the hood: the lopsided tree Challenge, +20 XP, 14 min
- Spot the bug: the stale position Challenge, +20 XP, 13 min
- A behavior tree for a goblin Challenge, +20 XP, 14 min
- Quiz: trees Quiz, +15 XP, 8 min
- Chapter project: Goblin brain Boss, +100 XP, 33 min
Profiling
12 lessons, about 2 h 31 min. Pro chapter
Find the slow part instead of guessing: frame budgets, a profiler that counts, Total and Self, Amdahl's law, garbage every frame and caches.
- Finding the slow part Demo, +25 XP, 8 min
- The frame budget Challenge, +20 XP, 9 min
- A profiler that counts Challenge, +20 XP, 12 min
- Reading a profile report Challenge, +20 XP, 10 min
- Fix the biggest part first Challenge, +20 XP, 10 min
- Predict the output: profiles and budgets Predict, +15 XP, 12 min
- Under the hood: Stopwatch Challenge, +20 XP, 11 min
- Garbage every frame Challenge, +20 XP, 12 min
- Spot the bug: the query that runs again Challenge, +20 XP, 12 min
- Caching a result that does not change Challenge, +20 XP, 16 min
- Quiz: profiling Quiz, +15 XP, 8 min
- Chapter project: Frame report Boss, +100 XP, 31 min
Making a laggy game run smooth
12 lessons, about 2 h 45 min. Pro chapter
The course finale: the tower's big night runs slow, so measure it, find each slow system and fix it with the tools from the whole course.
- Measuring the big night Demo, +25 XP, 9 min
- Fast removal and a goblin pool Challenge, +20 XP, 11 min
- A queue for the spawn schedule Challenge, +20 XP, 11 min
- Arrow hits with a spatial hash Challenge, +20 XP, 10 min
- Predict the output: which fix helps most Predict, +15 XP, 16 min
- A top five without sorting everyone Challenge, +20 XP, 11 min
- Spreading the ward in one pass Challenge, +20 XP, 12 min
- One step map for every goblin Challenge, +20 XP, 12 min
- Spot the bug: the goblins nobody can hit Challenge, +20 XP, 13 min
- Horde totals without walking the tree Challenge, +20 XP, 12 min
- Quiz: making a game run smooth Quiz, +15 XP, 8 min
- Chapter project: The big night Boss, +100 XP, 40 min