[PR #3712] [MERGED] Villagers: a baby that grows up gets the adult brain (Villager.ageBoundaryReached) #5163

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

📋 Pull Request Information

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

Base: main ← Head: fix/villager-grows-up-brain


📝 Commits (5)

  • 136349a Villagers: a baby that grows up gets the adult brain (Villager.ageBoundaryReached)
  • c41e95b Merge remote-tracking branch 'origin/main' into upd-3712
  • e4d8570 Merge main into fix/villager-grows-up-brain (resolve tools/test_mob_ai_parity.py)
  • 51c10dd Merge main into fix/villager-grows-up-brain (resolve tools/test_mob_ai_parity.py)
  • 6883b74 Merge remote-tracking branch 'origin/main' into upd-3712

📊 Changes

3 files changed (+30 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/mobs/ai.rs (+3 -0)
📝 crates/horizon-client/src/mobs/villager_brain.rs (+22 -0)
📝 tools/test_mob_ai_parity.py (+5 -0)

📄 Description

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

Refs #3521.

Ticks the Villager.ageBoundaryReached row of #3521 (no other open PR touches it; checked the open PR list and #3521's comments).

What and why

A villager's brain was built once, with its baby flag, so a baby that grew up kept the baby schedule (play) and never went to work. Vanilla's Villager.ageBoundaryReached calls refreshBrain at the age boundary: it stops every running behaviour, builds a new brain from the packed memories (the sensors' first scans are delayed by nextInt(rate) draws from the mob's random) and sets the schedule for the new age.

Change

  • mobs/villager_brain.rs: age_boundary_reached reuses the existing refresh (stop all behaviours, new brain from the packed memories).
  • mobs/ai.rs: called where the age passes 0, as AgeableMob.aiStep does, after the mob's serverAiStep.
  • tools/test_mob_ai_parity.py: villager_grows_up_201 and _202 (a baby with age -30 and a player nearby, 120 ticks).

Vanilla reference

Villager.ageBoundaryReached, Villager.refreshBrain, AgeableMob.aiStep.

Testing

  • Before: both scenarios diverge at the boundary tick (vanilla draws 11 times for the new brain's sensors, Horizon 2; the memories stay). After: 2/2 scenarios, 242/242 mob-ticks.
  • python3 tools/parity.py --fresh mob_ai: pass.
  • pr_ready --quick results follow in a comment; other parity harnesses are left to CI.

🤖 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/3712 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/villager-grows-up-brain` --- ### 📝 Commits (5) - [`136349a`](https://github.com/horizon-rust/horizon/commit/136349ae95669c440b472ddfde5ef18133e0fd3f) Villagers: a baby that grows up gets the adult brain (Villager.ageBoundaryReached) - [`c41e95b`](https://github.com/horizon-rust/horizon/commit/c41e95bf53bd1669598f47deb34858785d669518) Merge remote-tracking branch 'origin/main' into upd-3712 - [`e4d8570`](https://github.com/horizon-rust/horizon/commit/e4d8570fbc0cdbaf7eb4dc5959d70a1893097efc) Merge main into fix/villager-grows-up-brain (resolve tools/test_mob_ai_parity.py) - [`51c10dd`](https://github.com/horizon-rust/horizon/commit/51c10dd31dcc4aa9d027a48102814d8d996957cd) Merge main into fix/villager-grows-up-brain (resolve tools/test_mob_ai_parity.py) - [`6883b74`](https://github.com/horizon-rust/horizon/commit/6883b74274ba9b1c858991b0d133b33873181214) Merge remote-tracking branch 'origin/main' into upd-3712 ### 📊 Changes **3 files changed** (+30 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/ai.rs` (+3 -0) 📝 `crates/horizon-client/src/mobs/villager_brain.rs` (+22 -0) 📝 `tools/test_mob_ai_parity.py` (+5 -0) </details> ### 📄 Description > 🤖 Opened by Federico's AI agent (Claude), not by Federico himself. Refs #3521. Ticks the `Villager.ageBoundaryReached` row of #3521 (no other open PR touches it; checked the open PR list and #3521's comments). ## What and why A villager's brain was built once, with its baby flag, so a baby that grew up kept the baby schedule (play) and never went to work. Vanilla's `Villager.ageBoundaryReached` calls `refreshBrain` at the age boundary: it stops every running behaviour, builds a new brain from the packed memories (the sensors' first scans are delayed by `nextInt(rate)` draws from the mob's random) and sets the schedule for the new age. ## Change - `mobs/villager_brain.rs`: `age_boundary_reached` reuses the existing `refresh` (stop all behaviours, new brain from the packed memories). - `mobs/ai.rs`: called where the age passes 0, as `AgeableMob.aiStep` does, after the mob's `serverAiStep`. - `tools/test_mob_ai_parity.py`: `villager_grows_up_201` and `_202` (a baby with age -30 and a player nearby, 120 ticks). ## Vanilla reference `Villager.ageBoundaryReached`, `Villager.refreshBrain`, `AgeableMob.aiStep`. ## Testing - Before: both scenarios diverge at the boundary tick (vanilla draws 11 times for the new brain's sensors, Horizon 2; the memories stay). After: `2/2` scenarios, `242/242` mob-ticks. - `python3 tools/parity.py --fresh mob_ai`: pass. - `pr_ready --quick` results follow in a comment; other parity harnesses are left to CI. 🤖 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:10:41 +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#5163
No description provided.