Entry 473
fieldrand is one stream and gcmn's scrolls outlive their maps: the story maps' clouds draw on from the scene before, WORLD_MAN::Init seeds it at log in, and EA_moveTex02 and 04-07 carry across visits
Linked from A town map's signs are gcmn's data: RT01ICONPOS-RT05ICONPOS carry from visit to visit until GCMN.PRG loads again.
Files32 in 12 directories
save.rslib.rscrates/piney-data/src/area/mod.rscrates/piney-data/src/dungeon/random.rscrates/piney-data/examples/area_probe.rscrates/piney-world/src/story_map.rsfield_world.rslib.rstown.rstown02.rstown03.rstown04.rstown05.rsevarea.rsevarea01.rsevarea07.rsevarea_b0.rsevarea_b8.rsevarea_sky.rscrates/piney-fieldui/src/words.rslib.rscrates/piney-fieldui/src/menus/gate.rscrates/piney-game/src/session.rsarea.rsworld.rsstart.rscrates/piney-game/src/session/tests/mirror_world.rstools/test_area_rs.pydocs/engine/evarea.mdtown02.mdfield-walk.mdUNKNOWNS.mdMentioned incrates/piney-game/src/session/tests/mirror_world.rs:375crates/piney-game/src/session/tests/mirror_world.rs:389crates/piney-game/src/session/tests/mirror_world.rs:456
Worklog 472 left two things the sky maps did not model: the clouds' random state at their first draw, and the sky scroll across visits. The code decides both.
The clouds' generator
CLOUD::Init, SetPos and Move draw from fieldrand (MUT main
0x001b0da0). It is not the game's rand() and not ccRand. It is a
third generator: seed = (seed * 109 + 1021) mod 0xfffffffe, global
seed (0x0038aca0, 13 in the executable) and randcnt (0x0038ba00).
Scanning every gp access to seed gives its writers:
WORLD_MAN::Init(0x001b1720, inccSetupNewGame): seed =ccSys.count. It draws c % 28, b % 28 and a % 29 intoword_c1,word_b1andword_a1, then runsSimGenerateCode. It goes again (seed + 1 first) while the words make a story area ongame.server, or while the field is a lake. Thenrandcnt= 0.SimGenerateCode: seed = the code, then 13 draws. It runs at the gate menu's looks at the words,SetGenerateCode, and instruction 118 past 13.GO(1)for a generated field (0x001b5710): seed =fieldSeed. A story map gets nothing.GO(2): a new dungeon getsdungeonSeed[n](0x001b5c2c). A kept dungeon keeps the seed across its calls (0x001b5d40, 0x001b5d9c).
randcnt is read only by its own increments.
So it is one shared stream. The towns' clouds and glows draw from it, and so do the fields, the dungeons and every story map. A story map's first draws go on from the scene before. From the Chaos Gate, the Mirror World's clouds start at area 66's code, moved on by 13.
The port
One stream. SaveState::field_rand is the stream, from
Rng::POWER_ON (13, 0). Every mode takes it and hands it on:
- A town builds with it (
Town::open_with;ROOTTOWN05's constructor draws its glows from it).World::state_outhands back its class's. FieldWorld::enterhands it to the story maps throughAt.EVENTAREA01,07,B0,B8and the sky maps take it in their constructors (StoryMap::field_rand).- A kept dungeon goes on from the game's seed.
FieldWorld::state_outhands back the place's: field, dungeon, or a map that draws.
The writers.
session::log_inisccSetupNewGame. It runspiney_data::area::world_man_initwithccSys.count= the request's frame + 3:ccBreathThread(2), and one frame waiting on GCMN.PRG.- The gate menu's
generatesendsRequest::FieldSeed, which the town or field applies. The fielduiGeneratednow carries the seed. - The words' and
area n's scene changes applyAreaCode::field_rand(area::sim_field_rand).area n'sscenefollows in the same frame and puts every task to sleep, so no draw comes between.
gcmn's scrolls. EA_moveTex02 and 04-07 are gcmn.prg's data:
seven rows (evarea::scroll) in SaveState::move_tex.
story_map::buildgives a new map its rows (take_scrolls).FieldWorld::state_outwrites them back (put_scrolls).- Area 15's kept map keeps its own through the church's door.
log_in(GCMN.PRG loaded again) sets them to 0.
So a scroll lasts from log in, through every scene, until a game over or the desktop.
Checks
tools/test_area_rs.pytest_world_man_init:WORLD_MAN::Initin eemu againstworld_man_init, 300 counts across the five servers,randcnt5 before. 0 mismatches on all four volumes.area::tests::world_man_init_picks_a_plain_field: the first groups are 29, 28 and 28 words on every volume.the_mirror_worlds_clouds_draw_on_from_the_gates_words(session): Dun Loireag, the gate's words for area 66. The map'sfieldrandbefore its first stepped draw is the code's seed.the_mirror_worlds_scroll_carries_across_visits: field 66, Gate Out, back. The new map'sEA_moveTex04is the scroll the last one left; the town carries it. Log in sets it to 0.the_holy_grounds_scroll_carries_across_visits(Infection, area 15): the same forEA_moveTex02.- The three session tests fail with the map's stream back at 0 and the scrolls not taken.
- The piney-game suite (330 passed), the piney-world, piney-data,
piney-fieldui and piney-desktop tests,
test_town02_rs,test_town03_rs, clippy and fmt pass. test_evarea_rs'stest_frameserrors on a key,arms, that the game harness reports andevarea_probedoes not. This change touches neither side.
- How long GCMN.PRG's load holds
ccSetupNewGameon a console: the port's load takes one frame of the wait, soccSys.countatWORLD_MAN::Initis the request's frame + 3. On the disc it is that plus the read. - The towns' own scroll statics across visits (town02.md, 97): not gcmn's
EA_moveTexrows, left as they were. test_evarea_rs's missingarmskey inevarea_probe's frames, which this change did not touch.