Entry 560

Towns as defs and systems: TownDef, the map's systems and one runner, every Root Town made of them

Files43 in 14 directories
crates/piney-data/src/classes.rscrates/piney-game/src/session.rsworld.rscrates/piney-game/src/session/tests/dun_loireag.rskept_dummies.rsmirror_world.rsranch_music.rsshop_keeper.rsshrine.rsside_events.rstown06.rstown_walk.rscrates/piney-gen/src/classes.rscrates/piney-world/examples/carmina_gadelica_probe.rsdun_loireag_probe.rsgrunty_probe.rsmerchcam_probe.rsworld_probe.rscrates/piney-world/src/area.rslib.rssystems/crates/piney-world/src/chara/party.rscrates/piney-world/src/event/mod.rscrates/piney-world/src/grunty/race.rscrates/piney-world/src/story_map/sky.rstruths_core.rscrates/piney-world/src/town/carmina_gadelica.rsdun_loireag.rsfort_ouph.rslia_fail.rsmac_anu.rsmerchant.rsmod.rsrelic_city.rsride.rscrates/piney-world/tests/dun_loireag.rsworld.rsdocs/engine/evarea.mdfield-game.mdroot-towns.mdstatics.mdtown02.mdplans/rust-cleanup.md

Mentioned inplans/rust-cleanup.md:296plans/rust-cleanup.md:539

Section 2's towns item (plans/rust-cleanup.md, "Towns: step_scrolls, Sky ..."), built the way the bosses were (worklog 537-556) and the way the maintainer's rule asks: a town is a definition naming its systems and its Draw's order, each system a real object, its draws generic requests. Nothing a town computes or draws changed.

The def

town::TownDef, one static a town (a def is its address), each BASE_TOWN with its differences: no, class (TownGameClass, now generated beside BossGameClass: ROOTTOWN and its six), name, volumes, file and crisis_file, tables (Infection's for the first five on every disc, Quarantine's for the sixth), the light animation and table, fog, clear colour, start (SetCharPosition's place, None for the sixth: StartPos keeps the scene before's), systems and order. town::TOWNS is GO(0)'s switch; Town::build reads the AreaCore (AreaCore::read, which the story maps on the old Base use too) and builds each SystemDef. fieldrand is held when one of its systems draws from it (SystemKind::FIELD_RAND: clouds, the airship, the glows), as the four towns that set it did.

The systems (piney_world::systems)

systemwhattowns
ModelsSTATICMODELs of a table, on its layerall
ObjectsSTATICOBJECTs, stepped within their clip01, 02, 04
ScrollsDrawBG's scrolls, take / put from their slotall
SkyDrawBG's clumps: at the origin or a dummy, on a layer (Dun Loireag's cloud layer by volume), materials offset by a scroll (MatScroll: U, V or both); the crisis clumps among them, made only in crisisall
WaterWaterDef: its file, anim, model, reach, root, WaterSpec, slot, the waters drawn, their layer, the copy01, 02, 03
CloudsCLOUDs, made by the first Draw02, 04
LensFlareLENSFLARE at its sun's dummy02, 04
MacAnuMac Anu's Clip: clip[3] and the rows and objects DrawObj2, DrawObj, DrawFloor draw by it01
AirshipCarmina Gade's AIRSHIP03
GlowsLia Fail's omni points' glows05

The plan's Sky for "the clouds and the flares" is the game's two classes, Clouds and LensFlare; Sky is DrawBG's clumps with the crisis sky. Mac Anu's ships are its type-0 static objects; Dun Loireag's ranch is the world's Grunties, which its Draw never touches.

A step is Run(kind, hook) (Draw, Start, Clip, Pass(pass), Rows, PassBelow), Map (DrawMap) or Seq: PASSES (DrawObj2, DrawObj, DrawFloor with their objects, the old Base::passes) and DRAW_BG. A town without a step's system has nothing to step (Lia Fail's passes have no objects). Each town's order is its Draw's, for example Carmina Gade's:

Water (0, the copy), Airship, Scrolls, Sky, Models(Obj2), Models(Obj),
Models rows 0-7, rows 29-33 without fog, type-0 rows below 29 without
fog, Map

The runner and the requests

Town::step(view) walks the order; a system steps with the core (file, fieldrand, the volume), the view, the frame and the events, and reaches a sibling only by kind (Others: the sky reads the scrolls, Mac Anu's clip the models and objects). What it shows goes into the frame as Drawn::Piece(kind, piece); Town::requests turns each into a generic Request (models at a matrix, a ccAnm with an edited model, a sprite) and the world paints them with systems::paint, the same for every town. Tests and probes read a system by kind (Systems::get::<T>()). Gone: Base, Spec, RootTown, each town's struct, Piece, select and draw_pieces, Town::class and parts_mut, water0_draw, crisis_rows, and the town-number arms of town_start, town_ported and the game's title (TownDef::name).

Found on the way

tools/eemu_rs.so predated worklog 557's grow, so test_map_rs and test_dungeon_rt failed on every volume at HEAD; rebuilt from piney-eemu --features python.

Checks

  • Golden shots, recorded at 9025c45 and after, every PNG byte for byte: town_shots of towns 0-4 on Infection and Outbreak and town 5 on Quarantine, pc_menu_shot, dun_loireag_shots, grunty_shots, mac_anu_chat_shots, ride_shots, flag_race_shots, breeder_race_shot, mirror_world_shots, staff_roll_shots, hopeless_nothingness_shot, event_11_shots, shop_keeper_shot, shrine_map_shots, gate_hack_arrival_shots, tolerance_shots.
  • Against the game, on all four volumes, as at 9025c45: test_town02_rs, test_town03_rs, test_world_rs, test_lights_rs, test_gate_out_rs, test_party_rs, test_grunty_rs, test_merchcam_rs, test_race_rs, test_map_rs, test_evarea_rs, test_field_ambient_rs, test_field_rt, test_dungeon_rt, test_area_rs.
  • piney-world's, piney-data's, piney-desktop's, piney-battle's, piney-effect's and piney-event's tests, piney-game's suite (release).
  • piney-gen gen --check, clippy with all features (too_many_arguments 149, one fewer; no dead_code allows), fmt, cairns check, tools/docs.py check.

Still unknown: nothing. Left for the next steps: the minimap's per-town DrawMap arms (map::town::TownMap) are the next system, then the story maps' and fields' clouds, flares and scrolls on these systems.