Psi Spell Logic: Evaluation Order, Types, Numbers, Limits, and Flow Control
Most Psi spells seem to fire all at once, but the game actually works through them in a defined sequence, and understanding that sequence is what makes flow control possible.
Evaluation Order
Three rules govern the order in which spell pieces are processed.
- When a spell runs, its Tricks are handled from left to right within a row, and rows are handled from top to bottom.
- Before a piece can produce its result, every piece feeding into it must produce theirs first.
- During a single spell execution, a piece produces its result no more than one time — specifically the first moment something needs it.
The first rule is straightforward: a Trick sitting higher on the grid runs before one sitting lower, and among Tricks sharing a row, the one furthest left goes first. A spell built this way would print "1.0", "2.0", "3.0", and "4.0" to chat in exactly that sequence.
The second rule means a piece only does its work when something actually needs its value. The reverse matters just as much: a piece that no Trick needs, whether directly or through a chain, never runs at all. A piece left unconnected to any Trick produces undefined behavior, with no guarantees about what the spell does.
The third rule is subtler. A piece produces its result once and hands back that same result every time it is asked again. So four copies of Trick: Debug wired to a single Operator: Random would all print the identical number, because the random operator only runs a single time. Trick: Evaluate exists to force a piece to produce its result ahead of schedule.
Types and Numbers
Parameters have types, and a parameter only accepts arguments matching its type. The "Number" parameter on Trick: Debug is typed as Number, so it accepts only pieces that return Numbers, and it prints as a label so multiple Debug Tricks can be told apart. The "Target" parameter accepts the special type Any, meaning anything goes.
Hold Shift and hover over a piece to see the types of its parameters and the type of its output. Selector: Caster returns an Entity, which is not a Number, so it cannot feed the Number parameter. Constant: Number returns a Number — more precisely a Number Constant, which is a more specific kind of Number — and works there.
To update a stored spell after editing it, select the spell on your CAD and crouch-swipe the CAD across your Programmer; the bullet's stored spell updates to match.
Limits
Five icons with two numbers each appear beside the grid once a spell compiles, defining what you can practically cast.
- Complexity counts Operators, Selectors, and non-debug Tricks. Your CAD Core sets its ceiling; exceeding it makes the spell uncastable.
- Potency is capped by your Assembly and approximates the total power draw of the spell's Tricks. Some Tricks cost a fixed amount per use, while most Tricks with a Number Constant parameter scale their Potency with that constant.
- Cost has no CAD-imposed limit. Each cast drains that much Psi energy from your body. The first number is the ideal Cost; every Assembly has flaws that raise it, so the parenthesized number is what you actually pay. Better Assembly Efficiency brings actual Cost closer to ideal.
Psi energy regenerates at roughly 500 units per second, which caps how quickly you can cast. Selector: Caster Energy reads your current Psi energy from inside a spell.
Flow Control
Trick: Sleep delays the spell's execution by the number of ticks it receives, where one tick is 0.05 seconds — so 10 delays by half a second. It adds no Projection but does cost Potency.
Trick: Evaluate does nothing at all and adds nothing to your stats. Its purpose is forcing a value to be produced before a Trick: Sleep runs, letting you capture something like an entity's position beforehand for later use.
Trick: Die takes a Number and fizzles the spell immediately if that number's absolute value is strictly below 1. Any other value lets the spell continue. It costs no Projection. Pairing it with Selector: Sneak Status, which returns 0 while sneaking and 1 otherwise, is a natural fit.
Constant: Wrapper lets pieces returning Numbers stand in for Tricks that require Number Constants. Number Constants fed to Tricks determine a spell's stats, including Cost, before the spell is ever cast.
Memory
A CAD stores vectors across executions, holding one vector per three Socket slots; that count is its Memory Slots. Trick: Save Vector writes a vector to a slot and Selector: Saved Vector reads one back. Slots are numbered from 1, so three slots allow saving to 1, 2, and 3. Both pieces add Potency equal to the slot number used — slot 2 costs two Potency either way. Trick: Save Vector locks its slot, blocking both pieces from touching that slot later in the same spell, so if you need to load a slot before overwriting it, order the load ahead of the save using the flow control rules.
Covers the mod’s in-game guide topics: psi.book.entry.evalOrder Tutorial (3): Types & Numbers Tutorial (5): Limits psi.book.entry.flowControl psi.book.entry.memoryManagement psi.book.entry.secondaryOperators