Skip to content

Game logic

Movement and AI

How units walk, choose a target and follow the orders a mission or the player gives them.

Movement

Choosing a target

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.

OrderWhat the unit doesState
WaitWaitWith 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 · MoveFollows its route without stopping to attack.2
Move, attacking on the wayWalkAuto · MoveAutoFollows its route and attacks targets already within its reach, without leaving the route.3
Move, chasingWalkAttack · MoveAttackChases a target within its sight radius; with none, follows its route.4
Move, then waitWalkWaitAuto · MoveWaitAutoFollows its route and chases targets within its sight radius; stopped and with no target, it waits as with any mode other than 0.5
Take a crystalOccupationGoes to the nearest mana crystal of another side within 80 px and stays until it is its side’s. With none that near, it does nothing.8
Guard a pointGuardPositionWatches 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
FleeEscapeRuns 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, 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.

Orders in each battle

Each unit starts a battle with a list of orders, which it follows on its own, one step per tick (1/60 s). Besides the orders above, the list can hold:

Example: the first battle

Six Misty Mush with three quarters of their HP. The first three patrol between two points; the other three wait 2 seconds and then go from point to point, chasing whoever comes within their sight.

UnitStarts atOrders
Misty Mush(344, 133)
  1. 1. max HP 75 % ·
  2. 2. go to (344, 153) ·
  3. 3. wait 30 ticks ·
  4. 4. go to (344, 133) ·
  5. 5. wait 30 ticks ·
  6. 6. back 4
Misty Mush(431, 78)
  1. 1. max HP 75 % ·
  2. 2. go to (431, 98) ·
  3. 3. wait 30 ticks ·
  4. 4. go to (431, 118) ·
  5. 5. wait 30 ticks ·
  6. 6. back 4
Misty Mush(422, 204)
  1. 1. max HP 75 % ·
  2. 2. go to (400, 204) ·
  3. 3. wait 30 ticks ·
  4. 4. go to (422, 204) ·
  5. 5. wait 30 ticks ·
  6. 6. back 4
Misty Mush(128, 82)
  1. 1. max HP 75 % ·
  2. 2. wait 120 ticks ·
  3. 3. go chasing to (294, 103) ·
  4. 4. wait 30 ticks, chasing ·
  5. 5. go chasing to (328, 56) ·
  6. 6. wait 30 ticks, chasing ·
  7. 7. back 4
Misty Mush(176, 128)
  1. 1. max HP 75 % ·
  2. 2. wait 120 ticks ·
  3. 3. go chasing to (356, 140) ·
  4. 4. wait 30 ticks, chasing ·
  5. 5. go chasing to (448, 97) ·
  6. 6. wait 30 ticks, chasing ·
  7. 7. back 4
Misty Mush(128, 174)
  1. 1. max HP 75 % ·
  2. 2. wait 120 ticks ·
  3. 3. go chasing to (332, 146) ·
  4. 4. wait 30 ticks, chasing ·
  5. 5. go chasing to (353, 201) ·
  6. 6. wait 30 ticks, chasing ·
  7. 7. go chasing to (432, 215) ·
  8. 8. wait 30 ticks, chasing ·
  9. 9. back 4

How often the 196 battle files use each order

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.

1×