Game logic
Movement and AI
How units walk, choose a target and follow the orders a mission or the player gives them.
Movement
- A unit walks its speed / 32 px per tick (its speed × 1.875 px per second), always at full speed: it does not accelerate and turns at once.
- Routes are straight lines between points, at most 56; there is no path finding. A unit pressed against an obstacle slides along it, because the game pushes it out every frame.
- It reaches each point of its route when it is less than 4.472 px away.
- Sent as a group, each unit goes to the tapped point plus its own direction from the group’s centre times its radius + 4 px. They keep no formation while walking: they only push each other apart.
Choosing a target
- Every 10 ticks (the first time staggered by the unit’s place in its squad) a unit looks for enemies less than 200 px away.
- It picks one by one of three rules: the nearest; the one with most HP; or the one with least HP. The last two prefer targets already within its attack reach.
- A charmed unit picks its target among its own side and Isaac.
- Only units in these decision states look for a new target: 0, 1, 3, 4, 5, 8, 9, and 10. Following a route without attacking, an explicit order or fleeing, they keep the one they have.
Orders
A mission or the player gives each unit an order, and the order sets the state the unit decides from every frame. The sight radius is the unit’s own (on each unit’s page), and missions often change it.
| Order | What the unit does | State |
|---|---|---|
| WaitWait | With mode 0 it stays where it is and attacks a target that comes within its reach + 22 px; it never chases. With any other mode (state 1) it chases and attacks a target within its sight radius, and otherwise idles. | 0 / 1 |
| MoveWalk · Move | Follows its route without stopping to attack. | 2 |
| Move, attacking on the wayWalkAuto · MoveAuto | Follows its route and attacks targets already within its reach, without leaving the route. | 3 |
| Move, chasingWalkAttack · MoveAttack | Chases a target within its sight radius; with none, follows its route. | 4 |
| Move, then waitWalkWaitAuto · MoveWaitAuto | Follows its route and chases targets within its sight radius; stopped and with no target, it waits as with any mode other than 0. | 5 |
| Guard a pointGuardPosition | Watches over a point and may chase from there. Farther than its sight radius from the point, it walks back (state 10) and resumes when within half that radius. | 9 / 10 |
| FleeEscape | Runs straight away from its target while their centres are closer than its keep distance (on each unit’s page: 60 px for monsters, 0 for Isaac and the mages); then it stops. | 11 |
States 6, 7, 8, and 12 also exist: explicit orders to attack a given unit or object, and one with no decision of its own. Which orders produce them is still being researched.
Read from the game’s code (the class of each order, the state it stores and the instructions that decide), not observed in an emulator.