fix: marsh move-cost parity — grounded creatures enter slow terrain one step free (asymmetric with players) #182

Closed
opened 2026-07-24 13:34:27 +02:00 by marco · 0 comments
Owner

Found during the critical review of #155 (terrain move-cost, #138).

Problem

Marsh move-cost is applied asymmetrically to players vs creatures.

  • Player (MovementSystem.cs): gated on map.MoveCostTicks(cooldown, player.Position, target) = Max(cost(from), cost(into)) — so a player is slowed entering marsh (the entry step already costs the marsh cadence).
  • Creature (CreatureSystem.cs): gated on map.MoveCostTicks(baseCadence, creature.Position, creature.Position) = cost of the tile it currently stands on only. So a creature steps into marsh at dry-ground speed for the entry step, and only slows once it is already standing in the marsh.

Net effect: a chasing creature gets one "free" fast entry step at the marsh boundary, gaining ground on a fleeing player. This contradicts the code's own comment in CreatureSystem — "a chase through marsh slows pursuer and quarry alike (marsh is not a mob-favoured trap)": it is, mildly, mob-favoured at every slow-terrain entry.

Scope

  • Align creature gating with the player: charge the creature the cost of the step it is about to take (Max(from, into)), not just its current tile. The move target isn't known until Ai.Think, so either evaluate the cadence after Think (charging the tile it moves onto) or restructure so the entry step is charged.
  • Flying kinds (IgnoresTerrainMoveCost) stay exempt.
  • Keep it server-authoritative (already is) and data-driven on MoveCost (no per-terrain type check).

Definition of Done

Base DoD applies on top.

  • A grounded creature stepping from dry ground into slow terrain (MoveCost > 1) is charged the slow-terrain cadence for that entry step — matching player semantics — verified by a unit test against World (no networking).
  • The existing player behaviour and the flying-creature exemption are unchanged (regression tests stay green).
  • The CreatureSystem comment and the mechanic agree: entering/leaving slow terrain slows pursuer and quarry alike (no free mob entry step).
Found during the critical review of #155 (terrain move-cost, #138). ## Problem Marsh move-cost is applied **asymmetrically** to players vs creatures. - **Player** (`MovementSystem.cs`): gated on `map.MoveCostTicks(cooldown, player.Position, target)` = `Max(cost(from), cost(into))` — so a player is slowed **entering** marsh (the entry step already costs the marsh cadence). - **Creature** (`CreatureSystem.cs`): gated on `map.MoveCostTicks(baseCadence, creature.Position, creature.Position)` = cost of the tile it **currently stands on** only. So a creature steps **into** marsh at dry-ground speed for the entry step, and only slows once it is already standing in the marsh. Net effect: a chasing creature gets one "free" fast entry step at the marsh boundary, gaining ground on a fleeing player. This contradicts the code's own comment in `CreatureSystem` — *"a chase through marsh slows pursuer and quarry alike (marsh is not a mob-favoured trap)"*: it is, mildly, mob-favoured at every slow-terrain entry. ## Scope - Align creature gating with the player: charge the creature the cost of the **step it is about to take** (`Max(from, into)`), not just its current tile. The move target isn't known until `Ai.Think`, so either evaluate the cadence after Think (charging the tile it moves onto) or restructure so the entry step is charged. - Flying kinds (`IgnoresTerrainMoveCost`) stay exempt. - Keep it server-authoritative (already is) and data-driven on `MoveCost` (no per-terrain type check). ## Definition of Done _Base DoD applies on top._ - [ ] A grounded creature stepping from dry ground into slow terrain (`MoveCost > 1`) is charged the slow-terrain cadence for that **entry** step — matching player semantics — verified by a unit test against `World` (no networking). - [ ] The existing player behaviour and the flying-creature exemption are unchanged (regression tests stay green). - [ ] The `CreatureSystem` comment and the mechanic agree: entering/leaving slow terrain slows pursuer and quarry alike (no free mob entry step).
marco closed this issue 2026-07-25 18:01:47 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo#182
No description provided.