Entry 578
One world, leg 1: the one World with Combat and a Cast, the town's state and logic on it behind a façade
Files10 in 7 directories
The first leg of the last piece of "One world, one area system"
(plans/rust-cleanup.md, section 2), done as a relay on the branch
one-world because the whole change has twice not fit one agent's
context. Main gets nothing until the last leg's merge passes the full
checks. This leg built the one world's shape and moved the town's state
and logic onto it; the town's piney_world::World is now a façade over
it, which the next legs remove.
What the one world is
The game has one WORLD_MAN and one task list for every area; what its
tasks hold differs. In a Root Town Kite is ccPlayer and the entry
control's NPC list holds the merchants, dogs, Grunties and walking PCs; in
a field, dungeon or story map Kite is the battle's character and the
entry control holds enemies, portals and gimmicks, with the event's NPCs
as its stand-ins. So the port's one world is the field world's core (the
old field::world::FieldWorld, now piney_world::world::World), with
combat: Combat in every area (a town's is its party's) and
cast: Box<dyn world::cast::Cast> for what differs:
BattleCast(world/cast.rs): the event NPCs' classes (FieldNpcs) and their starts, which wereFieldWorld'snpcsandnpc_shows.TownCast(town/cast.rs): the gate, Kite's arms, the town'srand, the NPC list and its queues, the town's party navigation, the Flag Race. Its methods (the town's frame,ccThGameCtrl, the entries, the party instructions, the race, the ride) take the world's core asworld.
Cast methods are the places where the world reaches its characters:
npc / npc_mut (ccEvent::GetNpc: every town NPC kind and the field's
classes are dyn event::entry::Npc, so World::char_pos, npc_command
and set_trans ask the cast), placed, npcs_frame, take_shows,
draw_npcs. The world lends itself to its cast with World::with_cast;
tests read a cast's type through <dyn Cast>::get only, as
<dyn AreaMap>::get (572).
The steps (each commit builds)
FieldWorldmoved toworld.rsasWorld.CastandBattleCast.TownPartywithout aCombat: the town's world holds the combat, and the party's queries bycharTblrow areCombat's (member_rec,member_place,member_actor,party_members, ...).- The town's world holds the core (
World::town_core, whatccSetupGameCtrlfor area 0 sets) for its shared state; the town's requests areworld::Request::Gamein the core's list. - The town's remaining fields are
TownCast, its logicimpl TownCast(a script moved 115 methods:self.w.xtoworld.x, the 38 that read no core lost the parameter); the town'sWorldforwards to it, and the event camera reads the town throughTownScene. - The
TownCastinside the core'scast(impl Cast for TownCast); the façade reaches it throughwith_town,town,town_mut, downcasts kept for the façade alone until it goes. - The town's
StartPosand its events' party entries are the core's.
What the code showed on the way
The town's own rand() and the party's combat.rand are already one
stream: the town copies its rand into combat.rand and back around
every party call (TownParty::frame, Combat::build_member, the
registry's builds in chara/party.rs), as the game has one newlib
rand() (INF SLUS_202.67:0x00133a38). The one world keeps
combat.rand alone once the two Rand types are one. World::start()
gives a town the same (pos, [0, 0, rot, 0]) its own start held
(577).
Of the town façade's 132 methods, 25 have the same body as the one
world's, 41 share a name but differ (the frame, ccThGameCtrl, the
targets by kind and code against scene indices, the party instructions,
the save out with its rand), and 66 are the town's alone: its per-system
getters and take_* queues, which the rules forbid on the one world and
which become generic events and Cast methods.
Checked
At every step the build checks (cargo check --workspace --all-targets, cargo test --no-run -p piney-world -p piney-game) and the
town's tests (piney-world world, dun_loireag, later_towns;
piney-game world::tests, kept_dummies, town_return) passed. At the
leg's end (release): cargo test -p piney-world passes (116 + 12 + 3 + 1),
the piney-game suite 347 passed, 152 ignored, as before the leg (the
suite aborts on an allocation under ulimit -v 8000000; it runs
uncapped, as the earlier legs ran it). The harness, golden shots and pins are the last leg's.
The relay's handoff (design as built, the method lists, the order of what
is left) is /mnt/data/claude/scratch/world3/HANDOFF.md.
- the town façade (
piney_world::World,World::with_town,town,town_mut) still stands: piney-game'sWorldModeandStage::Worldhold it, notworld::World - the 41 methods the town and the one world both have but do differently (the frame,
ccThGameCtrl, the targets by kind and code against scene indices, the party instructions, the save out) are not yet one method each with the cast answering what differs - the town's 66 own methods (per-system getters,
take_*queues) are not yet generic events or Cast methods - one effect host, one mode and one
HostWorldare not started TownCast.randandcombat.randare still two copies of one stream with twoRandtypes