Skip to content

Status/turn consolidation pass: tick-scaled decay, generalized trample, action order #201

Closed as not planned

Description

@nooga

Follow-up from nnunley's review on #166, tracking the parts of that feedback that are real but out of scope for a narrow bugfix.

1. Status ttl decrements per action, not per tick

add-ticks scales :ticks/regen-ticks by cost but unconditionally calls tick-entity-statuses once per action regardless of that cost. So ttl is documented as "turns remaining" but actually means "actions remaining" — swimming ((* move-cost 2)) burns one ttl same as a normal step, and a speed-modified creature decays at a rate decoupled from the ticks it actually spends.

This is what stands between us and meaningful haste: a player turn would need to cost some multiple of ticks (e.g. ~1000) for a speed effect to matter, and that only works if decay is counted in projected ticks rather than actions.

There's also a structural asymmetry contributing to bugs like #161: the player ticks statuses inside add-ticks, but creatures tick at the top of creature-turn before acting — one concept, two homes.

Note :webbed specifically should not become a projected-time timer — its ttl is a struggle counter (per #71), not a duration, and converting it would let a web time out just by standing still. Any consolidation pass needs to model both counters and timers, or :webbed becomes a timer on the way through.

2. Generalize trampling beyond webs

Trample logic currently lives only in the web struggle branches (world/player-move, ai/try-move). Should have a single handler for "an entity's action affects a hazard tile" covering grass, water, etc., not just webs, and should guarantee at most one entity affects the object per action.

3. Action order / determinism (already filed, folding in here for visibility)

#187: process-creatures (ai.lg:424) takes creature acting order straight from (vals (:entities world)) with no sort, and since every creature action advances the det seed chain, acting order is part of the determinism contract. find-target already guards the same dependency by sorting on (juxt dist-to (comp str :id)); process-creatures doesn't.

Context

Investigation (in #166) confirmed :webbed was the only status with two ttl owners — the other 11 apply/remove sites all go through the single tick-entity-statuses path — so the double-decrement bug itself didn't need a systemic fix. But the tick-scaling and trample-generalization issues above are real and worth doing before anything (like haste) depends on tick-accurate decay.

🤖 Generated with Claude Code

Activity

  1. mparrett commented on Sep 21, 2026

    @mparrett
    Collaborator

    Duplicate of #189, filed from the same #166 review on 1 September, which carries the survey behind these claims and the open design questions.

    Two things from here are now folded into it: trample stated as one handler for "an entity's action affects a hazard tile" rather than a list of terrain types, and the scoping note that :webbed was the only double-owner, so this work does not carry the #166 bug.

    Closing in favour of #189.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions