The server frame
The server advances each game by one frame every 40 ms (25 per second is the value in the image, and the routine that could change it has no reference: checked by a second reading). This page gives the order of everything inside a frame: the tick and its passes, the ten walks over the unit event lists, the queue that fills them, the periodic timers, the order rooms are activated and populated in, and where client messages are applied. It answers the question that decides the draws on a shared seed: whose draws come first. It restates the server frame spec.
What an event does is another page’s: a mode’s frames are animation and timing, a think is monster AI, a skill or missile is skills and missiles, a hit is combat, a population is monsters and objects. Here an event is opaque, in a known place.
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 they do not add up. Read What the windows test before relying on anything said to be seen in a window.
| Kind | What it is | Where it stops |
|---|---|---|
| Seen in a window | A frame window is a run of consecutive frames in one small scene of the game, with every event, queue call and seed step logged and each entry seed asserted against the chain, none resynchronised. § K1 lists the windows and which count. | It holds for the scenes run. The same seed and script repeating confirms nothing. Much is taken from the log as given, and most events move no seed. |
| Seen in the kept logs | Logs of earlier game sessions, read again against an order model. No game was run for this. | The logs name few kinds of event, so a large total holds few pairs that can fail. |
| Emulated | The game’s own code run in an emulator on declared inputs and compared with a model: the code’s map. | It shows what that code does with what it is given, up to where a case ends. It is not the order in a game. |
| Checked by a second reading | The instructions read again with a second tool, or a scan of every reference to or store into the thing named. The spec counts it confirmed. | It covers what the code says, not that a game reached it. |
| Read from the code | The instructions were read, and nothing ran. | No run has checked it. |
| Counted, not raised | A count taken from the window logs, with what the spec says it means. The spec keeps these below confirmed. | The count is of the logs. Its reading is not a confirmed statement. |
| Unknown | Listed under What is not known yet. |
Counts. The counts from the windows are the spec’s at the date in this page’s front matter. If § K has moved since, § K wins.
The big picture
Section titled “The big picture”Seen in a window for game modes 0 and 1, unless a sentence says otherwise: over 5 500 ticks the windows hold 344 drain lines and none inside a tick, and the loop’s order was read again with a second tool. The open-server thread of modes 6 and 8 is read from the code only: no run used it.
Each pass of the client’s main frame in game modes 0 and 1, or of the open-server thread, drains the messages first, then asks whether a frame is due, then flushes. In mode 0 the flush follows only a pass that ticked. Each game ticks once per frame: 5 500 frames of the windows, at consecutive stamps, one game per process. The open-server thread, after a tick, flushes and sleeps 30 ms, and otherwise sleeps 10 ms.
The clock owes at most one interval. Every caller passes a cap of 1, three calls in all (checked by a second reading), so one call runs at most one frame per game (read from the code). After a stall of any length one call ticks, the next ticks again at once, and the third waits. A slowed game runs every frame in order, only later. Games tick in slot order, each under its own lock, over 1 024 slots (the bound checked by a second reading). A second tick routine exists, but no call, jump or pointer reaches the stub that calls it, so in this build this route runs every frame (checked by a second reading). The lag scale the tick stores is always the same value, and its one reader is a host statistics query, with no game effect (the value checked by a second reading, the reader read from the code).
The packets leave the frame through the flush, with one exception: on the autosave’s route inside the room sync, a one-byte packet goes to each client at once when the save’s conditions hold and one global is set (checked by a second reading). What sets that global, so whether single player takes the branch, is not read, and that nothing else leaves the frame is read from the code: the graph’s indirect calls are not followed.
The flush comes after the frame. Per live game, it sends every client’s queued packets. A game with no clients starts a timer and is closed once 300 000 ms have passed, or while its frame is above 1 500 and below 7 500. A game with clients clears the timer. Called with both arguments 0, the flush returns at once when under 40 ms have passed since its last run.
The tick and its passes
Section titled “The tick and its passes”Seen in a window: the order of ranks 1, 3, 4, 6 to 9, 14 and 17 to 20, 0 inversions over 58 678 ranked lines. The places of ranks 2, 5, 10 to 13, 15 and 16 are read from the code. The seven calls from rank 1 to rank 16 have no branch between them, and no branch elsewhere in the code targets that run (checked by a second reading). A rank is a place in the frame. The frame counter goes up by one before rank 1, and every period below tests the raised counter.

Step through frame-tick-passes
One server tick at the frame counter 1320, pass by pass. Between ticks the drain applies the queued messages (rank 21, § C). The tick raises the counter before its first pass and then runs ranks 1 to 20 in order (§ B): the act clocks, the frame statistics, the new rooms, the ten walks over the unit event lists, which take missiles, players, monsters, objects and items each as an every-frame walk and then the walk of this frame’s slot, the counter mod 64 (§ D), then the room sync, the frame reset, the clearing of the removal notes, and the three periodic passes. Those run when the counter divides by 20, 12 and 11, which 1320 does, and the sweep runs every frame but works only when the counter divides by 1500 (§ B). Each frame names what the pass can draw and on which seeds, as § J states them. The frames draw the pass list as the spec states it; the only computed values are the divisibility tests on the counter. The picture takes no seed. The picture restates the spec; nothing shown is observed in the game.
The table’s last column is each pass’s route to a draw, from § J. “None” means by direct reach: the call graphs do not follow indirect calls (54 and 57 of them in ranks 1 and 15, and so on). Each pass’s own code, and its “none” with the stops the spec names, is checked by a second reading, a second call-graph walker; what lies past a stop (the refresh’s aura route, an item’s free, the quest callbacks’ and the level build’s seeds, the per-item counts) is read from the code.
| Rank | Pass | What it does | Route to a draw |
|---|---|---|---|
| 1 | Act clocks | Steps each act’s clock; on a change, refreshes every client’s player and sends the clock packet to that act’s clients | None of its own. The refresh can reach an aura’s selection when a player’s wanted skill differs from the current one; which events leave that state is not read |
| 2 | Frame statistics | Statistics only | None |
| 3 | New rooms | Walks each act with rooms created since its last walk | The wanderer tick, the population, the restore, level-point lookups |
| 4–13 | The ten walks | Below | Each event’s own function |
| 14 | Room sync | The autosave test, then each client’s room work, activations included | Room activations, level builds, a preset’s drop rolls; the game seed not by direct reach with the saves stopped. The saves’ seed is not read |
| 15 | Frame reset | The per-frame flag clear of each unit marked updated | The free of an inventory item under one item flag |
| 16 | Removal notes cleared | Frees the notes the sync sent | None |
| 17 | Quest timers, frame % 20 | Below | Six quest callbacks |
| 18 | Release, frame % 12 | Room idle counts and releases | The release’s save test and room free |
| 19 | Level unload, frame % 11 | A countdown on idle levels | Building a neighbouring level’s record |
| 20 | Sweep tick | Works only when frame % 1500 = 0 | The free of an expired item |
| 21 | Between ticks | The message drain, first of all, and the client’s own code | Random-number functions reached through the handlers, 135 by one walker and 142 by the other; not computed per handler. The dispatch draws nothing of its own |
A queue call can draw too, by one route: a monster’s AI event queued under state 54; that it is the one route is checked by a second reading. A frame in which no act clock changes and no listed unit frees an item leaves the seeds of ranks 1, 2, 15 and 16 as they were (read from the code). Seen in a window: ranks 1 and 2 drew nothing (no draw before rank 3 in 631 frames with draws, and the game seed at each tick’s start equal to the next one logged in all 5 500 frames), and ranks 14 to 16 drew nothing in the 589 frames with no activation, release or save; the windows do not tell 15 and 16 apart from 14. Rank 21 assumes one thread runs both the client frame and the ticks, the single-player loop; the open-server thread of modes 6 and 8 would break it. A debug switch sits at the head of the tick, 0 in a normal game; its one identified writer has no reference (checked by a second reading), so it reads as unreachable in the stock image.
What the kept logs show of this order. Over the 331 frame-stamped kept logs, 3 713 293 events placed in 383 349 frames fall in rank order in every frame, 0 mismatches. What tests it is far less: 17 254 consecutive pairs separate the order (16 935 from the animation logs, 319 from the skills logs, none from any other), and 9 029 of them without the logs’ own phase; the other placed frames agree trivially. 118 340 of the 501 689 frames with two or more events cannot fail at all. Four wrong orders fail: monsters’ walks before players’ on 42 148 events, slot before every-frame on 9 608, missiles after items on 8 885, the drain before the tick on 95.
Other pieces seen in a game.
- The periods of ranks 17, 18 and 19: each call’s line appears at every due frame in every window, 12 of 12, 21 of 21 and 23 of 23 in the town’s first. The line is at the call site, so it shows the frames, not what the call did. In the 144 frames that hold two or more of the four periodic calls, all run in the table’s order.
- The sweep’s position: in one town window, frame 1500’s sweep line comes after that frame’s quest and release lines and before the frame’s end. That window logs no seed steps, so it shows position only. The 1 500 period and the sweep’s first steps are emulated; that the sweep unlinks, sends and frees in a game is read from the code.
- The save’s position: at frame 8192 in two Den of Evil windows, one save pair each, after the frame’s unit events and before its end, inside the
room sync. Its seeds are taken as given. Those windows are nearly empty and test the position and little else. The test itself, a signed
frame % 8192, is seen at that frame only. Seen in a window: the autosave routine does not save in single player and leaves its flag at 0, which is how the save call comes to run there; the windows hold 2 calls of the save, both at frame 8192 from the room sync, and none at another of 5 500 frames.
Ranks 15 and 16, read from the code. A unit marked updated joins its room’s list; the reset visits a room’s units newest marked first, rooms in list order, and a unit that changed room only in the new one. A removal noted in frame N is sent in frame N’s sync and gone before frame N + 1. The marking and the list clear ran under emulation. The 78 marking sites are not each read.
The message drain
Section titled “The message drain”From § C; each paragraph names its ground.
Three queues are drained in order, each first in, first out: system messages (game create, join), in-game packets of every client of every game, and host control. The queues’ order is checked by a second reading: the pop takes the head and both appends go to the tail, under one lock. A packet’s handler runs at once. A message arriving while its queue drains is drained in the same pass. Most packets pass a player-mode test first: all but five types, and a sixth outside one mode; 91 of the types up to 0x66 have a handler (checked by a second reading). Read from the code: the packets of all clients and all games share one queue, so their order is their arrival order, and which queue an append reaches is the network layer’s. Which drain a message falls in is arrival: a logged input, not something this page predicts.
Messages are applied between frames, never inside the tick. Seen in a window: 0 of 262 handler lines inside a tick. Read from the code: the packet dispatch has one call site, on one route from the drain, and the drain’s four call sites lie in the loops of the big picture and one wait loop that drains with no frame. A loop pass that does not tick still drains, so several drains can fall between two frames.
The stamp is the frame before. A packet applied while the counter reads N takes effect in the state frame N + 1’s passes start from. Seen in a window: 262 of 262 handler lines, of 13 packet types, carry the last tick’s stamp N, and the next tick is N + 1. The kept logs agree for the skill-request handlers: 87 skill checks from those handlers are logged after a missile frame of the same stamp, and “the drain reads the frame it acts before” fails all 87.
The ten walks
Section titled “The ten walks”The order is read from the code and seen in a window for ranks 4 and 6 to 9; the next section gives each rank’s ground.
Each unit’s pending work is a record on one of five lists, one per type: missiles, players, monsters, objects, items. Each list has two parts. Its every-frame part
runs each frame. Its slot part is a ring of 64: a timed record sits in slot frame % 64 of the frame it is due. Ranks 4 to 13 walk them:
A walk reads its list’s head when it starts, so a record queued during an earlier walk of the frame is found by a later walk of its own list (read from the code; the windows hold no such record, and the kept logs’ monster starts below are this case). For a rebuild, a unit’s events in one frame run by its type’s place in the five, then every-frame before timed, then the list’s order. Seen in a window: the types’ places among ranks 4 and 6 to 9, and every-frame before timed, with 0 inversions; in the windows’ passes 8 818 slot records ran at their frame and 48 159 every-frame records ran. Read from the code: ranks 5 and 10 to 13, and that two units of one type interleave by their records’ places in the shared list, while what a unit is or where it stands plays no part.
Emulated, the code’s map: the runners, the five of them in both modes, 300 cases, and the whole pass, 100 cases, with the game’s own every-frame queue call as the re-entrant callback. A walk saves the next record before it runs one, and passes over a slot record due a later multiple of 64 frames on. “Players before missiles” fails the 33 cases it separates, and “next read after the run” the 96. This covers no dispatch or event function, and no callback that frees another record.
The counter holds for 2 147 483 647 frames, 994.2 days at 25 per second, and the next increment wraps negative (read from the code). Emulated, the code’s map, at a negative current frame: a queue request’s raise compares a positive frame against the negative current one and keeps it, and at current frame −2 a frame at or below it is raised to −1, the every-frame marker; the queue then follows a null pointer, which in the game is an access violation (read from the code).
How far the order of the walks is confirmed
Section titled “How far the order of the walks is confirmed”Confirmed only among what the windows separate: ranks 4 and 6 to 9. Ranks 5 and 10 to 13 hold no event in any counted window, and their places are the reading above.
| Rank | Walk | Ground for its place |
|---|---|---|
| 4 | Missiles, every-frame | Seen in a window |
| 5 | Missiles, slot | Read from the code |
| 6 | Players, every-frame | Seen in one window: a town window’s 86 players’ every-frame events, each before that frame’s players’ slot walk |
| 7 | Players, slot | Seen in a window |
| 8 | Monsters, every-frame | Seen in a window |
| 9 | Monsters, slot | Seen in a window |
| 10–13 | Objects and items, both parts | Read from the code |
Seen in a window: 3 020 adjacent walks of different ranks, none inverted, in the seven counted windows that log seed steps: a Blood Moor pack and the Den of Evil, one player, Nova or standing, with what § K3 takes as given: 4 before 7, 417; 7 before 8, 1 975; 7 before 9, 203; 8 before 9, 425.
Seen in the kept logs, by the logs’ phase and call site, placing a walk against a neighbour:
- the players’ slot walk before the monsters’ (3 007 pairs);
- the monsters’ every-frame walk before their slot walk (4 637);
- the missiles’ walks before a player or monster event (6) and before the drain (81);
- one object event kind, the end of an operate, after the players’ slot walk (3 pairs) and the monsters’ (1).
These do not separate the objects’ every-frame walk from their slot walk, or the missiles’ likewise, and they say nothing of the items’ walks. The object pairs give no object walk a rank.
The queue
Section titled “The queue”Emulated, the code’s map: the timed queue, 400 cases, 0 mismatches (“insert at the head” fails the 241 where the slot already holds records); the every-frame queue, 150 cases (“append at the tail” fails the 36 it separates); the free, 300 cases; cancelling a unit’s events and freeing all of them, 150 cases, thin but sufficient. Further cases: a frame −1 request with a callback queues on the every-frame list with the callback dropped, 39 cases; taking a record passes an empty first block to the second, 32 cases. The state 54 branch’s own work lies past where those cases end, and so does linking a new block of records.
The state 54 branch (read from the code) is the one draw route inside the queue. It ends the state and, under a second state, can kill the unit or apply a hit; for a monster it then frees the pending AI events, and only then is the new record taken, so it replaces them.
Inside a list:
- Slot events run in queue order. Seen in the counted windows: 1 356 adjacent events over 659 frames, 0 inverted; 439 of the pairs are one unit’s, and 126 run against ascending unit id, so on those 126 the test separates queue order from id order. An id order would pass the other pairs. The kept logs agree: 4 579 consecutive slot pairs matched to their logged queue calls, 0 inverted, “newest queued first” failing all of them.
- Every-frame events run newest queued first. Seen in the counted windows: 29 300 adjacent events over 1 769 frames, 0 inverted; 1 096 run against descending unit id, the same separation. In the kept logs, 24 652 consecutive pairs of windowed missiles run newest first, which a descending id order would also predict.
Queued during a pass. An every-frame record queued into the list being walked or one already walked first runs next frame: seen in a window, 3 716 of 3 716 (missiles 3 396, monsters 308, players 12). One queued into a list walked later in the frame runs in this frame: the windows hold no instance, and the kept logs hold it for monsters. The kept logs agree on both halves for players and monsters: 658 monster starts queued during the missile or player walks ran in that frame, 2 819 monster starts queued in or after the monster walks and all 6 205 player starts ran in the next, 9 682 starts, 0 mismatched. For objects and items it stays read from the code: no log has a queue line of theirs. A timed record does not run in the frame it is queued, since its frame is at least the current one plus 1 (read from the code; no request in the windows asked a frame at or below the current one).
Freed during a walk. Emulated, the code’s map, 50 cases: freeing all of a unit’s records frees every one, on one to three lists, and moves the walker’s saved next record on. Read from the code: so a record freed is not run after it, and a unit freed during a pass loses all its records at once. A unit moved between rooms keeps them, since no record holds a room. A unit made inactive by a room’s release loses its records with the unit. Its saved record carries an event only for a shrine, queued again at the restore; another object branch queues events and is not read further. Where a restored monster’s first events come from is not read.
What an event runs
Section titled “What an event runs”From § F. The dispatches, their bound tests and tables, and the queue sites’ constant kinds are checked by a second reading; other sentences name their ground.
An event has a kind below 15, and each unit type has its own table of what a kind means, so a kind’s meaning depends on the type. For players and monsters the kinds are the mode’s frame, the mode’s end, a monster’s AI, regeneration, a state’s do function, an overhead chat’s expiry, the aura ticks and timed-list expiry, among others. Every missile record, of any kind, runs the missile’s frame, and every missile is queued to run every frame. A record with a callback runs that instead of the table. Some object kinds are not read. Players and monsters skip an empty entry; objects and items have no bound and stop the process on a bad one. Kind 14 has no table entry; that it is queued only with a callback is read from the code.
The freeze drop. A frozen, living monster’s events are dropped at the dispatch, except five kinds. The runner has already set its running flag, so a dropped timed record is freed like a run one, and a dropped every-frame record stays on its list. Emulated, the code’s map: the monster dispatch, 500 cases, and the monster runner with the drop, 300 cases. Read from the code: the kept record runs again once the freeze ends, a record with a callback is not dropped, and players have no such drop.
Two kinds, and whether they draw:
- The player’s status report, kind 11, runs every 30 frames: seen in a window, 186 runs, each queueing the next at frame + 30 and drawing nothing. Its first run, 250 frames after a player’s placement, and its two sends are read from the code (no placement falls in a window). Seen in a window: draw-free in the windows’ scenes, entry and exit seeds equal on every seed logged and no step on the unit’s own seed, in all 119 runs of the seven windows that log seed steps. The windows hold no dead pet, so the branch that removes one is not run. Its call graph reaches no draw, with two stops (checked by a second reading, a second walker).
- The overhead chat’s expiry, kind 6, is untested in the game: no window holds one. Its draw-free reading is by call graph only. Its three branches are emulated, up to the record’s free. A chat record lives
8n + 125frames forncharacters, read from the code.
The AI has two entries: at a mode’s end it runs inside that mode-end event, so its draws come at that event’s place in the frame and not at the AI record’s. Seen in a window: 447 AI draws in monsters’ mode-frame events, where a mode’s end is handled, and 992 in their AI events.
The periodic calls
Section titled “The periodic calls”The four run in the order of the table above, read from the call sites and seen in a window: the 144 frames that hold two or more of them hold them in that order. The periods of the first three are seen in a window, as above.
Quest timers, every 20 frames. A game with no quest control returns at once, writing nothing (emulated, 25 cases). Emulated, 300 cases, given that the pointer check returned 0: a tick count goes up, the list is walked from its head with the next timer read before each callback, a timer whose due tick has passed runs, one that returns 1 is unlinked and freed, the rest are due
again at the period plus the current tick, and the due ticks are folded when the tick count reaches its last value. Not covered: what any real callback does, the free, and adding a timer. Read from the code: adding pushes on the front, so timers run newest registered first, and adding is fatal while the
list runs. For a registered period p, a timer’s first run is p + 1 boundaries after registration and its period 20 × (p + 1) frames. The 26 registration sites name 21 callbacks: 13 reach no draw, 2 only through a specified entry, and 6 draw through quest content (the Act V thaw, Izual’s ghost, Diablo and the Act III guardians
spawn monsters, the Tristram portal picks a level point, the Dark Wanderer steps the quest seed once and creates a unit).
Release, every 12 frames. Emulated up to the first room whose count passes 10: the idle counts, the act order, the boundary. “At 10 or above” fails 86 cases. The release itself is levels.
Level unload, every 11 frames (read from the code). Each level with no reference and built rooms counts down. At 0 the check allows the unload or re-arms to 10. It can build a neighbouring level’s record when one of the eight vis levels is not yet in the act’s list. A level’s seed does not depend on build order, so this creation is invisible to every other seed.
The sweep, every 1 500 frames. Its position and its first steps are above. Emulated: acts 0 to 4, an act’s items (expiry at or before the frame) before its inactive records (expiry before the frame). It reads as the one pass that removes units by a frame test alone, so its frames are where an item can disappear with no event (read from the code).
Rooms in the frame
Section titled “Rooms in the frame”Seen in a window for the list order and the new-room walk, on one act per game, unless a sentence says otherwise: the act lists modelled by a push at the head and an unlink equal all 23 later walks. The rooms’ counts and population bodies are levels.
An act’s room list is newest first. A created room goes at the head and sets the act’s new-rooms flag, so every pass over the list goes from the most recently created room to the oldest.
Rank 3 walks an act whose flag is set, from the head. Every room gets one wanderer tick on its own seed; a room not yet populated is populated, and one already populated is restored once per activation. The flag is cleared after the walk. So in one frame’s walk, an act’s rooms created since its last walk come first, newest first, then its older rooms, and each older room’s seed steps once per frame in which any room of the act was created. Seen in a window: a walk falls exactly in the 30 frames whose act had a room created since its last walk, 371 older rooms stepped once each, 51 rooms populated and 32 restored. Emulated, 200 cases: which act is walked first, the head room reached first, the flag cleared on an act with no room. A client’s new rooms are walked at the start of the next frame. Three other callers populate one room at once, outside this order (read from the code). Several acts in one game are read from the code: the windows hold one act per game.
A room created during the walk is linked before the walk’s position, so it is not visited, and the flag’s clear leaves it waiting, unpopulated, for the next walk of its act, which needs another room of that act to be created. Seen in a window: 4 such rooms, each first walked at its act’s next walk, after another room of that act was created, 41, 47 and 72 frames later (the fourth has no later walk in its window). Read from the code: a level-point lookup inside the walk can activate one, and the cause of the 4 is not logged; one of the three callers could populate it sooner; one created in a later act is walked in the same pass, one in an earlier act in the next frame.
The act’s room-create callback. A created room calls the act’s callback when it is set. Checked by a second reading: the act’s creation zeroes the act and sets no callback, and the client’s two callback pointers are named once each, by the client’s own act creation. Read from the code: a later writer is not read, since 106 register stores to that field’s offset are not resolved, and the spec assumes the callback is 0 on the server.
Rank 14 walks clients newest first, one in single player. A client whose player’s room has changed makes its room change there. Within one change, rooms are created in the near-list order of the new room, restricted to rooms not yet active, with one other route (a room whose files become ready). Across one frame: clients in list order, each client’s room change, then the on-demand activations at their own passes.
Whose draws come first
Section titled “Whose draws come first”Read from the code, except where a paragraph says otherwise.
A shared seed is one that two units’ or two rooms’ draws in one frame can both step, so their order decides the values. Five kinds:
- The game seed: every unit creation, in population and the inactive restore at rank 3, in the unit events, in the quest timers’ spawns and in the drain’s handlers, and the population’s own loop over a room.
- Each level’s seed: the preset rolls of the rooms its activations load, the level-point lookups inside a population, the Tristram portal timer.
- The object-region seed, carried across rooms, operates and timer events.
- The quest seed.
- A unit’s own seed drawn in another unit’s event: a defender’s in a hit, a dead monster’s in its killer’s event.
A room’s own seed is stepped by that room’s activation, tiles and wanderer tick, and by a neighbour’s population. The saves’ seed is not read.
Seen in a window, for the game seed: it is stepped at the unit constructor of every creation (184 inside the rank-3 walk, 3 099 in units’ events), at the item constructor (27), and by the population’s own loop, 6 929 steps inside the walk.
One counter crosses games. The hit class counter is a byte, 0 at load, named by two instructions, its read and its one store, the increment, and no game create or close resets it (checked by a second reading). So the element of a hit depends on the hits picked before it in the process, other games included, and only for a hit with two or more of cold, fire, lightning and poison above 0. Otherwise two games share no seed, in the tick’s call graph, whose 145 indirect calls are not followed, but for one salt store. The windows log the counter, which shows it was logged and no more.
Hand-offs, seen in the kept logs: 1 065 396 pairs of consecutive observations of one seed by two events of one frame, in logged order: 1 023 086 handed on, 42 310 stepped 1 to 4 096 draws on, 0 reversed, 0 off the stream. On the game seed, 440 754 pairs, 4 675 of them stepped. A stepped pair says that something unlogged drew on that seed between the two events, and it separates the logged order from its reverse.
How few resynchronised entries re-chain. Of 281 player gaps in the kept logs, 142 re-chain, and 139 stay open. Of 331 monster gaps, none: those logs hold no AI line.
A worked example
Section titled “A worked example”Frame 1961 of a Den of Evil window, from the kept log, printed and checked by a kept script. It is one instance of the rules above, and not a separate proof of them. The spec has the seed values as a test vector.
- At rank 4, missile 456’s every-frame event runs. Inside it monster 40 dies and the game seed steps 2. That the 2 are one item’s is the treasure class reading, not this log’s.
- The seed at the missile’s exit equals the seed at the player’s entry: handed on.
- At rank 7, the player’s slot event runs a skill do. It creates 64 missiles, ids 514 to 577, one step per creation, 66 steps from the frame’s start.
- In frame 1962 rank 4 runs the new missiles newest first: 577, 576, 575, and on. Missile 577’s own seed is set from the low half of the last step, and 514’s from the first.
What the windows test
Section titled “What the windows test”The spec’s own warning. § K1 lists the windows. Each is whole and carried, with 0 mismatches. They run in single player, one fresh process per scene: one Sorceress of level 80 casting Nova or, in one window, standing, on six map seeds and two scripts. The same seed and script repeating confirms nothing.
Ten windows by count, and five carry the traffic. The seven windows that log seed steps hold 36 016 chained events, and five of them hold 34 773: two Den of Evil windows and three Blood Moor pack windows, one of those with the player standing. The other two are the Den after it was cleared or nearly so, 517 and 726 events, and they test the save’s position at frame 8192. The three town windows log no seed steps and were read with no step in another unit’s event allowed, so they test the entry and exit seeds and the order, and no step’s site. Two more windows are whole and carried, hold 12 837 more chained events, and are not counted: one for table sites missing, one for a unit id reused across a level change.
No counted window holds Corpsefire, so the Den scene is short of him by name. His class and mod appear in one session only, between two of its windows, and no window’s events hold those units. Two further tries failed: on one seed the pilot found no path to the warp, and on another it swept the level for 420 s without meeting him. So a Den window tests the Fallen, shamans, zombies and brutes and no more, and his thinks were not exercised in a window.
What a window asserts. A chained seed is the game seed, or a unit’s or room’s seed from its first reading in the window. Each logged step on one is applied, and every logged reading must equal the value kept. Each step is classed by what is open: the unit’s own event, the game seed inside an event, another event or a room’s walk (which must be listed), or nothing (which must be a listed pass). Per logged death, the item constructor’s steps may be no more than the unit constructor’s. Walks must fall in rank order, slot events in queue order, every-frame events newest first. Kinds 11 and 6 may hold no step on the unit’s own seed.
Two results seen in a window, at their scope:
- The game seed is handed between logged events with no unlogged step on a chained seed, 0 arithmetic failures over 74 625 entry readings, with a unit’s own draws taken as given and the limits below applying.
- A missile’s first reading is the seed set from a game-seed low half predicted before the reading, in 2 178 missiles. 64 more were created before their window, and 1 is no such setting.
A zero tests less than it sounds
Section titled “A zero tests less than it sounds”From § K3. The counts of the first and last bullets were recounted by a second reader and are confirmed as counts; what each count means is counted, not raised, like the rest of this section.
- Most events move no seed. Of the 37 977 events in the seven windows that log seed steps, 37 489 (98.7%) moved neither the game seed nor their own. 452 moved their own, and only 53 moved the game seed: the player’s skill do 34, a missile’s event 17, a monster’s every-frame event 2. 17 did both, so 488 moved either. The chained events mostly say that no seed moved unlogged, and little about any draw’s value.
- A step on no chained seed is not tested at all. That is 157 769 of the 174 756 logged steps: 147 314 between the ticks at no listed client location, 9 968 in the tick with no event open, 487 inside an event. The lists of allowed sites bind only a step on a chained seed. Counted by place alone, with no class, the logged steps lie 152 718 between the ticks (the client steps included), 9 995 in the tick with no event open and 12 043 inside an event.
- Some readings accept any of several values. While a fresh seed shares its low half with a chained one, the log reader holds every value the seed may have, and a reading passes on any of them: 225 readings held more than one. There a surplus step is not seen, while a lost one still is. Dropping one in-tick step at random is seen 24 of 25 times in the two full maze windows, 4 of 25 in the first pack window, 25 of 25 in the standing window and 14 of 25 in the second Nova window, where most in-tick steps are on no chained seed.
- Taken as given, not predicted: a unit’s own draws (AI, skill do, a missile’s own), the number of drop draws on a dead monster, the listed pass steps, the client steps, the save, and the equality of kind 11’s seeds. Every think in the windows is taken as given. What is predicted is the arithmetic of every logged reading, the missiles’ first readings, the class of every step, and the order.
- The per-death item rule tests almost nothing. Over 54 logged deaths, the item constructor’s steps and the unit constructor’s are 0 and 0 in 37, and 1 and 1 in 17, 0 failures. Read from the code, an item’s step cannot come without a unit’s, so in a game the rule can fail only on a lost line. The zeros test nothing, and the pairs at 1 and 1 show one path and that no other unit was created in those segments. A sub-missile would add a unit step and pass, and none occurred in a segment. “2 per item” over a kill with several items and “0 on a no-drop” are not tested: no segment holds two items, and neither the item count nor a no-drop is logged. “Two per dropped item” is the treasure class reading.
Another unit’s event drawing on a seed
Section titled “Another unit’s event drawing on a seed”From § K4, which has the sites. A step on a seed inside someone else’s event must match a listed trigger. Seen in a window: the sites of each trigger. The steps inside a killer’s event holding a death are the kill’s sites, 124 of them; the steps with a room walk open are the listed functions only, 1 720 of them; the owner and defender steps are at their listed sites. The counts below are those on a chained seed, and they are counted, not raised:
- kill, 122 steps: a drop’s treasure-class or quality draw, inside a killer’s event; the trigger names its unit through the logged death.
- room, 847: a wanderer tick, a monster spawn or an object placement inside a room’s walk. It needs only an open room walk, not that the rooms are neighbours.
- owner, 3: a to-hit or critical-double site, with a missile’s or the monster’s own event open.
- defender, 8: the defence, cold, wear, get-hit, hit-class and damage sites of a hit. Only the defence and wear sites were hit.
- kill event, 0: a unique mod’s death site, named through its queued event. No window hit it.
Owner and defender match event type and site, not the target: the logs do not hold the target, so they separate “this site outside a combat event” from “inside one”. Which seed a step moved is another matter, since a step’s line logs the low half it read.
Seen in a window: the defender’s 8 steps moved the player’s seed, in two hits. In the standing window, two Fallen at frames 1992 and 2020 each ran the defence roll and the wear sites inside their own attack events, 4 steps a hit. Each of the 8 logged low halves matches exactly one kept seed, the player’s, and the player’s next entry reading equals that seed with those 4 steps applied, 2 of 2. It agrees with the defence rolls and wear.
Two hits on one unit is the whole of that. That the seed is the player’s because the player is the defender is not confirmed, and rests on the specs: no window has another defender at these sites, a monster defender above all. The rest of the fifth kind of shared seed rests on the specs and on one uncounted reading from a pilot. Nova kills at range, so a casting player is rarely attacked.
Shared-seed pairs
Section titled “Shared-seed pairs”From § K5. A pair is two top-level events of different units that each moved the game seed in one frame. Seen in a window: there are 2 in the counted windows, both handed on and in pass order, 0 reversed, recounted by a second reader. Over every log of the window runs, pilots and development logs included, there are 8: missile then player 3, missile then missile 4, player then monster 1. This is a named count reported as measured, and it is not a short against a target. No confirmed statement rests on a pair. The rule for whose draw comes first follows from every game-seed step being logged inside an open event and from the events running in the tested order. What is thin is the variety among drawing events: the 53 above.
Hooks: where they ran, not where they can
Section titled “Hooks: where they ran, not where they can”Counted, not raised. A static reach leaves 65 functions universal: it has no calling context, and a few hub functions carry every pass into each one. One Den of Evil window, uncounted for its arithmetic but whole and carried, places 27 at an event by the ranks open when they ran, 4 ran only with no event open (an equipment refresh, an item requirement check, a monster stat callback, a passive refresh), and 34 are not reached and keep every rank. A placement says where a hook ran, and nothing of where it can.
Seen in the kept logs, three hooks’ passes are separated by logged pairs, each against its logged neighbours and not as a rank: the path step 3 820 (a monster’s step after the players’ slot walk; the player half stays read from the code), the animation advance 568, the running stamina drain 90.
Client steps are not evidence
Section titled “Client steps are not evidence”Counted, not raised. Between the ticks the main loop runs client code on client copies of the seeds, outside the frame. Those steps, at the listed client locations, are applied to no chained seed and counted apart. They are no evidence of the server’s frame order, and the names on those rows are the neighbouring symbol’s for a location often past a function’s end, not a read function. One busy client function gets no claim at all: its lines lie between the ticks on no chained seed.
What a build with no log still needs
Section titled “What a build with no log still needs”The activation record (read from the code, § H5 and § H6). Per frame, a log-free build takes as input: each client whose player’s room at rank 14 is not its client room, with the new room, the frame and the client’s place in the list; every on-demand activation and every one-room population; and the room pins that hold a release back. From these the rest follows: the creations, each act’s list order, each frame’s population order, the idle counts, the releases.
The record cannot be derived from client messages alone. The room a player stands in at rank 14 is the end of its movement in the walks, so that input stays logged until a movement model exists. With one, it follows from the player’s position each frame, and the on-demand activations still need the warp and waypoint requests and the population’s level-point lookups.
The act clock. Each act’s clock steps every frame, faster under conditions the spec gives: seen in a window, one step per frame on the one act, 5 500 of 5 500, and each of the 5 changes the tick’s first ranked line. It reads as the act’s day-and-night light (read from the code). Its three tables are only read, never written (checked by a second reading). The step ran under emulation, 420 cases, 0 mismatches, as the code’s map, with the scale kept below 5 000. Its three tables’ values are in the ActClockTables doc, checked against the image. Read from the code: on the server every act’s clock starts at scale 128 with its flag clear, and only Act II’s changes, to scale 4 with the flag set, between the eclipse and the viper chest. Run on the image’s tables, the step gives how often the pass sends its packet and refreshes every client’s player: 26 times a game day, 23 during the eclipse (a day is 35 846 frames in Acts I, II and V, fewer in Act III and far fewer in Act IV), never more than 2 176 frames apart. These frame counts come from the emulated step, not from a log. So a build with no log can predict on which frames rank 1 refreshes the players. What is still not read is whether such a refresh can draw in play: on stock data a clock change makes no item usable or unusable, and the refresh selects an aura only when a player’s wanted skill differs from the current one and is usable, a state other events would have to leave behind. A window across a clock packet settles that, and none has run.
Traps for a rebuild
Section titled “Traps for a rebuild”From the reimplementation notes.
Seen in a window:
- The stamp a packet reads is the frame before the one it acts in.
- The wanderer tick runs on every room of a walked act, so a frame that creates one room steps every room seed of its act once.
- The AI has two entries, so its draws can come at a mode-end event’s place in the frame.
- The new-rooms flag is cleared after the walk. A room created during its own act’s walk waits for the act’s next walk, as the three of the windows’ 4 such rooms with a later walk did; do not re-walk.
Checked by a second reading:
- Do not reset the hit class counter per game. Its one store is the increment.
Emulated, the code’s map:
- A queue request with frame −1 drops its callback, and a frame at or below the current one is raised, not refused.
- A freed record returns to the first block’s free list, last freed first, whichever block it came from. That is invisible unless a rebuild exposes record addresses.
- A slot holds records of later multiples of 64: a walk passes over them and keeps them.
Read from the code:
- The act clock pass refreshes every client’s player on any act’s change, and only the packet goes to that act’s clients.
What is not known yet
Section titled “What is not known yet”From the spec’s open questions, and the limits above:
- The act clock: whether its refresh can draw in play.
- Ranks 5 and 10 to 13 in a game: no counted window holds an event in them.
- In no counted window: Corpsefire, the overhead chat’s expiry, a dead pet, and the kill event’s row.
- The saves’ seed.
- The frame reset: the bits it clears, by name, and which item has the item flag at the reset.
- The room sync: two calls under one unit bit, what one more call does under a game bit, and the 16 game-code indirect calls of its graph.
- Events: the object handlers left unread, and which unit type each of the 269 queue sites is for, on which a kind’s meaning depends.
- Others not read: the caller of one Act V quest function, four unreferenced sites of the room unlink, one further room-list call, a dead mercenary’s way out of its pet list, the registrars behind 54 functions, and whether a logged event of a universal kind is the server’s or the client’s. The room unlink’s list of callers is a floor: up to 500 functions of its walk have none listed.
- Unemulated corners: a new record block being linked, the act clock’s product wrap at a far larger scale.
- Leads, nothing more: the busy client function may be rain particles, with no code read to say so, and no spec depends on it. The act’s room-create callback may stay 0 on the server, because the server’s call passes 0 and no later writer is read. Every window ran without sound; no figure here is known to depend on it, and none was run with it.
Where to read more
Section titled “Where to read more”- The spec: server frame, whose reimplementation notes list the traps and whose § K has the current counts.
- The glossary for rank, frame window and shared seed.
- Related wiki pages: animation and timing (a mode’s frames and the schedule), levels (activation and release), monster AI, skills and missiles, combat, seed to world (what has to come from outside), randomness (seeds and draws) and how we know.