ludic.zones: a disc per player from their fog, merged into clusters; the simulating packages ask whether a place is simulated

zones_set / zones_clear / zones_merge, zones_contains / zones_nearest and the clusters' bounding circles,
over fixed arrays of ZONES_MAX (16). WildlifeWorld.active freezes an animal outside (no state change, no
dice), NpcWorld.active a walker (and no birth outside), VehicleWorld.active a moored boat, and
ThingsWorld.restocks keeps a morning's restock inside; every default is "everywhere", so an unbound game
is unchanged. Tests: the merge (near players one cluster, far two, a player leaving splits a chain),
contains, nearest, the radius; wildlife, npc, vehicles and things pass as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 15:53:23 +03:00
parent 2958539514
commit 8b85282502
18 changed files with 257 additions and 4 deletions

View file

@ -1,5 +1,5 @@
# run.ludic - one step of every animal: the port says whether it is about at this hour; anything
# within 900 m of a player thinks; the gait follows the ground covered; player 0 sees what is near
# run.ludic - one step of every animal inside a zone (WildlifeWorld.active): the port says whether it
# is about at this hour; within 900 m of a player it thinks; player 0 sees what is near
export function wildlife_tick(wildlife_st: mut WildlifeState, dt: float, gh: float) -> void {
wl_seed_scan(wildlife_st, dt)
let all = wildlife_all(wildlife_st)
@ -9,6 +9,7 @@ export function wildlife_tick(wildlife_st: mut WildlifeState, dt: float, gh: flo
function wl_tick_one(wildlife_st: mut WildlifeState, a: WildAnimal, dt: float, gh: float) -> void {
if not a.alive { return }
if not WildlifeWorld.active(a.x, a.z) { return } # outside every zone: its state kept, no dice drawn
let about = WildlifeWorld.about(a)
if about == WILD_AWAY {
a.shown = false