Skip to content

Movement & Time

Every unit’s movement and the game’s clock are driven by one routine, ProcessMovement (LAB_091A, CODE+0xE712), called once per game tick to give exactly one entity its turn. Since 2026-11-30 every rule on this page has been run on the original code under a 68000 harness and compared with this project’s TypeScript on thousands of generated inputs, with a deliberately broken rule (a null control) beside each comparison to prove the test can fail. The method and the per-routine numbers are on How We Verified the Rules. Full byte- and instruction-level detail: docs/wime/amiga/movement-system.md, timer-system.md and logic-harness.md in the main repo (not part of this site).

Corrections published 2026-12-01. An earlier version of this page was wrong on four points, all now replaced below:

  • The calendar did not run September 3018 to April 3019 of the Third Age, and there was no “stuck in March” bug. The date line counts in Shire Reckoning from 23 September 1418, on the game’s own month table.
  • There are no “13 movement-speed tables keyed by the terrain byte’s low nibble”. Speed is one formula over 12 class weights and a 256-entry terrain score; the “13 tables” were 16-byte slices of that score table.
  • A unit does not move “a tile” when its accumulator crosses a threshold. It moves one pixel per step, at most two steps a turn.
  • A scripted march does not flow from waypoint to waypoint: it camps at every waypoint before loading the next.

Time has three nested levels, and it advances only once every entity has had a turn. There is no independent real-time clock:

1 call to ProcessMovement = 1 entity's turn (sweep index 1..151, A4-$294b)
151 calls (one full sweep) = 1 sub-day tick = 15 game-minutes
96 sub-day ticks (0..0x5F) = 1 day (hour = subDay / 4)

The end-of-sweep advance (CODE+0xE7A6-0xE7C6: sweep := 1, sub-day + 1, past 0x5F wrap to 0 and day + 1) matches this project’s advanceSubDay on 980 of 980 vectors. Null control: a 24-tick day is caught on 750. A new game opens at sub-day 0x40, 16:00 on day 0, read from the shipped DATA hunk and cross-checked against the shipped save file’s own sub-day byte (0x41, one tick later).

The date line is drawn once an hour by the hourly day panel (LAB_089E, CODE+0xD894) from a nine-word month table at DATA+0x4230:

-22, 8, 38, 68, 100, 130, 160, 190, 9999
Sep Oct Nov Dec Jan Feb Mar Apr (sentinel)

The month is the number of table entries at or below the day, minus one; the day of the month is day - monthStart + 1. So day 0 is 23 September, and the year is 1418 S.R. (Shire Reckoning) for days 0 to 99 and 1419 S.R. from day 100. The line is 12-hour and shows the hour just ending, so the game opens on:

5 p.m. September 23, 1418 s.r.

Dates worked with the verified rule (panelDate, wime-panel-rules.ts; verify-panel.ts compares 6,000 day/sub-day pairs, built with the real ltoa at CODE+0x17D2C, with 0 mismatches; null control: a 24-hour clock is caught on 6,000 of 6,000):

Day Date line at sub-day 32 (08:00) Why it matters
0 September 23, 1418 the first day
8 October 1, 1418 the table’s second entry
92 December 25, 1418 the copy-protection question starts here
99 December 32, 1418 December has 32 days in the table (68 to 99)
100 January 1, 1419 the year rolls
149 February 20, 1419 Saruman’s army marches (event bit 4)
169 March 10, 1419 the Dark Lord’s armies march (event bit 7)

Month lengths from the table: October to November and January to March are 30 days each, December is 32, September starts on its 23rd.

Each step below is a verified rule in src/engine/wime-movement-rules.ts, compared with the CODE span named beside it.

Units with moveState 0 (inactive) or 2 (busy), any unit with a commander (+0x23 != 0, a follower), and units with no destination or no strength are skipped (CODE+0xE86C-0xE8A2). Followers are never moved by this routine; after a battle the post-battle regroup re-seats orphans.

Transition Rule Animation
Moving to camped (1 to 3) stamina (+0x22) reaches 0, at any hour entry 123, camp
Camped, resting stamina regains 2 a turn none
Camped to moving (3 to 1) stamina back at staminaMax (+0x21), sub-day strictly inside 0x14..0x34 (05:15 to 12:45), and rand(10) == 0 entry 2, start marching

A moving unit loses 1 stamina a turn unless its staminaMax is 0xFF (the tireless roster). Verified on 18,288 vectors, 0 mismatches (CODE+0xE868-0xE94A); null control: the wake window shifted by 0x20 is caught on 1,084.

So units do camp at night, but only because stamina tends to run out by evening, and the morning window is when the 1-in-10 wake roll is allowed.

A unit chooses a heading only when its position is a tile corner (x & 0xF == 0 and y & 0xF == 0). The base heading is a 2:1 sector rule (CODE+0xE9A4-0xEA60):

xSign = sign(destX - x) only when 2·|dx| > |dy|, else 0
ySign = sign(destY - y) only when 2·|dy| >= |dx|, else 0
heading = table[(ySign + 1) * 4 + xSign + 1] (11 bytes, DATA+0x41E0)

Headings are numbered 0 = north, clockwise. Verified on 23,881 vectors (every dx, dy in a 141×141 window plus 4,000 random), 0 mismatches.

Then rand(100): below 90, an eight-neighbour search scores each neighbouring tile’s terrain, multiplied by a bias row centred on the base heading (100, 69, 39, 19, 9, 19, 39, 69), with the exact reverse heading shifted right by 3; the best score wins. Otherwise only the straight-ahead tile is probed, and kept if it scores 10 or more. Verified on 30,000 vectors (CODE+0xE94A-0xEBB6), 0 mismatches; null control: the 69/39 bias weights swapped is caught on 8,030.

This local scoring is the whole explanation for units that seem to seek roads, bridges and passes: road tiles simply score better, and there is no global path search anywhere in the routine.

total = classWeight[(heading & 1) * 6 + moveClass]
× terrainScore[mapByte at (x + 8, y + 8)] / 100
+ accumulator (+0x20)
accumulator := total & 0xFF
steps := total >> 8
Table Where Values
Class weights, orthogonal heading DATA+0x41C4 0, 336, 372, 414, 460, 512 (classes 0 to 5)
Class weights, diagonal heading DATA+0x41C4 + 12 0, 238, 262, 292, 326, 362
Terrain score DATA+0x4242 256 entries, 0 to 100, indexed by the whole map byte

The map byte is (y & 0xFFF0) × 10 + (x >> 4), sampled at the tile centre, eight pixels in from the position (CODE+0xEBF8). A class-1 unit on a score-100 orthogonal tile gains 336 a turn: one step and 80 carried. Verified on 42,864 vectors (6 classes × 8 headings × 256 map bytes × 3 accumulators, plus 6,000 random positions with decoy neighbour tiles), 0 mismatches; null control: heading parity shifted is caught on 35,713.

One pixel along the heading per step, from the step tables in the same block. A second step is taken only when the turn earned more than one and the first did not land on a tile corner (CODE+0xEC92-0xED26). Verified on 6,192 vectors, 0 mismatches; null control: the second step dropped is caught on 4,095.

6. Arrival, waypoints and the position events

Section titled “6. Arrival, waypoints and the position events”

A unit has arrived only when both coordinates equal its destination exactly, tested once after a step that ends on a tile corner. It then camps (state 3) before the route queue (LAB_E420) loads the next waypoint, so a scripted march rests at every waypoint until the morning wake roll. There is no arrival test before steering: a unit standing on its destination steers off it and walks back.

The same corner block (CODE+0xED3C-0xF028) also:

  • retires the Rivendell escort: entities 0x4F-0x57 arriving on location 22 go inactive with +0x1E = 1 instead of camping;
  • raises the position-triggered event bits and the Barad-dûr defeat check (see Combat & Events § “The campaign bitfield”).

Verified on 24,000 vectors, 0 mismatches; 12,441 arrive, 3,001 raise the arrival message, 1,753 raise an event bit and 145 end the game. Null controls: every corner counted as an arrival is caught on 7,997, the obedience polarity swapped on 3,110.

Steps 1 to 6 were also run as one piece (CODE+0xE868-0xF028) and compared with this project’s live MovementSystem.takeTurn: position, heading, state, stamina, accumulator, destination, trigger, route queue, event bits and the final random seed, over 30,000 turns. The first run found 4,629 mismatches that the isolated checks had missed (the speed check had always planted its terrain byte at +8, while the live caller read it at the position). After the fixes: 0 of 30,000. Null controls: the wake window shifted is caught on 1,085, locations dropped on 264.

There is no routine that gives orders to computer-controlled armies. Every write to a destination (+0x0C/+0x0E) in the executable is one of: a player order, the route queue LAB_E420 (run by the activation trigger and by arrival), the post-battle regroup, and the Ring pickup’s Barad-dûr and scatter orders. Armies move because the activation routine (LAB_090A) wakes them and loads a static route queue from the 86-slot table at DATA+0x3B00, and steering follows it. An exhaustive search found zero writes to the route table and zero writes to entity+0x24 anywhere in the code. The route queue (LAB_E420) was run on all 86 shipped queues plus 3,000 random ones and 70 head values: 3,156 vectors, 0 mismatches.

Activation itself (the gate at CODE+0xE82A and LAB_090A) wakes an entity when its trigger condition holds: a campaign event bit, the Ring Bearer’s party within 9 px, Gandalf within 4 px, a day delay, and for some types only in the morning. Verified on 24,000 vectors, 0 mismatches; null control: morning-only dropped is caught on 1,380.

Field Offset Role
posX/posY +0x08/+0x0A Position in map pixels
destX/destY +0x0C/+0x0E Current leg’s destination
facing +0x15 Heading 0-7, 0 = north, clockwise; also the compass word in status text
moveState +0x16 0 inactive, 1 moving, 2 busy, 3 camped
trigger +0x1E Activation trigger, consumed when it fires
moveClass +0x1F 0-5, selects the class weight
moveAccum +0x20 Low byte of the speed total, carried to the next turn
staminaMax/stamina +0x21/+0x22 Fatigue; 0xFF maximum never tires
commander +0x23 Non-zero = a follower, skipped by this routine
route slot +0x24 Selects the 8-byte route queue

The status line for a selected unit is built from moveState and position (CODE+0x4A1C-0x4A94): “going to <location>” or “heading <direction>” while moving, “at <location>.” when standing on a named location and “resting.” otherwise. The game’s movement vocabulary is “following”, “heading”, “going to”, “passing by” and “resting”; the word “travelling” appears nowhere in its strings.

The harness runs the Amiga executable only, so the DOS ports are held to a different standard: their x86 code was read, not run, and every table compared with the Amiga’s.

  • The 382-byte movement, calendar and terrain block (class weights, step and search tables, heading table, search bias, the month table and the 256-entry terrain score) is byte-identical to the Amiga’s on both DOS builds, with little-endian words. It sits at load-image 0x1CD68 in DOS VGA START.EXE and 0x1EB34 in DOS EGA LORD.EXE; every DOS EGA table lies exactly 0x1DCC bytes after its DOS VGA counterpart.
  • The x86 consumers are traced and found by byte signature in both executables: speed (START.EXE image 0x70F1-0x7199), map byte (0x699A), step (0x71A5-0x7226), steering (0x6F8F-0x70DF) and the day panel (0x601A). Each matches the 68000 routine instruction for instruction; 28 signature tests pin them, with a null control at +2.
  • The DOS map (PAMM) equals the Amiga MMAP on 0 of 16,000 cells different (a one-row shift differs on 5,819).

What does differ is data, not rules:

Item Amiga DOS VGA / DOS EGA
Entity name pointers one pointer per string literal, so Haradrim, Variags, balrogs, wolves, spiders and trolls hold several pointers for one name the linker pools equal strings (22 groups merged), so the DOS post-battle sweep spreads casualties over every same-named force
Sprite set byte (+0x13) differs on 80 of 196 entities (VGA)
Scripted march slots 86 × 8 11 slots differ on VGA, 35 on EGA (EGA is a third variant of the table)

Which build shipped the “correct” march cannot be decided from the code. With ?seed=1 and the same five move orders, the first eight moved units reach the same positions on all three builds in this project’s engine. The DOS tiles’ colours are a separate, open question: the VGA tile palette is a hypothesis (see Status, wime-dos-tile-palette). Source: docs/wime/dosvga/exe-gameplay-data.md § Movement, calendar and terrain block.

Next: Combat & Events for what happens when two moving units meet, or How We Verified the Rules for the harness itself.