Adjacency list
0 notesA 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 searchShort entries on the ideas behind my work: what it is, where I learnt it, and which notes use it. 33 entries so far.
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 searchHow 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 relationFind 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 searchUnreal's visual scripting. Good for designer-facing glue; heavy or hot-path systems belong in C++.
Learnt: Alchemist TD · See also: UPROPERTYExplore 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 listUnreal'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 HitBringing 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]).
Texture = nullptr.Load()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.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 lifetimePut 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, UPROPERTYShrink 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 conquerUnreal'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 poolingExplore a graph by going as deep as possible before backtracking, using a stack or recursion.
Learnt: Algorithms and Analysis · See also: Breadth-first search, StackSplit the problem into independent parts, solve each, then combine. Merge sort is the classic.
Learnt: Algorithms and Analysis · See also: Recurrence relation, Decrease and conquerSolve overlapping subproblems once and store the answers so you never solve the same one twice.
Learnt: Algorithms and Analysis · See also: Memoisation, Greedy algorithmsMake 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 programmingMaps 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 poolingThe 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:
false. Written well, it leaves the object in the same safe empty state, so the caller decides what to do next.Release() first: the old resource is overwritten and leaks, unless Load() releases it first.Release(): it works, because the object is still alive. Release() only returned what the object pointed to.Game::Initialize(), after the renderer exists.Draw() skipping a null texture.Load() isn't building it: it's connecting the power afterwards.trueThe electrician fits the meter and the lights come on. The resource is acquired.false and a logThe inspector writes a report and leaves the power off. The house still stands, and the owners decide who to call next.Release(), then Load()Taking the meter out doesn't knock the house down. A new one can go in any time.Load() never calledThe owners live by candlelight, so nothing in the house may assume the lights work.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 searchCache the result of a function call so the same input returns instantly next time.
Learnt: Algorithms and Analysis · See also: Dynamic programmingCreate 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 tableA 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 channelsFirst in, first out. The order things arrive is the order they leave.
Learnt: Algorithms and Analysis · See also: Breadth-first search, StackA 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 notationPointer 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 pointerLast in, first out. The most recent thing added is the first thing out.
Learnt: Algorithms and Analysis · See also: Queue, Depth-first searchCut words down to a shared root so 'pooling', 'pooled' and 'pools' all match 'pool'.
Learnt: Managing Semi-structured and Unstructured Data · See also: Inverted indexA 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 designScores 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 indexA 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 pointerChange the problem into an easier form first, such as sorting before searching, then solve that.
Learnt: Algorithms and Analysis · See also: Binary searchThe 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, BlueprintsA 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