[PR #4497] [MERGED] Fish schools recruit in vanilla's order, with mob_ai parity scenarios (FollowFlockLeaderGoal) #5655

Closed
opened 2026-11-03 05:14:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4497
Author: @xFedeT
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/fish-school-parity


📝 Commits (1)

  • b947048 Fish schools recruit in vanilla's entity order; mob_ai school scenarios

📊 Changes

7 files changed (+75 additions, -12 deletions)

View changed files

📝 crates/horizon-client/examples/probe/mob_ai_probe.rs (+9 -0)
📝 crates/horizon-client/src/mobs.rs (+22 -0)
📝 crates/horizon-client/src/mobs/aquatic.rs (+19 -11)
📝 crates/horizon-client/src/mobs/goals.rs (+11 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java (+7 -0)
📝 tools/port_map/game-009.tsv (+1 -1)
📝 tools/test_mob_ai_parity.py (+6 -0)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally.

Refs #3521

What and why

The row FollowFlockLeaderGoal says fish do not follow a leader. That is wrong: the goal is ported (#3026, registered at priority 5 for cod, salmon and tropical fish). But no mob_ai scenario had more than one fish, so nothing compared it with vanilla. Three new scenarios (cod_school, salmon_school, tropical_fish_school: five fish in a pool for 400 ticks, no player near) did, and found:

  • Who is recruited. FollowFlockLeaderGoal.canUse makes the fish of its kind within 8 blocks follow the leader, limit(getMaxSchoolSize() - schoolSize) of them, in the order getEntitiesOfClass lists them: the entity sections by x, z, y, and in a section as the entities entered it. Horizon listed them in its position grid's order, so in a school capped at five (salmon) a different fish was left out than in vanilla. Mobs now note the section they are in and when they entered it (`Mob.section`, `section_seq`), and the goal sorts by them.
  • The first start delay. The goal's constructor draws it from the fish's random before the oracle seeds it; the oracle and the probe now draw it again at the same point (`Goal::set_start_delay`), as they do for bees.

Proof against vanilla's Java

python3 tools/test_mob_ai_parity.py --only _school: 3/3 scenarios, 6015/6015 mob-ticks identical (position, motion, goals, look, path, every random draw). Before the two changes the three scenarios diverged at tick 200 to 202, where the first fish starts to recruit. The whole harness still matches: 212/212 scenarios, 67129/67129 mob-ticks.

Not changed: with a player near, a salmon's AvoidEntityGoal diverges from vanilla (tick 185 in a first draft of the scenario with the player 12.5 blocks away); that is another goal's gap, which these scenarios leave out of the way.

pr_ready --quick: fmt, clippy, 1064 tests and 481 python tests pass.

🤖 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/4497 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/fish-school-parity` --- ### 📝 Commits (1) - [`b947048`](https://github.com/horizon-rust/horizon/commit/b947048ad6833d9fd98aa9da812e3cc08afc1974) Fish schools recruit in vanilla's entity order; mob_ai school scenarios ### 📊 Changes **7 files changed** (+75 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/mob_ai_probe.rs` (+9 -0) 📝 `crates/horizon-client/src/mobs.rs` (+22 -0) 📝 `crates/horizon-client/src/mobs/aquatic.rs` (+19 -11) 📝 `crates/horizon-client/src/mobs/goals.rs` (+11 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMobAiOracle.java` (+7 -0) 📝 `tools/port_map/game-009.tsv` (+1 -1) 📝 `tools/test_mob_ai_parity.py` (+6 -0) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Refs #3521 ## What and why The row `FollowFlockLeaderGoal` says fish do not follow a leader. That is wrong: the goal is ported (#3026, registered at priority 5 for cod, salmon and tropical fish). But no `mob_ai` scenario had more than one fish, so nothing compared it with vanilla. Three new scenarios (`cod_school`, `salmon_school`, `tropical_fish_school`: five fish in a pool for 400 ticks, no player near) did, and found: - **Who is recruited.** `FollowFlockLeaderGoal.canUse` makes the fish of its kind within 8 blocks follow the leader, `limit(getMaxSchoolSize() - schoolSize)` of them, in the order `getEntitiesOfClass` lists them: the entity sections by x, z, y, and in a section as the entities entered it. Horizon listed them in its position grid's order, so in a school capped at five (salmon) a different fish was left out than in vanilla. Mobs now note the section they are in and when they entered it (\`Mob.section\`, \`section_seq\`), and the goal sorts by them. - **The first start delay.** The goal's constructor draws it from the fish's random before the oracle seeds it; the oracle and the probe now draw it again at the same point (\`Goal::set_start_delay\`), as they do for bees. ## Proof against vanilla's Java `python3 tools/test_mob_ai_parity.py --only _school`: **3/3 scenarios, 6015/6015 mob-ticks identical** (position, motion, goals, look, path, every random draw). Before the two changes the three scenarios diverged at tick 200 to 202, where the first fish starts to recruit. The whole harness still matches: 212/212 scenarios, 67129/67129 mob-ticks. Not changed: with a player near, a salmon's `AvoidEntityGoal` diverges from vanilla (tick 185 in a first draft of the scenario with the player 12.5 blocks away); that is another goal's gap, which these scenarios leave out of the way. `pr_ready --quick`: fmt, clippy, 1064 tests and 481 python tests pass. 🤖 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 05:14:07 +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#5655
No description provided.