Monster AI
A monster, a summon or a hireling does not think on every frame. It has an AI event, which comes due on a
frame or is called when a mode ends. One event runs a few checks, looks for a target, and calls the unit’s
think function, chosen from a table by the MonStats AI column and the unit’s AI state. The think draws on
the unit’s own seed and gives one command: a mode, a skill, a path request, or a wait until the next event. This page explains
that system and how much of it has been checked. It restates the overview, the
machinery and, for row detail it does not repeat, the
catalogue.
The mode’s frames are animation and timing. The skill behind a command is skills and missiles. The planners behind a path request are pathing. How a monster is created is monsters.
How sure each statement is
Section titled “How sure each statement is”This page names its ground at each statement, because the kinds differ and do not add up.
| Kind | What it is | Where it stops |
|---|---|---|
| Seen in a game | Logged in the game and compared with a model: the three kept batches of AI logs, a first run, a second of 21 sessions and a third of 17 logs, and five logs of Duriel and The Countess played by hand. | It holds for what the logs hold. A decision compared “at its first call” says nothing past that call. |
| Emulated | The game’s own code run on declared inputs, up to its first callee. | It shows that code’s map up to that call: no callee, and no store or command after it. It does not show what the game passes in. |
| Read from the code | A reading of the instructions, or of the project’s notes on them. Nothing ran. | No run has checked it. Not every catalogue block has yet been read against the instructions. |
| A consistency check | A model walks on past the first call, taking each call’s logged result, and forks where a branch reads a value the log does not hold. | A model that forks cannot fail at the fork, so it raises nothing. |
| Unknown | Listed under The shorts and What is not known yet. |
Past its first call, a think’s block is a code reading, except on the logged paths named below. Sections say how sure they are at their head and name the exceptions.
The big picture
Section titled “The big picture”The order is overview § B’s, and the steps’ confidence is given below the chart. The think call is where the logs compare a decision.
A stop at any step ends the event. The checks, in order:
- Freeze. A unit in state 1 that is alive loses a due AI event, and the freeze queues a new one for after its length.
- Stunned (state 21): idle 3 frames, and the event ends.
- A door. A class with
opendoors, on a cell with one collision bit, looks for the nearest closed door. It may operate it, then idles 5, and the event ends. - Keep near: Following.
- The target search by the row’s kind.
- The walk check, only with a target. A boss sight pause comes first: class 250, a champion or unique, or a boss, under distance 20
from a player target, fires a unit event, idles 20 and ends this event, once only. Then a unique mod’s teleport try, which draws up to twice on
the unit’s seed: a chance of 15 in 100 before it picks a point, and a second of 25 only when the unit’s life is below 30 %. Then, for an
isMeleeclass whose mode allows it, in a level withMonSpcWalkset and the distance above it, an approach test: passing goes on with the same target; failing searches for a hostile with a teleport point, which replaces the target, or with none walks a ring of 4 and ends.
The stunned idle, the door check’s first test and keep near ran under emulation to their calls (200 cases); the rest of the list, the walk check with it, is read from the code.
Seen: of 32 324 logged events in the first run, 14 645 reach the think call and 17 679 end before it, with the AI state 0 at all of them.
When a unit thinks
Section titled “When a unit thinks”Each part says how sure it is. How far a game has confirmed the frame’s walks is the server frame.
Two entries. The event runs from the queue, or by one of nine direct calls at a mode’s end. The nine are all mode ends, confirmed by three tools; that each is skipped while frozen and alive is read from the code. Seen in the kept logs: the frame’s passes in their order, the monsters’ every-frame list before their slot list, and the slot records in the order they were queued. That the AI event always lands in that slot list, after every monster’s every-frame event of the frame, is the reading of its 30 queueing sites. From a mode’s end it runs inside that mode-end event, so its draws come at that event’s place in the frame.
What queues the next one:
| Who | What it does |
|---|---|
| A mode’s neutral start | When no AI event is pending later than now: 45 frames if stunned, else the aidel column, whose value is the first difficulty’s or, under a test of two game fields, the game’s difficulty’s; 15 when that is 0. |
| An idle of n | Neutral mode unless already neutral, any pending AI event cancelled, the next at now + n. |
| A delay of n | The same with the mode unchanged. |
| A delay that only brings it earlier | The same, but only when nothing is pending, the pending one is due now, or it is due at or after now + n. |
| Others | 30 queueing sites in all, among them skills, a freeze, a restore and a knockback’s end. 66 sites cancel one. |
Seen in the logs: after 2 358 of 2 573 logged idles and 294 of 318 logged delays the next AI event came at now + n, with n at least 1 in every one, and no delay commanded a mode. After 68 idles another queue came first, 1 to 7 frames early; which one is not told apart. The neutral start, to its queue call, ran under emulation for a monster already neutral, and so did the delay that only brings it earlier. The 30 queueing sites and 66 cancelling sites were counted by two tools.
A count of 0 or below. All three helpers turn a 0 into 1 and keep a negative count, so a negative count would queue the event before now. That rule ran under emulation for the delay that only brings it earlier and is read from the code for the idle and the delay; no logged call has a count of 0 or below, and what the queue does with a frame before now is not read.
A think that queues nothing leaves no pending event, and such a unit next thinks at a mode’s end. So a monster that commands a mode usually gets its next event from that mode’s end, an idle one with no target from its row kind’s idle delay, and a think may also queue one while a mode runs, in which case the next command replaces that mode. Every command goes through one mode-set routine, which replaces the current mode. That paragraph is read from the code.
A small example: idle 5 at frame 1 000 gives the next AI event at frame 1 005, as the logged idles do unless another queue comes first. That it cancels any pending AI event first, and that idle 0 queues one for 1 001, are read from the code.
The table and the state
Section titled “The table and the state”The table. 148 rows, each giving a search kind, an init, a think and an alt, and 18 more rows for AI states. There are 147 distinct thinks: rows 106 and 143 share
one. A MonStats row names 146 of the rows; rows 0 and 143 are named by none. Rows 0 and 1 are bare: 0 returns at once and 1 idles 200
with a room. A class whose AI is outside the table gets row 0. The row’s four words, as the two routines that use them read
them, are confirmed by a second tool. The row-address map, for states 0 to 9 and 13 to 17, ran under emulation, 554 cases, and so
did the gate for states 10 to 12 and the states from 18 up, which have no bound, 240 cases.
The search kind decides when the think runs. It is the kind of the row for the stored state, not the class’s: a unit in state 12, when that state’s gate allows it, skips the search even if its class’s row searches. Seen in the logs: the 8 496 decisions of kind-1 states all had a target, and kinds 0 and 5 thought without one (5 003 and 340 decisions). The With no target column, and what the other kinds do, are read from the code.
| Kind | Rows | Search | The think runs | With no target |
|---|---|---|---|---|
| 0 | 26 | none | always | |
| 1 | 104 | the target search | only with a target | a ring walk or an idle, and the event ends |
| 2 | 16 | the target search | either way | |
| 4 | 1 | the target search | only with a target | a ring walk, or the next event in 20 frames |
| 5 | 1 | the target search | either way | as kind 4, and then the think runs |
Any other kind stops the event, and no stock row has one. With no target at kind 1, a unit on a cell that fails a collision test, or with one unit word at 3 or 19, walks a ring of 5 if its
mode allows it. Otherwise it idles by the nearest checked player’s distance d: 10 under 25, d − 10 from 25 up to 35, and 25 from 35 up.
The AI state is a word on the unit, not its mode. 0 uses the class’s row, and anything else uses the state row, except that states 10 to 12 use it only when a class test allows it. An init routine sets the state, clears the three AI variables and frees the parameter records. When the row being left has an alt, the alt runs for one event as a bridge and then does the full init. The init ran under emulation up to its code-pointer check, and so did the bridge: a call while the row’s own think is installed and the row has an alt sets the state and installs the alt, nothing more (23 cases), and any other installed think takes the full init (53). That the alt then calls the init again and installs the state’s think, and the stores after the init routine, are read from the code.
Who sets a state, by reading: a curse by its auratargetstate (states 10, 11 and 12), a flee routine (11), the cloak callback (10), a
superunique case (13), the hireling row (5 and 6), and two more skill routines (15 and 16). The curse is not the only route to states 10
and 11: The Countess’s launches in the third batch held them in 594 and 36 decisions with no curse cast. The 33 calls of the init, 21
with a constant state, were counted by two tools, and no call passes 2, 3, 8, 9, 14 or 17 as a constant. The sites passing a register
give no new value, and states 4 and 7 meet the same scan; that “no setter” is a reading, and no spec calls those rows dead.
Seen live. In the second batch’s 21 sessions (Normal, 7 539 decisions, 10 721 events) the state is 0 in every logged line except in two sessions, which hold states 10, 11 and 12, and states 1 to 9 and 13 to 17 occur in no line. In the third batch’s 17 logs it is 0 in 5 894 decisions, 10 in 594, 11 in 36, with 12 absent. This is a statement about those logged lines: the word is read only at a decision or an event, and the curses not cast, Nightmare and Hell are outside it.
Who has which row. A monster’s row is its record’s. Every hireling row’s class uses row 61. Summons enter like any monster; which summon uses which row is overview E10.
Finding a target
Section titled “Finding a target”Each paragraph says how sure it is.
The lists. The game holds ten target lists. Lists 0 to 7 are one per player slot, the player first and then its hirelings and summons. List 8 holds wanderers and units from two AI functions, and list 9 holds decoys. The routines that fill them and their callers were counted by a second tool.
The search, for a searcher of alignment 0, is read from the code:
- A forced target comes first (below). Otherwise the best distance starts at the difficulty’s
aidist, 35 when that is 0. - For each player list, the player counts only when in the searcher’s act, in a room, and not in a town. A counted player at distance 55 or more skips the whole list. A player in a town is never a target and its list’s pets are skipped with it. A dead player’s distance reads as out of reach, and its list’s later units are still taken.
- Any unit in the list is taken when nearer than the best so far and the line test passes. The list’s later units have no act, town or death test here.
- List 8 comes next, with the act test, against the same best. Then list 9 chooses: the nearest decoy, which has no range limit, wins when there is no other target, or when it is under 6 away and a test plan to the other target finds no point (and a further search finds nothing within 19).
A searcher of another alignment uses a unit search from its logic region instead, from 35, and the same decoy step. So, forced targets aside, a target is
never taken at or beyond aidist, and a decoy has no such bound.
The line test. A one-shot flag, set by a refused move under one of the command’s flags, forces it on. Otherwise it is off outdoors. Indoors it is on until the monster has had a target and nothing has cleared that flag. A further record, when a monster has one, can turn it off, its word toggled at each find. A searcher of alignment 2 sets neither.
The forced target. Taunt, attract and confuse set a kind and an id. Kinds 1, 2 and 4 look up the unit. Kind 3, confusion, draws on the searcher’s seed, flips the alignment for the search and restores it. A unit that does not qualify clears the kind and the id. This ran under emulation up to its calls (200 cases); the clear on a blocked line, and which caller asks for the line test, are read from the code.
A think’s own hostile, read from the code. Some thinks ask for it: the forced target, else the nearest hostile within 49 with a line test, then the same decoy rule. After it, some of a think’s distance tests read the event’s distance and others the hostile’s, as each entry says.
The hostile searches’ test holds one draw. A candidate must be a living player or monster out of town. A player with state 146, outside melee range, is refused on a draw below 80 of 100, and that draw is on the candidate player’s seed, not the searcher’s. A monster with state 146 is refused inside melee range. The test ran under emulation up to the melee-range call (400 cases), the draw included; the two refusals after that call are read from the code.
The distance. Twice the larger axis difference plus the smaller, all halved and rounded down: 10 and 3 give 11. That map ran under emulation, 240 cases over the six unit types. A sized form first takes the unit’s size off both axes, with a floor of 0. The squared distance some tests use wraps at 32 bits, also emulated.
No light radius, as far as scanned. The search’s functions call no stat getter, and none of the 1 213 getter calls with a constant id asks for that stat (a scan, confirmed). Some 205 getter calls take their id from a register and are not resolved, so the walkers’ and callbacks’ code is not placed in or out. The one visibility term the server’s code was found to hold is state 146.
The command
Section titled “The command”Each part says how sure it is.
A think commands through a small set of helpers, all ending in the mode-set routine: a mode at a unit or a point, a skill with its mode (a mode of 16 or more stops there), a sequence skill in mode SQ, and a move. A refused mode falls back to the neutral start. A refused skill idles 10.
A refused move depends on its flags, and this decides a draw. Seen in the logs for the walk with all three flags (47 one-step returns and 96 ring walks) and with none (44 results of 0, no step); the other flags are read from the code:
- With the flags clear it returns 0, with no idle and no draw, and nothing is queued.
- One flag cancels the AI event, and one sets the search’s one-shot line test.
- Only the third adds one step of the unit’s seed, then a ring walk of 4 on a result below 70 of 100, else an idle of 10.
The walks that draw.
| Walk | Draws, on the acting unit’s seed | How sure |
|---|---|---|
| The ring walk: a point at a given radius from the unit | 4 steps, 3 when the radius is 0, before its move | Its map to the move ran under emulation, 200 cases; the move and after are read |
| The sideways approach | 1 step, which picks path type 5 or 6 by the low byte | Its map to the override ran under emulation, 120 cases |
| The step away | none in its body | Its map to its first call ran under emulation, 200 cases |
The approach to a unit at a given distance draws nothing either; its map to the mode set ran under emulation, 120 cases. The sequence-skill command ran under emulation to the mode set too, and the skill command and the mode at a unit are seen in the logs.
Seen. The commands logged at the AI’s sites of the mode set are led by WL 6 133, RN 1 533, A1 712, A2 425, SQ 289 and S1 375, with path type byte 101 for every-frame modes and 100 otherwise. A few of S2, S4, S3, NU and mode 7 also occur.
The path request
Section titled “The path request”Read from the code unless it says seen or emulated. The planners are pathing’s, and they read the live grid. The override below ran under emulation, 240 cases each for its two routines, and the command’s path-type byte (100 or 101) is seen in 19 431 logged commands.
A command carries a path type: 100 means no plan, 101 means type 13, and the choice between them follows whether the mode is an every-frame one. A think can set a one-shot override of the type, a step parameter and a byte, used by the next plan and then cleared.
- Each word is stored only when non-zero, so a later override with 0 keeps what an earlier call set in this event.
- The step parameter is limited to −126 to 126, and outside that is fatal. The byte is capped at 77 and defaults to 5.
- An override of type 1 plans type 7 through the usual call. A lower routine does pass 1, at five sites.
- With no point after types 2, 7, 9 or 13, the plan is run again as type 15.
- The types the AI passes are 1, 2, 5, 6, 7, 13 and 15, plus the default 13. None passes 4, 10 or 14.
Seen. Inside decisions of the first run, all 9 618 logged plan calls with an exit line leave the unit’s seed unchanged, on types 2, 5, 6, 7, 13 and 15. 316 more have no exit line, which is not examined. Type 1 was not requested in that run, so “no draw” for it comes from the planner’s own emulation.
The town. Every AI path type ends in a planner that runs only after the plan’s town test, and a hostile searcher never takes a player in a town as its target. Whether a stock town’s geometry admits such a route stays open.
Following
Section titled “Following”Each part says how sure it is.
Keep near runs in the checks before the search. It ran under emulation to its calls (200 cases); what follows each call is read from the code. A unit with a stored unit to keep near, and whose mode allows it, looks that unit up; gone or dead clears it.
| AI distance to it | What happens |
|---|---|
| Below 2, when it is a player | Steps 19 away and ends the event; a refused step wanders a ring of 19 around it instead, and ends |
| 21 or more | An override and a ring of 19 around it, 4 steps of the seed, and the event ends |
| Anything else | The AI goes on |
The pair is written for a minion toward its boss, by revive and summon routines, and by Taunt: its four calls, counted by three tools.
The owner and the group. The owner’s three words, who writes and who reads them, are confirmed by a second tool; that a leader is a unit whose owner is itself is read from the code. A leader’s call pushes a copy of a small record to each minion of its owner, and rows 6, 13 and 20 use it with a block whose kind word is the only one written, so the other four words the copies take are whatever the stack held. Seen in the logs: 146 such calls, rows 6, 13 and 20 passing a block of kind 1 with the other four words non-zero, and 81 blocks reappearing word for word in another unit’s list later; that the four words are the stack’s leftovers is read from the code. One row, 30, reads two of those words from a record of that kind. Thinks read such a record from a list held on the unit.
Draws and seeds
Section titled “Draws and seeds”A worked draw, read from the code: a chance with aip1 = 50, on a step whose new low word is 1 234 567, gives 67, which is not below 50, so
the branch is not taken and the seed has stepped once. A chance is one step each, and it short-circuits: a test placed after a failed one makes
no draw. So keep the order of the tests.
Seen in the first run:
- Every logged point of a decision (entry, think call, boundaries, mode set, plan, skill start, exit) follows the one before by whole steps of the acting unit’s own seed, 0 to 7 steps, with 0 violations in 14 645 decisions. The state 146 draw is on another seed and is not logged.
- 899 skill starts of the decision’s unit between the think call and the exit, each entered at the decision’s last logged seed advanced 0 to 12 steps (0 steps 791 times), and each exiting with the event’s exit seed.
- A decision’s exit seed equals the same unit’s next decision’s entry seed in 12 368 pairs, 9 687 of them with draws. Over the three batches every tier AI but two has at least 20 drawing pairs: Fetish 22, the other 15 at 58 or more. The two are named below.
The gaps between two skill events of a monster. With the AI logged beside the skills, 41 of the 49 gaps of six replayed sessions close: every entry seed on the way agrees with the walking seed, and the next skill event starts inside the unit’s own decision, at 0 steps from its last boundary line. All 41 are row 13, and the resumed model reproduces every decision between the two events (91). That is on logged paths only, and the callee that starts the skill is a boundary. The other 8 stop at an attack line with the monster as attacker, its seed 1 to 4 steps past the walking seed, and which draws those are is not examined. The 331 gaps of the skills runs cannot be walked again: their logs hold no AI line and a replay does not reproduce them. They have the same shape, which is all their logs can say, and 330 of them are of classes 58 and 59.
A summon’s owner skill damage is seen for one class and one skill at one level, with one player, and is on skills and missiles.
The 18 tier AIs
Section titled “The 18 tier AIs”Each has a full entry at machinery § T, with its draw order as pseudocode. The third column is read from the code, a short gloss, and it leaves out most branches. All run only with a target except rows 61 and 67, which run without a search. Only rows 29 and 61 have an alt. The last three columns are the first run’s first-call comparison: decisions, how many distinct first calls the map predicted, and how the map was made. “By hand” means read, and only its equality with the log is seen.
| Row | Name | What the think does | Decisions | First calls | Map |
|---|---|---|---|---|---|
| 2 | Skeleton | Out of melee a chance to walk; in melee a chance to attack, then a draw for which attack; else idle | 357 | 4 | emulated |
| 6 | Fallen | Unless in mode 0 or 12, cancels its pending event. A dead monster near it in mode 0 makes it step away from its target. Then, from neutral only, a leader may call its group; in melee it attacks by chance; out of melee it walks within a range, else by chance walks a ring or idles | 1 393 | 1 | by hand |
| 9 | Wraith | Out of melee a chance to move toward the target; in melee a chance of the first attack; else idle | 70 | 3 | emulated |
| 13 | FallenShaman | In melee a chance of attack. Then it looks for a corpse, may call its group, may raise, may use its missile skill, and approaches or idles | 363 | 2 (358 and 5) | by hand |
| 20 | Scarab | A leader may call its group. A unit under the call uses its skill in melee and otherwise walks. Otherwise, out of melee, a word and a draw switch it between two approaches, and in melee it has chances of skill or attack, else idles | 180, 15 not comparable | 5 | emulated |
| 21 | Mummy | aip1 is a range, not a chance. A failed attack draw in melee idles and then walks in the same event |
168 | 5 | emulated |
| 22 | GreaterMummy | Chances of attacks near; a search for wounded allies and corpses; by chance a skill on a wounded ally, a raise, or a cast at a hostile; else approaches or idles. Radament’s search is wider | 71 | 3 | emulated |
| 28 | Vampire | Keeps an engaged or fleeing state and a skill cooldown; flees under 33 % of its life and returns at 75 % | 279 | 1 | by hand |
| 29 | BatDemon | Cycles through perching, attacking and stepping away | 115: 110 think, 5 alt | 1 | think by hand, alt emulated |
| 30 | Fetish | Hit and run: after a count of rounds, with the target’s life above a slot, it steps 14 away and later comes back | 130 | 1 | emulated |
| 34 | Andariel | In melee a chance of her skill, else attack. At range chances to idle or cast, else walk | 64 | 5 | emulated |
| 35 | CorruptArcher | Looks for its own hostile first. With none it approaches the event’s target or idles. With one, every distance and command after is about that unit: steps away, walks or runs to a band, then skills or attack | 95 | 1 | by hand |
| 37 | SkeletonBow | With a hostile within 19, chances of attack or a sideways approach; else moves toward a ring around the event’s target, or idles. No skill column is read | 278 | 1 | emulated |
| 61 | Hireable | With a player owner: far from the owner it teleports or follows by distance bands; near, out of town, it fights a hostile within 25, picking a skill by weight; else wanders near the owner. With no player owner, it changes state | 5 697 | 1 | emulated |
| 64 | SkeletonMage | Keeps a band from its hostile: walks in, steps away, attacks, or approaches sideways by chance | 226 | 1 | emulated |
| 67 | NecroPet | Cancels its pending event every time. Teleports far from the owner and walks back from 29; inside that it has a melee and a ranged branch, and what sets the switch for a necromancer’s pet is not read | 184 | 1 | emulated |
| 89 | Megademon | Uses its skill’s level as a distance, with a slot as a cooldown in frames; melee by chance; else approaches or idles | 98 | 1 | emulated |
| 125 | BloodLord | In melee a chance to act, then a chance of its skill in a constant mode, else attack; otherwise a chance to walk, else idle | 55 | 5 | emulated |
Those logs ran under a per-row cap of 200 per game, and the mercenary dominates because it thinks every few frames.
The first call
Section titled “The first call”A decision is one call of the think. Its first boundary, or first call, is the first call from the think’s code of a function the emulation of that think treats as a boundary. The comparison takes that callee, its call site, registers, stack words, the seed, the control words and the block a pointer argument addresses. It stops there. What the callee returns, and everything after it, is the next section’s.
The counts, seen in a game, each with its scope:
| Batch | Decisions logged | Compared | Mismatches | Outside the 0 |
|---|---|---|---|---|
| First run, every logged row | 14 645 | 12 614: 10 374 with an emulated map, 2 240 with a map read by hand | 0 | 2 016 in rows with no model, 15 Scarab decisions outside the log’s window, and the 17 679 events that end before the think |
| Second, every logged row | 7 539 | 6 272 | 0 | the rest, not compared |
| Third, every logged row | 6 524 | 4 476: 3 538 modelled, 938 by hand maps | 0 | 2 048 in rows with no model |
The floor’s real scope. 14 645 is every logged row, not the tier. The 18 tier AIs hold 9 823 of it, 15 of those the Scarab decisions not compared, each tier AI at 50 or more and the smallest at 55 (the table above). So the 12 614 also holds decisions of logged rows beyond the tier, which the catalogue counts row by row, each at its own first boundary.
How much a 0 tests. A row with one first call shows that callee and its words, not a branch choice. No think past that first call, nor any branch a callee’s result decides, is claimed by these counts.
- 3 313 of the third batch’s 4 476 compared decisions sit in the 16 thinks with one first call. They confirm that call and its words, and no branch choice. 1 163 decisions have a choice of first call.
- By row in that batch, 9 tier AIs have one outcome there (rows 6, 13, 28, 29, 30, 35, 37, 61, 64) and 7 more than one.
- The control that moves the call site fails every decision by construction. The melee control fails 767 of 4 476 and separates nothing in 16 rows. Controls fail as required in both later batches.
- Fallen’s return for modes 0 and 12 was never taken.
A hand map stays a reading. For rows 6, 13, 28, 29’s think and 35, the map is read from the notes and the instructions, not emulated. The logged first call equals it, and that equality is what is seen. The map as a rule of the code is not raised.
A fault of the logging, not of the model. The first logs of one revision in the Far Oasis held 36 first-call mismatches, all Scarab, all one call inside a pending owner lookup that the logging’s pending rule hid. Those 36 are exactly the decisions with that lookup at one site. The next revision of the logging logs that one line again, and no model changed. On the logs written after the fix the model’s words at that call held in all 43 decisions that reach it, 24 from a seed that did not exist at the fix.
Past the first call
Section titled “Past the first call”A resumed model walks the code from the think call. It takes each call’s seed as asserted on entry where known, and its logged exit seed and return. Where a branch reads a value the log does not hold, the model forks, and a model that forks cannot fail there. So the number of calls matched is not the evidence.
What is claimed, in plain words. For the decisions in this table and no others, on the logged paths only: no branch the model ran read an unknown value, so with the logged inputs and the logged results of the calls, the game’s code gives exactly one sequence of calls; that sequence equals the logged one in callee, call site and every word the model knows; and the code then returns with no further call. It confirms no row’s role or name, and no reading in the catalogue. The other side of a one-way branch is not compared. It assumes that an opaque callee changes no known memory but one unit field and its pointer arguments, and the known words exclude synthetic stack and path pointers.
| Row | Name | Decisions | Calls past the first | Two-way sites that fail alone when flipped | Logs (revision 4: the second batch; 6: the third batch and the logs played by hand) | How narrow |
|---|---|---|---|---|---|---|
| 13 | FallenShaman | 103 | 361 | 10 of 10 | 4 | |
| 21 | Mummy | 205 | 205 | 4 of 4 | 4 | one call past the first in every decision |
| 20 | Scarab | 205 | 346 | 9 of 10, the tenth told apart by the unit’s next logged event | 6 | |
| 30 | Fetish | 316 | 877 | 7 of 7 | 4 | 243 of the 316 on one path |
| 89 | Megademon | 77 | 232 | 7 of 7 | 4 | |
| 37 | SkeletonBow | 81 of 86 | 6 of 6 in the 81 | 4 | the 81 only | |
| 64 | SkeletonMage | 79 of 91 | 12 of 12 in the 79 | 4 | the 79 only | |
| 28 | Vampire | 56 | 168 | 15 of 15 | 6 | |
| 29 | BatDemon | 215 | 526 | 8 of 8 | 6 | |
| 35 | CorruptArcher | 111 | 226 | 10 of 10 | 6 | |
| 22 | GreaterMummy | 62: 27 and 35 | 98 | 9 of 9 | 4 and 6 | |
| 34 | Andariel | 51: 9 and 42 | 2 | 5 of 5 | 4 and 6 | two calls past the first in all |
| 44 | Duriel | 309 | 310 | 3 of 3 | 6, played by hand | Normal, Duriel himself and not Über Duriel; 1 decision out of melee range, the one case on that side |
| 10, state 13 | The Countess’s state | 160 | 988 | 7 of 7 | 6, played by hand | three given words, below; Normal, the player as target, one preset file |
Eighteen more catalogue entries are under the same claim, each on its own logged paths.
State 13’s row, three given words. For that row alone the logged inputs include three words the stock model does not load: the length of her path list, from the preset’s file; the base of the monster table, read by the logging itself; and the number of skill records, from the skills table. They are not unknown: the model does not fork on them, and wrong ones fail, except that the skill count can only fail low, so only that bound is tested. The list’s points stay unknown in this count and are compared with the file on their own. Without the words, that count has 1 of the 160 with no fork.
Everything a tier entry states past its first call outside those logged paths stays a code reading.
Row 28’s block was also run as written against every row 28 decision of the revision 4 and 6 logs: 100 decisions, 99 compared, 0 mismatches, 1 stopped at a return site not armed. That too is logged paths only. Its melee arm under one unit word, all of its fleeing state and its two skill uses are reached by no log and stay read from the code.
What the resumed 0 tests, on the third batch. 6 438 decisions are resumed with 0 mismatches and 86 stopped (one row’s indirect call 80, a return site not armed 5, a log’s end 1), with 46 832 calls matched past the first.
- Only 3 055 of the 6 438 have no branch on an unknown value. The claim above applies to the table’s fork-free decisions only.
- The other 3 383 hold 42 304 of the 46 564 later calls of completed decisions, where a fork cannot fail, and rows 6 and 61 alone hold 39 340 of them. So the large number is a consistency check.
- The controls: reversed branches fail 6 174 of 6 524, and a seed one step off fails 6 521 of 6 524.
A consistency check only: rows 6, 61 and 67, which have a branch on an unknown value in every resumed decision, and the other 5 of row 37 and 12 of row 64. Which call the code takes where an unknown decides is not compared:
| Row | Later steps an unknown decides | The unknown |
|---|---|---|
| 6 Fallen | 8 661 of 24 738 | a found unit’s mode and position. Its later calls are not breadth: 21 620 of the 24 738 are one call site, in its scan loop |
| 61 Hireable | 2 095 of 31 037 | a word that picks its first arm in every decision |
| 67 NecroPet | 21 of 449 | two words, and one field of a found unit |
| 64 SkeletonMage | 12 of 148 | |
| 37 SkeletonBow | 5 of 284 |
Scarab’s tenth site. One two-way site of row 20 clears a variable and returns with no call after it, so no comparison of calls can see it. The unit’s next logged event shows the variable instead: cleared where the draw sent it that way (59) and unchanged where not (11), 70 of 70. That puts row 20 under the claim.
Not claimed: rows 2, 9 and 125 have no call past the first, so there is nothing to claim, and BloodLord’s 38 decisions there are under the floor of 50 too.
The catalogue
Section titled “The catalogue”The other rows of the table and the 18 state rows are the catalogue, one entry each. Row detail belongs there, and this page does not repeat it: aip meanings, decision trees and draws in order.
| Batch | Rows | State rows |
|---|---|---|
| 0: the machinery rows | 2 | 2 |
| 1: acts I and II | 16 | 0 |
| 2: acts II and III | 14 | 0 |
| 3: ranged, maggots, the Zakarum, nests | 17 | 0 |
| 4: skeleton mages to the traps | 18 | 0 |
| 5: summons | 16 | 1 |
| 6: hirelings | 1 | 3 |
| 7: bosses | 9 | 0 |
| 8: towers, turrets, javelins and blowguns, Venom Lords, the siege | 13 | 0 |
| 9: act V minions | 10 | 2 |
| 10: act V rest, the Ancients, Baal’s minions | 12 | 0 |
| 11: Diablo, Nihlathak, the Baal rows, Uber Diablo and Baal | 7 | 0 |
| 12: towns, NPCs and the state rows | 13 | 10 |
The catalogue states the census. Of the 130 rows outside the tier: 55 have their first call compared, 2 are logged but have no model, so their first call is not raised, and 73 have no decision logged in the three kept batches. A state row’s own decisions, where it has any, are counted in its entry.
Every entry’s block is a code reading. What can sit on top of it:
- An emulated map: 115 of the 130 name an emulated family for their think or their init. It covers that code up to its first callee, and no callee, store or command after it.
- A first-call count, for the 55 above, which covers that one call.
- A count past the first call, on 41 entries, 5 of them state rows. Twenty of the catalogue’s entries are under the claim past the first call, on their logged paths: row 44 and state 13, state 13 with its three given words, and eighteen more rows and state rows; for state 11, only its 66 decisions with no fork. The rest are a consistency check.
- The arms a logged-path model compared, on many entries: the decisions, the mismatches, and which branches fail alone when reversed. They confirm the arms met on the logged paths, and the untaken arms stay readings.
- Callbacks and helpers run whole under emulation for some rows, among them the trap’s arrow pick, a generator’s class pick, and Diablo’s and Baal’s skill picks.
Past those, nothing else in the catalogue is confirmed, and no row’s role, name or reading is confirmed by being resumed.
How far the blocks have been read
Section titled “How far the blocks have been read”A block restates the project’s notes on the code, and those were wrong in places no earlier check caught. The state of that is stated in one place, and it moves, so it is by link: How to read an entry names the blocks read line by line against the instructions, and by whom, the blocks not read, and the rate of error measured on a sample of them. Read that paragraph before relying on a block outside its read set. Within that sample, an error changed a branch or a command’s argument, and none a draw’s order or count.
Row 106’s pick
Section titled “Row 106’s pick”Read from the code; no log holds a decision of this row. A Shadow Master scores its skills to pick one. A skill’s score starts from the skill’s own numbers and the target’s resistance to its element, and its aitype adds terms from a few words the think computes once: how near and how many hostiles are, its life, its line to the target, its owner’s surroundings. Most aitypes also take one draw on the unit’s seed, and that draw comes before the test for the list, so a skill the list does not keep has still drawn. A skill joins the list only when it beats the score of the last one in, so the list rises, and the pick walks it from the top, each entry taking a seed step that can pass it over, down to the plain attack. A skill that targets the unit itself can hold the top of the list and commands nothing.
The spec’s reading was run against the think’s instructions as a check of the transcription, with every call it makes stubbed, so it says the two agree and raises nothing. As data, no stock skill reaches four of the aitype cases. Row 143 shares this think, and no MonStats row names it.
The tables of rows 25 and 94
Section titled “The tables of rows 25 and 94”Will-o’-wisps dance and desert turrets sweep by tables held in the code. Row 25’s and row 94’s are given in the catalogue, listed or by a rule, and each value is compared with the game’s image, which says what they hold and not how they were made. How the thinks use them is read from the code, and no log holds a decision of either row. The wisp’s grant to a player ends by the timed list’s expiry, and death may free it first, also read from the code. As data, row 25’s wisps are in the spawn columns of some levels and one superunique.
The Uber rows
Section titled “The Uber rows”Rows 145, 146 and 147 have thinks that command nothing: each only returns, which for row 146 ran under emulation, 240 cases, and for the other two is read. With no target the think does not run and the unit idles or walks a ring. With a target the boss sight pause fires once, and then the event queues no next one, so the next AI event needs a mode change from outside. Rows 145 and 147 have alts, Baal’s and Diablo’s.
No Uber event was found in this image, by reading: no creator of the three classes and no specific driver, the helpers that would spawn the minions have no reference, and the two cube portal stubs return 0. That search cannot see a class number or address computed at run time, a value read from a file or packet, or a class named by a string looked up in the table, and no stock session has watched the helpers. It says nothing of any other build or of the realm. What moves and casts those three units is an open question.
The shorts, by name
Section titled “The shorts, by name”What the runs did not reach, each stated as it stands. Each is open in what it leaves unreached. Those that lack logs need a further session in a game, and the Uber forced cases need one played by hand.
- Chaining: Andariel and BatDemon. The chaining of decision pairs reaches 8 drawing pairs of the 20 asked for Andariel, and 1 of 300 pairs for BatDemon. For those two it stays a reading.
- BloodLord. 38 decisions past the first, under the floor of 50, none with a call there, so nothing is claimed past the first call.
- The catalogue sample is short for batches 5, 10 and 11, which have no row that counts. Batch 7’s is Duriel’s row 44 and batch 12’s is state 13, both played by hand, in Normal. The logs hold no non-tier row of 5 and 11, and of batch 10 only row 130, whose first call is compared and which has no call past the first. Of batch 12’s other rows, row 54 cannot fail, row 99 has no call past the first, row 32 has a fork in all 199 decisions of the revision 4 logs, and row 100 has 4 decisions. The rest of the table stays at its emulated map or its reading.
- State 13, The Countess’s state. Played by hand: 160 of her decisions follow the catalogue’s block on the branches reached, and her Firewall goes through the four points of her preset’s path, in the first of its two files. What sets the state was not seen, since the logging began after she was created. States 2, 3, 8, 9, 14 and 17 are not called dead.
- Duriel in melee range. Played by hand, Normal: 308 decisions, Smite 102, Jab 116, first attack 90, each one’s choice following from three fresh draws on the seed logged for it. The frequencies stay arithmetic on that, Smite 33 %, Jab 33.5 %, first attack 33.5 %, and a community page’s 17 % first attack, 50 % Jab fall outside what was measured. Über Duriel, the same think and the same slots, is not played.
- A champion corpse and the Greater Mummy. A community page lists champions as an exception to its raising. By the reading, its search tests the unique flag only, so a champion corpse in range becomes its corpse, and the skill’s own target test is not read for champions. No natural champion was logged. A built state cannot count, since the logging never writes game memory, so it needs a forced mode that writes nothing.
- The Uber forced cases. Four named cases, forced setups for a session played by hand. Not run.
- Row 23’s mismatches. Past the first call, the revision 4 logs hold 8 for this row, with the logging’s call limit as the cause read. The revision 6 logs have the row at 256 decisions with 0 mismatches, but only 2 of the lines that would test that cause are this row’s, so the reading is untested.
- The other gaps. The 8 and the 330.
What is not known yet
Section titled “What is not known yet”From the specs’ open questions:
- Rows 25, 94, 106 and 143 in play. No log holds a decision of these rows, so their readings are untested there.
- Row 94’s tables. Whether one odd cell of the turning table is a slip, which changes nothing a rebuild needs, as the code reads the table as it is; and whether the step table points the way the direction index names, which is not read.
- What moves and casts the Uber classes, given thinks that command nothing.
- Unnamed here: the column behind the gate of states 10 to 12, the writer of the unit word the ring walk tests, the third block a monster gets at creation, and the game field in the
aidelchoice. - The register stat getters, which would need a resolver before a spec could say the walkers and callbacks read no light radius.
- Path type 16’s setters: they have no reference, and a run could settle whether anything reaches them.
- The town: whether a stock town’s geometry admits a follower’s route.
- Per row, in the catalogue’s list: among them what a self-kill credits, which minions two group calls reach, a state one row tests and nothing in it sets, who writes the hydra’s variable, what one row’s context holds when no search ran, and who posts another row’s records.
- Community claims. 67 are listed by row, as leads: 35 held by the code reading, 23 held with a refinement, 6 not covered, 3 contradicted, those being Duriel’s two and the Greater Mummy’s. A verdict compares a claim with a code reading, and agreement raises nothing; Duriel’s first is also measured, in the shorts.
Where to read more
Section titled “Where to read more”- The specs: overview, machinery and catalogue, whose Reimplementation notes list the traps.
- The glossary for D2 terms and
aip. - Related wiki pages: monsters (how a monster is created and what its stats are), skills and missiles (what a skill command does), pathing (the planners behind a request), the server frame (the order of events in a frame), animation and timing (a mode’s frames and the step), characters and hirelings, randomness (unit seeds and draws) and how we know.