[PR #1205] [MERGED] Mob pushes: one list per mob once a crowd is pushing #3419

Closed
opened 2026-11-03 04:09:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1205
Author: @pirut
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @ludovic111

Base: main ← Head: claude/upstream-mob-pushes


📝 Commits (2)

  • 2ecbdd5 Mob pushes: one list per mob once a crowd is pushing
  • 59adff1 Merge main into #1205: keep push_tests next to teams_tests and sensor_scan_tests

📊 Changes

3 files changed (+270 additions, -16 deletions)

View changed files

📝 crates/horizon-client/examples/mob_ai_probe.rs (+1 -1)
📝 crates/horizon-client/src/game/creatures.rs (+1 -1)
📝 crates/horizon-client/src/mobs.rs (+268 -14)

📄 Description

Requested by JR

What and why

Fixes #1221.

Mob pushes: one list per mob once a crowd is pushing

Pushes between mobs wait in a list until their target ticks; each mob's
tick scanned the whole list, and take_mob_pushes removed each push from
the events in place, shifting the rest. In a pen where every mob pushes
its neighbours both grow with the square of the crowd per mob.

The pending pushes stay a list while short (64) and become one list per
mob past that, each in push order, so every velocity adds up the same
values in the same order. take_mob_pushes splits the events in one pass,
keeping the order of the others. A test checks velocities bit for bit
and the remaining events against the old code.

30 mobs pushing each other:   0.11 -> 0.04 ms per tick
100 mobs pushing each other:  1.73 -> 0.37 ms
200 mobs pushing each other:  9.07 -> 2.61 ms

Vanilla reference

LivingEntity.pushEntities and Entity.push: every velocity adds up the same values in the same order (a test in this PR checks velocities bit for bit against the old code). Harnesses: test_mob_ai_parity.py, test_entity_collision_parity.py.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on Mac, against upstream/main at fd0473605, 1 min 28 s)

Check Result
Scope ✅ 3 files, +270 −16
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅ (28 s)
tests: horizon-client ✅ 1081 passed (47 s)
doc tests ✅ 0 passed (7 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1205 **Author:** [@pirut](https://github.com/pirut) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `claude/upstream-mob-pushes` --- ### 📝 Commits (2) - [`2ecbdd5`](https://github.com/horizon-rust/horizon/commit/2ecbdd57ebfc50459e4cd5017cbe24f3a790ae8a) Mob pushes: one list per mob once a crowd is pushing - [`59adff1`](https://github.com/horizon-rust/horizon/commit/59adff16ffe4aba87251235160b68d140f8a72b6) Merge main into #1205: keep push_tests next to teams_tests and sensor_scan_tests ### 📊 Changes **3 files changed** (+270 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/mob_ai_probe.rs` (+1 -1) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs.rs` (+268 -14) </details> ### 📄 Description <!-- claude-projects-attribution: {"github_login":"pirut"} --> _Requested by **JR**_ ## What and why Fixes #1221. Mob pushes: one list per mob once a crowd is pushing Pushes between mobs wait in a list until their target ticks; each mob's tick scanned the whole list, and take_mob_pushes removed each push from the events in place, shifting the rest. In a pen where every mob pushes its neighbours both grow with the square of the crowd per mob. The pending pushes stay a list while short (64) and become one list per mob past that, each in push order, so every velocity adds up the same values in the same order. take_mob_pushes splits the events in one pass, keeping the order of the others. A test checks velocities bit for bit and the remaining events against the old code. ``` 30 mobs pushing each other: 0.11 -> 0.04 ms per tick 100 mobs pushing each other: 1.73 -> 0.37 ms 200 mobs pushing each other: 9.07 -> 2.61 ms ``` ## Vanilla reference `LivingEntity.pushEntities` and `Entity.push`: every velocity adds up the same values in the same order (a test in this PR checks velocities bit for bit against the old code). Harnesses: `test_mob_ai_parity.py`, `test_entity_collision_parity.py`. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on Mac, against upstream/main at fd0473605, 1 min 28 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +270 −16 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ (28 s) | | tests: horizon-client | ✅ 1081 passed (47 s) | | doc tests | ✅ 0 passed (7 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:09:23 +07: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
horizon-rust/horizon#3419
No description provided.