[PR #1159] [MERGED] Axolotl: free water paths, flat walk targets and the attack sound (idle swim and play dead match vanilla) #3374

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

📋 Pull Request Information

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

Base: main ← Head: fix/axolotl-idle-swim


📝 Commits (1)

  • 49a224d Axolotl: free water paths, flat walk targets and the attack sound

📊 Changes

3 files changed (+18 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/mobs/ai.rs (+8 -2)
📝 crates/horizon-client/src/mobs/aquatic.rs (+3 -0)
📝 tools/test_mob_ai_parity.py (+7 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #64, reported by Online5277 with the two replay scenarios this PR adds to the mob AI harness.

What

#64's replays show axolotls diverging from vanilla at tick 1: vanilla picks an idle swim target and Horizon doesn't. Three differences from vanilla's Axolotl caused it, and all three are fixed here:

  1. Water malus (mobs/aquatic.rs). Axolotl() calls setPathfindingMalus(PathType.WATER, 0.0F); Horizon didn't.
    • Horizon kept the default water malus of 8.
    • DefaultRandomPos rejects candidates with a malus (GoalUtils.hasMalus), so every swim target in water failed.
    • The idle RandomStroll.swim therefore never set a walk target. The random draws were identical (31 a tick); only the result differed.
  2. Walk target value (mobs/ai.rs). Axolotl.getWalkTargetValue returns 0 everywhere. Horizon used Animal's light-based value, so RandomPos.generateRandomPos kept the brightest of its ten candidates instead of the first.
  3. Attack sound (mobs/ai.rs). Axolotl.playAttackSound plays entity.axolotl.attack at volume 1 and pitch 1 when a bite lands, and Horizon played nothing.

Harness

tools/test_mob_ai_parity.py gets the issue's two scenarios.

  • axolotl_hunting: an axolotl and a no-AI cod, 45 ticks.
  • axolotl_play_dead: an axolotl hit for 1 every 12 ticks, 300 ticks. With these seeds it plays dead for 177 ticks in vanilla. The issue's 8 hits every 22 ticks never triggered it in vanilla (each hit has a 1/9 chance until health drops below half).
  • The pool is sunk into the ground (y −63..−61) instead of standing on the grass as in the issue.
    • The oracle's server ticks fluids and the probe doesn't. An open pool's water flows out in vanilla only, which was the "unequal replay setup" the issue suspected: vanilla accepted a swim target one block past the pool edge.
    • The bottom stays above y −64: with the bedrock replaced, the axolotl swam out of the world in both games.
mob-ticks matching before the first divergence
main 26 / 393 (both axolotls diverge at tick 1)
this PR 393 / 393 (both scenarios match on every tick, sounds included)

How tested

cargo fmt --all -- --check                                   OK
set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings
                                                             Finished, no warnings
cargo test -p horizon-client                                 971 + 84 + 15 + 2 + 2 + 2 + 1 passed, 0 failed
tools/test_mob_ai_parity.py --only axolotl                   2/2 scenarios match entirely; 393/393 mob-ticks
tools/parity.py --changed origin/main (branch)               100 passed, 1 failed (online_mode) in 126.1 min
tools/parity.py online_mode (branch, rerun)                  1 passed
tools/parity.py online_mode (plain origin/main)              1 passed (after the runner's fresh retry)

The one online_mode failure was a single check: vanilla's server log had an extra Tester moved too quickly! line. That's a timing flake on a loaded machine, and the PR doesn't touch player movement. The harness passed on a rerun of the branch, and it passed on main.

What needs Ludovic

Nothing to decide. Axolotls now wander in water when idle instead of hovering in place.

🤖 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/1159 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/axolotl-idle-swim` --- ### 📝 Commits (1) - [`49a224d`](https://github.com/horizon-rust/horizon/commit/49a224df9fb0a3762643c942c5ac9c9a67737e0c) Axolotl: free water paths, flat walk targets and the attack sound ### 📊 Changes **3 files changed** (+18 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/ai.rs` (+8 -2) 📝 `crates/horizon-client/src/mobs/aquatic.rs` (+3 -0) 📝 `tools/test_mob_ai_parity.py` (+7 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #64, reported by **Online5277** with the two replay scenarios this PR adds to the mob AI harness. ## What #64's replays show axolotls diverging from vanilla at tick 1: vanilla picks an idle swim target and Horizon doesn't. Three differences from vanilla's `Axolotl` caused it, and all three are fixed here: 1. **Water malus** (`mobs/aquatic.rs`). `Axolotl()` calls `setPathfindingMalus(PathType.WATER, 0.0F)`; Horizon didn't. - Horizon kept the default water malus of 8. - `DefaultRandomPos` rejects candidates with a malus (`GoalUtils.hasMalus`), so every swim target in water failed. - The idle `RandomStroll.swim` therefore never set a walk target. The random draws were identical (31 a tick); only the result differed. 2. **Walk target value** (`mobs/ai.rs`). `Axolotl.getWalkTargetValue` returns 0 everywhere. Horizon used `Animal`'s light-based value, so `RandomPos.generateRandomPos` kept the brightest of its ten candidates instead of the first. 3. **Attack sound** (`mobs/ai.rs`). `Axolotl.playAttackSound` plays `entity.axolotl.attack` at volume 1 and pitch 1 when a bite lands, and Horizon played nothing. ## Harness `tools/test_mob_ai_parity.py` gets the issue's two scenarios. - **`axolotl_hunting`**: an axolotl and a no-AI cod, 45 ticks. - **`axolotl_play_dead`**: an axolotl hit for 1 every 12 ticks, 300 ticks. With these seeds it plays dead for 177 ticks in vanilla. The issue's 8 hits every 22 ticks never triggered it in vanilla (each hit has a 1/9 chance until health drops below half). - **The pool is sunk into the ground** (y −63..−61) instead of standing on the grass as in the issue. - The oracle's server ticks fluids and the probe doesn't. An open pool's water flows out in vanilla only, which was the "unequal replay setup" the issue suspected: vanilla accepted a swim target one block past the pool edge. - The bottom stays above y −64: with the bedrock replaced, the axolotl swam out of the world in both games. | | mob-ticks matching before the first divergence | | --- | ---: | | `main` | 26 / 393 (both axolotls diverge at tick 1) | | this PR | **393 / 393** (both scenarios match on every tick, sounds included) | ## How tested ``` cargo fmt --all -- --check OK set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings Finished, no warnings cargo test -p horizon-client 971 + 84 + 15 + 2 + 2 + 2 + 1 passed, 0 failed tools/test_mob_ai_parity.py --only axolotl 2/2 scenarios match entirely; 393/393 mob-ticks tools/parity.py --changed origin/main (branch) 100 passed, 1 failed (online_mode) in 126.1 min tools/parity.py online_mode (branch, rerun) 1 passed tools/parity.py online_mode (plain origin/main) 1 passed (after the runner's fresh retry) ``` The one `online_mode` failure was a single check: vanilla's server log had an extra `Tester moved too quickly!` line. That's a timing flake on a loaded machine, and the PR doesn't touch player movement. The harness passed on a rerun of the branch, and it passed on `main`. ## What needs Ludovic Nothing to decide. Axolotls now wander in water when idle instead of hovering in place. 🤖 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:03 +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#3374
No description provided.