Summary
In CSimulation.update(), all units are updated in a single pass without prioritization. This causes hero units to lose last-hit credit to allied units when both deal lethal damage to the same target within the same simulation tick.
Reproduction
While developing an AI training environment for Dota-style last-hitting using Warsmash, I observed that the hero unit (Leoric) was unable to secure last-hits despite landing successful attacks. Across 3 episodes, the hero swung 297 times but achieved 0 confirmed last-hits.
The pattern: when both the hero and an allied unit attempt lethal damage on the same enemy creep within one tick, the unit updated first wins the kill credit. Since CSimulation.update() doesn't differentiate between hero and non-hero units, the order is effectively arbitrary, often favoring allied creeps.
Root Cause
In core/src/com/etheller/warsmash/viewer5/handlers/w3x/simulation/CSimulation.java, the update() method iterates through all units in a single pass. There's no guarantee that hero unit damage events are processed before allied non-hero units within the same tick.
Proposed Fix
Split CSimulation.update() into two phases within a single tick:
Phase 1: Update all hero units first.
Phase 2: Update all non-hero units.
This ensures that within any given tick, hero damage events are always processed before allied creep damage events, giving the hero priority for last-hit credit when timing is contested.
Impact
- Last-hit credit becomes deterministic and player-controllable in contested situations
- No change to game physics, attack ranges, damage calculations, or animation timings
- Only the within-tick processing order is affected
- Surgical fix with minimal blast radius
Additional Bugs Observed
While investigating, I also encountered:
- Hero XP capped at 156: Lane creep bounty + shared XP weren't propagating correctly to nearby heroes.
- Reset stability under headless mode: Occasional timeouts when resetting environments rapidly.
I'd be happy to discuss these in separate issues if you'd like.
Context
I'm a CS undergraduate student building an AI training pipeline (AlphaDota-style RL agent) on top of Warsmash. The hero-first update fix has been validated in my local fork:
- Pure WC3 environment: 0 → 25 confirmed last-hits across 5 episodes (5 per episode)
- Hero XP unblocked: max XP rose from 156 → 384
- No regressions in standard PVP scenarios I've tested
If you'd like, I can prepare a Pull Request with the fix. Happy to discuss implementation details or alternative approaches.
Thank you for maintaining Warsmash — it's been instrumental for my research project.
Summary
In
CSimulation.update(), all units are updated in a single pass without prioritization. This causes hero units to lose last-hit credit to allied units when both deal lethal damage to the same target within the same simulation tick.Reproduction
While developing an AI training environment for Dota-style last-hitting using Warsmash, I observed that the hero unit (Leoric) was unable to secure last-hits despite landing successful attacks. Across 3 episodes, the hero swung 297 times but achieved 0 confirmed last-hits.
The pattern: when both the hero and an allied unit attempt lethal damage on the same enemy creep within one tick, the unit updated first wins the kill credit. Since
CSimulation.update()doesn't differentiate between hero and non-hero units, the order is effectively arbitrary, often favoring allied creeps.Root Cause
In
core/src/com/etheller/warsmash/viewer5/handlers/w3x/simulation/CSimulation.java, theupdate()method iterates through all units in a single pass. There's no guarantee that hero unit damage events are processed before allied non-hero units within the same tick.Proposed Fix
Split
CSimulation.update()into two phases within a single tick:Phase 1: Update all hero units first.
Phase 2: Update all non-hero units.
This ensures that within any given tick, hero damage events are always processed before allied creep damage events, giving the hero priority for last-hit credit when timing is contested.
Impact
Additional Bugs Observed
While investigating, I also encountered:
I'd be happy to discuss these in separate issues if you'd like.
Context
I'm a CS undergraduate student building an AI training pipeline (AlphaDota-style RL agent) on top of Warsmash. The hero-first update fix has been validated in my local fork:
If you'd like, I can prepare a Pull Request with the fix. Happy to discuss implementation details or alternative approaches.
Thank you for maintaining Warsmash — it's been instrumental for my research project.