GAMEDEV CODEX · A TO Z

Everything I've learnt, indexed

Short entries on the ideas behind my work: what it is, where I learnt it, and which notes use it. 33 entries so far.

View

A

Adjacency list

0 notes

A graph stored as a list of neighbours for each vertex. Cheap on memory when most vertices connect to only a few others.

Learnt: Algorithms and Analysis · See also: Breadth-first search

B

Big-O notation

0 notes

How an algorithm's cost grows as the input grows. It describes the shape of the growth, not the exact time.

Learnt: Algorithms and Analysis · See also: Linear search, Recurrence relation

Binary search

0 notes

Find an item in a sorted list by halving the range every step. Logarithmic, but only if the data is sorted first.

Learnt: Algorithms and Analysis · See also: Decrease and conquer, Linear search

Blueprints

0 notes

Unreal's visual scripting. Good for designer-facing glue; heavy or hot-path systems belong in C++.

Learnt: Alchemist TD · See also: UPROPERTY

Breadth-first search

0 notes

Explore a graph in rings outward from the start using a queue. Finds the fewest-steps path in an unweighted graph.

Learnt: Algorithms and Analysis · See also: Queue, Depth-first search, Adjacency list

C

Collision channels

1 note

Unreal's way of saying what can detect what. A query on one channel ignores everything else.

Learnt: Alchemist TD · Used in NOTE-02 · See also: Overlap vs Hit

Construction

0 notes

Bringing an object into existence. For a class type, the constructor creates the object's first, complete state through initialisation: the chosen constructor "is called to initialize the object" ([dcl.init.general]). Construction is the time during that initialisation process, and the object's lifetime only begins once initialisation finishes ([basic.life]).

In building terms: building a home
  1. The plans are approvedthe compilerBefore anything is built, the council checks the plans. Rejected plans are a compilation error, and nothing is built at all.
  2. The land is set asidestorageThe block is reserved before any contractor arrives. Storage is obtained before the constructor runs.
  3. The buildinitialisationThe building work itself is initialisation: the process that gives the house its first, complete state. Our contractors are the constructor, the crew who carry that work out. Construction is the time the contractors are on site.
  4. Structure firstmembers, in declared orderFootings, slab, then frame, in the order the plans fix, each built to the spec written on the plans. Each member is initialised in declared order, using its default value, like Texture = nullptr.
  5. The fit-outthe constructor bodyInterior work once the frame is standing. Every member already exists by now.
  6. Handoverlifetime beginsThe moment the contractors finish, the keys are handed over and the owners move in. There's no inspection step in between (unlike a real domestic build).
  7. The crew walks offan exceptionIf something goes wrong mid-build, the only way to stop the handover is for the crew to walk off. Then nobody ever moves in.
  8. Utilities connected and inspectedLoad()Inspections that pass or fail come later, once the owners live there. If the connection fails, Load() logs an error and returns false, while the house itself still stands.
Learnt: .PADEL · See also: Initialisation, Smart pointers, Dangling pointer

D

Dangling pointer

1 note

A pointer that still holds the address of an object that has already been destroyed. Using it touches freed memory and crashes.

Learnt: Alchemist TD · Used in NOTE-03 · See also: Smart pointers, Object pooling, Timers and lifetime

Data-driven design

2 notes

Put the numbers and content in data designers can edit, so changing the game does not mean changing the code.

Learnt: Thanks Carl! · Used in NOTE-01 · NOTE-03 · See also: Struct, UPROPERTY

Decrease and conquer

0 notes

Shrink the problem by a constant amount or factor each step, solve the smaller one, extend the answer.

Learnt: Algorithms and Analysis · See also: Binary search, Divide and conquer

Delegates

1 note

Unreal's event system. Objects bind a function to an event and must unbind it when they stop listening.

Learnt: Alchemist TD · Used in NOTE-03 · See also: Object pooling

Depth-first search

0 notes

Explore a graph by going as deep as possible before backtracking, using a stack or recursion.

Learnt: Algorithms and Analysis · See also: Breadth-first search, Stack

Divide and conquer

0 notes

Split the problem into independent parts, solve each, then combine. Merge sort is the classic.

Learnt: Algorithms and Analysis · See also: Recurrence relation, Decrease and conquer

Dynamic programming

0 notes

Solve overlapping subproblems once and store the answers so you never solve the same one twice.

Learnt: Algorithms and Analysis · See also: Memoisation, Greedy algorithms

G

Greedy algorithms

0 notes

Make the best-looking choice at each step and never look back. Fast, but only correct for some problems.

Learnt: Algorithms and Analysis · See also: Dynamic programming

H

Hash table

1 note

Maps a key to a value in roughly constant time. Unreal's TMap is one; the enemy pool is a TMap from type to array.

Learnt: Algorithms and Analysis · Used in NOTE-03 · See also: Object pooling

I

Initialisation

0 notes

The process that gives an object its initial value ([dcl.init.general]). For a class type, the chosen constructor carries it out: each member is initialised in the order it is declared, whatever order the initialiser list uses, and then the constructor body runs ([class.base.init]). The object's lifetime begins once that is complete ([basic.life]), so an Init() or Load() method called afterwards is not initialisation in the standard's sense: it runs on an object that is already alive.

When Init() or Load() runs on the living object:

  • Called once and it succeeds: the object goes from its safe empty state to holding its resource.
  • It fails: it logs the error and returns false. Written well, it leaves the object in the same safe empty state, so the caller decides what to do next.
  • Called again without Release() first: the old resource is overwritten and leaks, unless Load() releases it first.
  • Called after Release(): it works, because the object is still alive. Release() only returned what the object pointed to.
  • Its dependency isn't ready yet, such as no renderer: it must check and fail cleanly. That's why .PADEL loads in Game::Initialize(), after the renderer exists.
  • Never called: every other method must cope with the empty state, such as Draw() skipping a null texture.
  • Called after the destructor has run: undefined behaviour: calling a member function on an object outside its lifetime ([basic.life]).
In building terms: connecting the utilities
  1. The owners have moved inthe object is aliveThe house is built and lived in. Load() isn't building it: it's connecting the power afterwards.
  2. Power connectedsuccess, trueThe electrician fits the meter and the lights come on. The resource is acquired.
  3. The inspection failsfalse and a logThe inspector writes a report and leaves the power off. The house still stands, and the owners decide who to call next.
  4. A second meter, the first never removeda leakFitting a new meter without taking out the old one leaves you paying for a meter nobody reads. Disconnect first, then connect.
  5. Disconnect, then reconnectRelease(), then Load()Taking the meter out doesn't knock the house down. A new one can go in any time.
  6. The grid isn't built yeta missing dependencyNo electrician can connect to a substation that doesn't exist. Check first, and only book the job once the grid is live.
  7. Power never connectedLoad() never calledThe owners live by candlelight, so nothing in the house may assume the lights work.
  8. The house has been demolishedundefined behaviourSending an electrician to an empty lot. There's nothing defined to connect to.
Learnt: .PADEL · See also: Construction

Inverted index

0 notes

A map from each term to the documents that contain it. It is what powers the search bar on this page.

Learnt: Managing Semi-structured and Unstructured Data · See also: TF-IDF, Stemming

L

Linear search

2 notes

Check items one at a time until you find what you need. Fine for small sets; cost grows with the list.

Learnt: Algorithms and Analysis · Used in NOTE-02 · NOTE-03 · See also: Big-O notation, Binary search

M

Memoisation

0 notes

Cache the result of a function call so the same input returns instantly next time.

Learnt: Algorithms and Analysis · See also: Dynamic programming

O

Object pooling

1 note

Create objects once up front, then hand them out and take them back instead of creating and destroying them during play.

Learnt: Alchemist TD · Used in NOTE-03 · See also: Dangling pointer, Hash table

Overlap vs Hit

1 note

A Hit means two things block each other. An Overlap means they pass through and the engine just reports the contact.

Learnt: Alchemist TD · Used in NOTE-02 · See also: Collision channels

Q

Queue

0 notes

First in, first out. The order things arrive is the order they leave.

Learnt: Algorithms and Analysis · See also: Breadth-first search, Stack

R

Recurrence relation

0 notes

A cost written in terms of the cost of smaller inputs, like T(n) = 2T(n/2) + n. Solve it to get a closed form.

Learnt: Algorithms and Analysis · See also: Divide and conquer, Big-O notation

S

Smart pointers

1 note

Pointer types that know about object lifetime. A TWeakObjectPtr becomes invalid on its own when its object is destroyed.

Learnt: Alchemist TD · Used in NOTE-03 · See also: Dangling pointer

Stack

0 notes

Last in, first out. The most recent thing added is the first thing out.

Learnt: Algorithms and Analysis · See also: Queue, Depth-first search

Stemming

0 notes

Cut words down to a shared root so 'pooling', 'pooled' and 'pools' all match 'pool'.

Learnt: Managing Semi-structured and Unstructured Data · See also: Inverted index

Struct

1 note

A named bundle of related data. Define the shape once, then fill in many of them.

Learnt: Thanks Carl! · Used in NOTE-01 · See also: Data-driven design

T

TF-IDF

0 notes

Scores a term higher when it is frequent in this document but rare across all documents.

Learnt: Managing Semi-structured and Unstructured Data · See also: Inverted index

Timers and lifetime

1 note

A timer outlives the call that set it. If it fires after its target is destroyed, it acts on freed memory.

Learnt: Alchemist TD · Used in NOTE-03 · See also: Dangling pointer

Transform and conquer

0 notes

Change the problem into an easier form first, such as sorting before searching, then solve that.

Learnt: Algorithms and Analysis · See also: Binary search

U

UPROPERTY

1 note

The Unreal macro that exposes a C++ variable to the editor, Blueprints and the garbage collector.

Learnt: Alchemist TD · Used in NOTE-03 · See also: Data-driven design, Blueprints

V

Vectors

1 note

A direction and a length. Subtract two positions to get the vector between them; its length is the distance.

Learnt: Alchemist TD · Used in NOTE-02 · See also: Collision channels