Repository navigation
Lay out a town's streets and square before any of it is written (game half of renderedstep/engine#103) - #402
Merged
Merged
Conversation
…s and square before any of it is written
A place with a `towns` row is a town: the engine lays its streets, square,
ways in, anchored buildings and lots out with no model, either from the
post-pull step or on the turn somebody first walks into it. Every existing
world's requests are unchanged; nothing a model reads changes on this side.
- Migration 20261204140420 CreateTowns (the generator's version), the shape
the engine's store::OPTIONAL_SHAPES pins. Town model (streets >= 0, square
true or false, the engine's room count, frontage bound and frontage side),
factory and test; Location has_one :town. Roll::FRONTAGE_SIDE (22) named.
- WorldSeed::Loader reads `town: { streets, square }` (load_towns!), both keys
in both directions, and refuses a town that is also a floor, has a parent or
a position, a street count outside 0..100, or a location in it that is
neither a building (footprint) nor a street (box). A building of a town may
carry a building's word. lay_out_rooms! skips a town, and a re-seed keeps a
laid-out town's footprint. The loader never lays a town out itself.
- WorldSeed::Exporter writes `town:` back; a laid-out town's streets, lots and
doorways round-trip as the rows they are.
- RenderedStep.lay_out_towns binds Engine::lay_out_towns, wrapped by
Playthrough::RustEngine.lay_out_towns. Update::Steps::LayOutTowns runs
before LayOutRooms, with a dry run.
- Location::Interior.entry_room and Location#laid_out? read the first child
with a box, so a town's building is never its way in.
- EngineData: location/town is one of the engine's own data files.
- Story::Doctor warns of a laid-out town with a doorway still on the town
place, an unlaid town asked to front more than any layout of it can, and a
street past four doorways.
- The map draws a town's streets and square in its plane, and each building
fronting a street as a bar on the side the street's writer is told.
- Location::Generator never sends a town place to the model. The one-room
fold moves towns.location_id and never folds a town; the playthrough
package carries towns.
- Sweep: world a-town-of-three-streets and script
a-town-laid-out-before-it-is-written, golden vendored and checks file
written; the layout and reach vector portions vendored. The walk finds a
realized room under the name it had before the step, and records the
footprint a town's layout writes.
…ipt and world are the ones the game writes The engine now stores parity/scripts/a-town-laid-out-before-it-is-written.yml re-emitted, so bin/rails engine:vendored agrees byte for byte, and its parity/worlds/a-town-of-three-streets.sql is the loader-built dump at migration 20261204140420. No engine source changed between the two pins.
Its tree differs from c724c05 only in the engine's own CI workflow; the goldens, scripts and vector portions here are 3558baa's, byte for byte.
# Conflicts: # db/schema.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
The game half of renderedstep/engine#103. A place with a
townsrow is a town. The engine lays out its streets, square, ways in, anchored buildings and lots with no model. That happens either in the new post-pull step or on the turn somebody first walks into the town. This PR carries the engine PR's "What the game needs" items 1 to 10, and pins the engine at that PR's merge commit (3558baa).20261204140420 CreateTowns, numbered bybin/rails generate migration. Its version is distinct from every migration on main (4f7ec7e, merged in here; main's20261204143219 CreateArtworkslanded after it, anddb/schema.rbcarries both). Its declaration is the shapestore::OPTIONAL_SHAPESpins.Townhasbelongs_to :location, andLocation has_one :town, dependent: :destroy.streetsis a whole number of at least 0, andsquareis true or false.Roll::FRONTAGE_SIDE(22) names.WorldSeed::Loaderreadstown: { streets, square }inload_towns!. Both keys are written in both directions, and an absentsquarewrites false.parentor a position;streetsoutside0..Town::MOST_STREETS;WorldSeed::Exporterwritestown:back. A laid-out town's streets, lots and doorways are exported as the rows they are, so a fresh load is the same town already laid out.RenderedStep.lay_out_towns(database, story_id, dry_run)callsEngine::lay_out_towns, andPlaythrough::RustEngine.lay_out_townswraps it.Update::Steps::LayOutTownsruns beforeLayOutRooms.WorldSeed::Loader#lay_out_rooms!skips a town. The loader never lays a town out itself.Location::Interior.entry_roomandLocation#laid_out?take the first child with a box. A town's building is never its way in.EngineData.location/townis one of the engine's own data files, listed next tolocation/sizeintest/models/engine_data_test.rb.town_doorway_left_on_the_town: a laid-out town that still has a doorway on the town place.town_with_more_than_it_can_front: a town not yet laid out that has more ways in and buildings than any layout of it can front.street_past_four_doorways: a street with more than four doorways.Location::Generatornever sends a town place to a model. Two other places learned abouttowns:towns.location_idand never folds a town;towns.lib/engine_sweep/worlds/a-town-of-three-streets.ymlandlib/engine_sweep/scripts/a-town-laid-out-before-it-is-written.yml.layoutandreachvector portions.SCRIPT=a-town-laid-out-before-it-is-written bin/rails engine:checks.parity/recordsandparity/worldsfiles itself.Post-update step
This PR adds
Update::Steps::LayOutTownstoUpdate::REGISTRY.bin/updatelays out every stored town that has no streets yet. It makes no model call, and a second run finds nothing to do.What a model is sent
On this side, nothing changes.
bin/rails engine:kept_requestspasses.bin/rails eval:realization_digestmatches the checked-in baseline's message, corpus and branch-request identities.The new street wording is the engine's, in the engine PR.
The world dump
I loaded
a-town-of-three-streetsthrough the loader with the parity README's procedure and dumped it. The engine'sparity/worlds/a-town-of-three-streets.sqlat3558baais that dump, byte for byte, at migration20261204140420.Checks
All run with both provider keys unset.
bin/rails test: 5597 runs, 0 failures, 1 skip (main's Ren'Py export lint, which needsTA_RENPY_SDK). This includesrake game:sweep.bundle exec rubocop: no offenses.bin/rails zeitwerk:check: all good.bin/brakeman --no-pager: no warnings.bin/rails engine:rust_gates: all 116 scripts pass.bin/rails engine:kept_requests: passes.bin/rails engine:vectors: only the two vendored portions differ from main.bin/rails engine:vendored: the goldens, the scripts and the engine's own vector portions are3558baa's, byte for byte.