Skip to content

Skirmish — battle flow#

Summary#

Once setup completes, skirmish sets DAT_0057a0f0 = 1 and enters the same tactical combat engine as campaign battles (lotr2_combat_*), but skips strategic map, economy, and siege-resolve flows. Two players (human + NPC or human + human) each control one army on a fixed battle map.

Confidence: confirmed for skirmish flag gating; combat detail defers to architecture/combat/MODULE.md. NPC unit control uses the same group-order AI as campaign battles — see spec/combat/npc-battle-ai.md.


Battle initialization chain#

Order Function Role
1 FUN_0042b919 Reset skirmish globals (battle type 0, scenario count 10, clear siege)
2 FUN_0042b7f7 Set DAT_0057a0f0=1, lotr2_game_active_view=2, assign slots 1↔2
3 FUN_0042ac0c Load TROOPS*.ENGDAT_00516ac0
4 FUN_0042b9c4 Load battle map by type (field / siege / custom)
5 FUN_0042ba40 Assign NPC noble, colors, army slot ownership
6 FUN_0042bf46 Copy unit counts from presets into army records
7 lotr2_combat_init_battle_ui Apply map row army-and-scenarios.md

Re-entry from rematch: FUN_0042b780 sets wizard step 0xb/0xc and calls FUN_0042b7f7 again.


Session globals during battle#

Global Typical value Role
DAT_0057a0f0 1 Skirmish active (not campaign)
lotr2_game_active_view 2 Battle view
DAT_00568964 1 Battle UI armed
DAT_005681ec / DAT_005681d8 1 / 2 Local / remote army display slots
DAT_0055ce70 / DAT_005678a0 0x20 / 0x21 Battle viewport seed
DAT_0053e8fc 0 or 1 Siege battle (type 2)
lotr2_game_screen_mode 0x29 ('+') In-battle screen during combat tick

Differences from campaign battles#

Code paths test if (DAT_0057a0f0 == 0) to enable campaign-only behavior:

Campaign only Skirmish behavior
Return to strategic map after battle Score flow → screen 0x2e. / /
Siege resolve screen 0x13 Skipped in lotr2_game_ui_on_battle_end_return
County ownership / economy updates Not applied (no map state)
AI strategic orders NPC uses battle AI only
Long battle on map '+' exit Skirmish → gateway '.' menu instead

Casualties still run through lotr2_game_battle_apply_casualty_split before score UI.


Siege vs field#

DAT_0053e91c Map init Unit UI columns Notes
0, 1 FUN_0047aaa3 11 Open field
2 FUN_0047c4ba(scenario) 7 Destructible siege map; DAT_0056d5c0=0x2c
3 FUN_0047b8b2 11 User custom map file

Siege uses DAT_004d4b58[scenario] for layout id (DAT_0057c910).


Battle tick and MP sync#

Combat uses shared figure tick dispatch (lotr2_combat_tick_all_figures, etc.).

When DAT_00553030 != 0, battle entry sends sync messages via FUN_0043f304 / lotr2_game_mp_send_enter_battle_mode (opcodes 0x3c / 0x3d for battle prep transition).

During battle, modal dismiss on MP may send opcodes 0x33 / 0x3f before return (FUN_0043bdcd).


Battle end#

lotr2_game_ui_on_battle_end_return:

if (DAT_0057a0f0 == 0)  → screen 0x13, siege resolve, campaign map
else                    → screen 0x2e, FUN_0042c64f, active_view=0

Interim screen 0x2e leads to score flow documented in scoring-and-rematch.md.


Sim tick shortcut#

lotr2_game_sim_tick: if DAT_0057a0f0 == 1, skips full map load (lotr2_map_load_from_dat path) and calls FUN_0042b780 to restore skirmish battle prep.


Clone checklist#

  1. Honor DAT_0057a0f0 equivalent through setup → battle → score → rematch.
  2. Load correct map row by rotating map_index (0–7).
  3. Apply preset unit tables + army tier modifiers before spawn.
  4. Use battle type to select field vs siege loader and unit column count.
  5. Do not write strategic map state after skirmish battles.

Evidence#

Symbol Address
FUN_0042b919 0x0042b919
FUN_0042b7f7 0x0042b7f7
FUN_0042b780 0x0042b780
FUN_0042ba40 0x0042ba40
FUN_0042bf46 0x0042bf46
lotr2_game_ui_on_battle_end_return 0x0043be65
lotr2_game_sim_tick 0x00497a34
lotr2_combat_init_battle_ui 0x00499e5d