Files
LonaRPG-Online-Games/ModScripts/_Mods/LonaCraft/docs/RESEARCH_SEWER.md
T

188 lines
16 KiB
Markdown
Raw Normal View History

2026-10-29 21:59:06 +04:00
# R9 Sewer bases (research)
Board item R9 (owner, 2026-10-06): "I want some sewer maps as well. Sewer maps that can be built on
with our new systems. ... It should function as a dangerous place, that Lona can live at if she
has no money." Research and design only; options PROPOSED with one recommendation each.
Short forms: `F/` = `Data/Scripts/Frames/`, `E/` = `Data/Scripts/Editables/`, `HCG/` =
`Data/HCGframes/`, `LC/` = `ModScripts/_Mods/LonaCraft/Scripts/`. Map facts from the `.rvdata2`
files (scratchpad `r3/map053_events.txt`, scripts in `r3/`). Renders: scratchpad `r3/`.
## 0. Summary
| Question | Finding | PROPOSED |
|---|---|---|
| The game's sewer | One map, Map053 NoerSewer (tag map `event=NoerSewer`, 100 x 70, tileset 19): the new-game start, two quests, rats and roaches every entry, hobos after day 15; walkways 1-2 tiles wide beside sewage channels, largest open square 4 x 4 | not a good building site |
| Tileset | tileset 19 "Mack-Sewer" (and 20 "Mack-Tomb" for the catacomb cellars) use `macks_A3`: the palisade kind 70 is there, so today's Palisade already draws; the A5 sheet `macks417_Tomb_A5` is not in the floor table | add a Stone Wall piece (macks_A3 kind 77, grey stone) and the floor row `macks417_Tomb_A5 => 1570` |
| How to make a sewer buildable | A on the game's map / B the mod's own sewer map / C sewer field maps behind world-map tiles | **B**: one mod sewer map ("Deep Sewer") reached by a ladder in the game's sewer, base keyed by map name |
| Danger | nap raids with a "sewer" scenario (rats, hobos, breedlings), more at night, spawns from the tunnel mouths | numbers in 3.3 |
| Live there with no money | free entry, free nap point, everything else brought or made by hand | 3.4 |
| Build | 4 items, about 700 lines + 1 generated map | 5 |
## 1. The game's sewers
### 1.1 Maps
| Map | Name / tag | Size | Tileset (sheets A1 / A2 / A3 / A4 / A5) | Entered | Notes |
|---|---|---|---|---|---|
| 53 | NoerSewer / `event=NoerSewer`, `isUnderGround=true` | 100 x 70 | 19 Mack-Sewer: macks417_sewer_A1 / macks417_Sewer_A2 / macks_A3 / macks417_Tomb_A4 / macks417_Tomb_A5; B-E TileC_exterior417Ver, 417Mixupedd-slum, TileD_exterior2, macks417_badland_E | world-map point `-point-NoerSewer` (32,96), inside Noer's walls; the new game starts here | this report's subject |
| 60 | NoerCatacombB1Grind / `event=NoerCatacombB1Grind`, underground | 70 x 90 | 20 Mack-Tomb (same A1, A3, A4, A5 as 19; A2 macks417_Tomb_A2) | from the catacomb | catacomb cellar, same look |
| 66 | NoerCatacombB1 / `event=NoerCatacombB1`, underground | 70 x 90 | 20 Mack-Tomb | from the catacomb | same |
| 20 | NoerCatacomb / `event=NoerCatacomb` | 100 x 100 | 24 RMDLC CatacombOuta (outdoor graveyard) | world map | not sewer-like |
| 129 | NoerDockC1 (dock cellar) | 100 x 100 | 26 RMDLC INSA BSS (interior) | dock | an interior, not sewer-like |
### 1.2 Entry, exit, state (Map053)
| Point | Evidence |
|---|---|
| World-map point (32,96): "enter?" then `change_map_enter_tag("NoerSewer")`. Always open; `QuProgSewerKickMobs == 1` only shows a quest balloon | Map002 event 3 |
| A tag map: `$data_tag_maps["NoerSewer"].sample`, only Map053; not a region map | `E/34_Functions_ChangeMap.rb:200-215`; Map053 note |
| New game, game over and the credits start here | `F/5_DataManager.rb:601`, `:625`; `F/118_Scene_Gameover.rb:154`; `E/121_Scene_MapCredits.rb:920` |
| Reloaded fresh on every entry (`Game_Map#setup` loads the file); the BIOS rolls again (`ReRollHalfEvents` = 1) | `F/31_Game_Map.rb:172`; `E/34_Functions_ChangeMap.rb:214` (`change_map_story_stats_fix`) |
| `isUnderGround`: underground light | `F/31_Game_Map.rb:288`; `E/70_Game_Map_DayNightAndOvermap.rb:41` |
| Exits: the ladder (33,21) back to Noer, with the tutorial skip prompt on the first visit; the east tunnel to OrkindCave1 once the goblins were seen | `HCG/event/NoerSewerToNoer.rb:2-27`; `HCG/event/NoerSewerToOrkindCave1.rb:2-34` |
| Leaving the first time arms the hobo clock: `RecQuestSewerHoboAmt` = date + 15 days | `NoerSewerToNoer.rb:14`, `:24` |
| Quest "kick the hobos out" offered at the guild board after that date; done -> clock + 15 days again | `HCG/event/NoerTavernQuestBoard.rb:19`; `HCG/event/NoerTavernGuildEmpolyee.rb:171-178` |
| Nap (event 43): once the hobos have settled and one is alive, the nap is the hobo capture scene (rape loop, gear dropped, `HumanCave_NapGangRape.rb`); otherwise a plain `handleNap` | `HCG/event/NoerSewer_Nap.rb:2-14`, `:17-60`, `:63-71` |
| Storage chests: boxes `map_id` and `map_id + 1000` (a rake and a short sword at first) | Map053 event 1 |
### 1.3 What lives there (Map053 event 1, BIOS, every entry)
| Spawn | Count | Where | Condition |
|---|---|---|---|
| WildGiantMice (race Abomination, health 20) or the first-quest version | 8 / 10 | `region_map[1].sample` | always (first visit: quest version) |
| AnimalRoach + AnimalRattus (vermin) | 5 + 5 | `region_map[1]` | always |
| MobHumanCommoner / MobMootCommoner (hobos, health 130) | 1, or 2 + 2 while the quest runs | `region_map[1]` | after the hobo date |
| GoblinCommoner x 3 (static, the goblin room) | 3 | events 18-22 | story |
| SewerMootMother / SewerMootKid, Sandbag, traps x 4 | | events 36, 44, 71-75 | story / tutorial |
Group race for naps after the hobo date: `OnRegionMapSpawnRace = "BanditMobs"` (Map053 event 1).
NPC stats: `Data/NPCdata/WildGiantMice.json`, `WildAnimalRattus.json`, `MobHumanCommoner.json`,
`GoblinCommoner.json`.
### 1.4 Layout (Map053; `r3/sewer_map053_play.png`, regions `r3/sewer_map053_regions.png`)
| Measure | Value |
|---|---|
| Walkway tiles reachable from StartPoint (walkable, not A4 ceiling) | 335 |
| Walkways | 2 tiles wide along sewage channels (A1 kind 14, impassable), bridges and stairs between |
| Largest open square / rectangle | 4 x 4 (goblin room, (70,49)) / 14 x 2 (start corridor) |
| Regions | 1 = walkway spawn list (183, all spawns), 2 = channels (310), 3 = goblin room (41), 50 = start area (26) |
| Exit ring | none: region 1 is the SPAWN list here, not an exit ring; exits are events |
Consequence for `LC/110_Bases.rb`: its edge zone treats region 1 as the exit ring
(`LC/110_Bases.rb:885`, `:1110`), which on Map053 would refuse every walkway. Any sewer support
needs the edge rule per map kind.
## 2. Tilesets
### 2.1 Tileset 19 Mack-Sewer (`r3/sewer_a1_a2_a5.png`, `r3/sewer_a4.png`, A3 = `r3/a3_rings_1.png` macks_A3)
| Part | Content | Passable / tag |
|---|---|---|
| A1 macks417_sewer_A1 | 16 water kinds: sewage (14, olive sludge, the map's channels), dark water, blood, lava; animated like all A1 | all X, tag 0 |
| A2 macks417_Sewer_A2 | dirt, gravel, cobble, rubble, moss, blood floors, rails | O except 34 and 41 |
| A3 macks_A3 | 32 kinds: log palisade 70 (today's Palisade), grey stone blocks 77, beige brick 75, plank walls 73 | all X, tag 4 |
| A4 macks417_Tomb_A4 | stone sewer walls: tops 80-87 / 96-103 / 112-119, faces 88-95 (mossy stone, 92 used by the map), 104-111, 120-127 (123 used); top 115 = the map's black ceiling | tops O, faces X; tag 4 (top 96-103 partly 0) |
| A5 macks417_Tomb_A5 | same layout as macks_A5: planks 1568-1570 (1570 crosswise), flagstone 1584-1586, sewer floor 1554 (used 294 times) | all O but 1536 |
| B-E | TileC_exterior417Ver, 417Mixupedd-slum, TileD_exterior2, macks417_badland_E: crates, barrels, bones, grates, pipes as the map uses | |
Tileset 20 Mack-Tomb uses the same A1, A3, A4 and A5 sheets (only A2 differs), so the same table rows work there.
### 2.2 Pieces in a sewer
| Piece | Today | PROPOSED |
|---|---|---|
| Palisade Wall | draws: `macks_A3` is in the wall table (`LC/110_Bases.rb:881`, kind 70); looks like a log fence underground | keep (it is the cheap wall) |
| Stone Wall (new) | none | A3 grey stone blocks: macks_A3 77 (rendered); for the other sheets e.g. TileA3 57, Outside_POOR_A3 61, TileA3Abom 57, to be picked from `r3/a3_rings_*.png` (a second table, same 16-shape code); recipe 3 Stone Block + 1 Rope (Stone Block = 2 Rough Stone at the pot, `LC/30_Process.rb:35`); bench only |
| Plank Floor | refused: `macks417_Tomb_A5` is not in the floor table (`LC/110_Bases.rb:883-884`) | add `"macks417_Tomb_A5" => 1570` |
| Wooden Door | works (event, no tile) | keep |
Mock-up: `r3/sewer_chamber_mock.png` (left Stone Wall + planks, right today's Palisade + planks,
a sideways door in the west wall).
## 3. Making a sewer buildable
### 3.1 Options
| | A. The game's sewer (Map053) | B. The mod's own sewer map (PROPOSED) | C. Sewer field maps behind world-map tiles |
|---|---|---|---|
| How | allow bases on the tag map `NoerSewer`; record keyed by map name | a generated map "Deep Sewer" (tileset 19) with tunnels, sewage channels and 2 chambers (about 12 x 9 and 10 x 8); a ladder event added to Map053 leads down, its own ladder back | new region-style sewer field maps (`region=` note) behind new region tiles on the world map |
| Room to build | 4 x 4 at most; walls would cut the quest paths (goblin room, cave tunnel) | designed chambers | as designed |
| Game state | new-game start, quest maps, hobo capture nap (`NoerSewer_Nap.rb:2-60`): building on it mixes with story events; a death or new game drops Lona here | untouched; Map053 only gets one ladder event (injected like the home doors, `LC/100_Homes.rb:1262-1304`) | untouched |
| Base system | needs map-name keying; region 1 is a spawn list, so the edge rule breaks (1.4) | needs map-name keying (as A) and the map's own spawn and edge regions, painted by us | works unchanged (pin, revert, marker, raids) |
| Where | inside Noer's walls (the world-map point at (32,96)) | under Noer, through the game's sewer: no world-map change | world-map tiles inside Noer are refused by the allowed rule (`LC/110_Bases.rb:181`, walled boxes); outside the walls a "sewer" is odd; new region tiles on Map002 mean editing the world map at runtime |
| Danger | the game's: rats every visit, hobos after day 15, capture nap | ours: tunnel spawns + sewer raid scenario | the raid scenarios |
| Effort | small code, big conflicts | 1 map + about 700 lines | several maps + world-map edits |
Recommendation: **B**.
### 3.2 The Deep Sewer map (PROPOSED)
| Part | Spec |
|---|---|
| File | `Maps/DeepSewer.rvdata2`, generated by a script like the Stone House builder (tiles from Map053: sewage A1 14, walls A4 92 / ceiling 115, floor A5 1554, B-E clutter) |
| Size | about 60 x 45; 2 chambers (12 x 9, 10 x 8) of plain floor, 2-tile walkways along sewage channels, 3 tunnel mouths |
| Regions | 1 = tunnel-mouth spawn tiles (the edge zone keeps 2 tiles clear of them), 2 = walkways (vermin spawns), 0 = chambers (no spawns), so the whole chamber is buildable |
| Events | BIOS (underground light, `NoerSewer_begin.rb` look: music, shadows), StartPoint at the ladder, the exit ladder (back to Map053, next to the ladder down), NapEvent with the field-map command `region_map_wildness_nap` (so `LC/120_Raids.rb` hooks it) |
| Entry | a ladder event injected into Map053 on a dead-end walkway (south branch near (50,52), off the quest paths); "Climb down into the deep sewer? Leave / Climb down" |
| Map number | fixed, as the homes (`LC/100_Homes.rb:90`, 546-576): e.g. 9101 |
### 3.3 Danger (PROPOSED numbers)
| Point | Value | Evidence / note |
|---|---|---|
| Every entry | vermin as Map053: 6 WildGiantMice + 4 AnimalRoach + 4 AnimalRattus on region 2; at night +2 hobos (MobHumanCommoner / MobMootCommoner) on region 1 | Map053 event 1 |
| Nap danger | raid chance per nap 35 % by day, 60 % at night (the field maps roll `WildDangerous` against rand(100) + Survival, `E/34_Functions_RegionMap.rb:237-246`); base value bonus as `LC/120_Raids.rb` | |
| Raid scenario "sewer" (new row in `LC/120_Raids.rb` scenarios, chosen by the record's `kind`) | CommonMobs 50 (hobos), AbomBreedlingRaid 30 (breedlings), rats 30 (a mod group: 6-10 WildGiantMice), UndeadWalking 10 | groups from `E/34_Functions_RegionMap.rb:361-1115`; group scripts `HCG/encounter/CommonMobs.rb`, `AbomBreedlingRaid.rb` |
| Spawn | from the tunnel mouths (region 1), never inside the chambers' walls (the R8 enclosure rule) | `LC/110_Bases.rb:1078`, `:1159` |
| Grace | 5 s (tunnels are close) | |
| Disease / filth | the game has no sewer status effect (grep of `Data/Scripts` for sewer finds only the new-game code); none PROPOSED for now | |
### 3.4 Living there with no money
| Need | In the Deep Sewer |
|---|---|
| Entry, rent | free, no owner, no purchase |
| Sleep | the map's NapEvent (sleep anywhere, plain `handleNap`, raids possible); a Bedroll is craftable by hand and at the bench (`Recipes/Furniture_PottedPlant.json`, 2 Hide + 1 Rope) |
| Food, cooking | none there: bring food; the Cooking Fire is craftable by hand (`Recipes/Furniture_Campfire_Hand.json`); giant rats drop Raw Meat (`Data/NPCdata/WildGiantMice.json` drop_list `ItemRawMeat` 100) |
| Water | none (the sewage is impassable A1, no drink event): bring water. Option for later: a "dirty water" spot (drink, chance of sickness) |
| Storage | placed chests (per piece, `LC/90_Furniture.rb` records) |
| Materials | Planks from Wooden Clubs (by hand), Rope from plants; Stone Wall needs Stone Block (Rough Stone from boulders, `LC/45_Nodes.rb:62`) |
## 4. Persistence (tag-map bases)
| Point | PROPOSED |
|---|---|
| Record | same `lonacraft_data["bases"]` list; `"kind" => "sewer"`, `"key"` = the map file key, `"map_no"` = the fixed number, `"om" => nil`, `"region"` = a scenario id (e.g. 90) |
| Lookup | `record_for_map` already matches by key (`LC/110_Bases.rb:135`); `can_build_here?` (`:208`) gains "a fixed base map" (the Deep Sewer) beside the region-entry rule; no pin needed (the map is always the same) |
| Furniture | per map number, as now (`LC/90_Furniture.rb` records) |
| Edge zone | per map: on the Deep Sewer the zone is region 1 (tunnel mouths) + the map border, as now; Map053 itself is never a base map |
| Marker | none on the world map (the sewer is not a world-map tile); optional: a small sign event beside the Map053 ladder when a Deep Sewer base exists |
| Revert | the last piece and furniture gone -> the record goes; the map stays as it is (still dangerous) |
| Destroy-all | as now (pieces not refunded, furniture back with chest contents) |
| Save | the map number is fixed, so pieces and furniture keep their map across saves |
## 5. Build plan (PROPOSED)
| Item | What | Files | Lines (rough) |
|---|---|---|---|
| S1 | Deep Sewer map (generator script, tileset 19, regions, BIOS, NapEvent, ladders) + registration with a fixed number | `Maps/DeepSewer.rvdata2`, `LC/130_Sewer.rb` (new) | 150 + map |
| S2 | Ladder injected into Map053, entry and exit, texts | `LC/130_Sewer.rb`, `Text/<lang>/Sewer.txt` | 120 |
| S3 | Fixed-map bases: `kind` field, `can_build_here?` for the Deep Sewer, per-map edge rule, floor row `macks417_Tomb_A5`, Stone Wall table | `LC/110_Bases.rb` | 120 |
| S4 | Stone Wall piece (item, recipe, icon, build-mode list) | `LC/0_Core.rb`, `Item/`, `Recipes/`, `LC/110_Bases.rb` | 80 + data |
| S5 | Sewer scenario and vermin group in raids; nap trigger on a tag map (`region_map_wildness_nap_stats` only runs when `OnRegionMap >= 1`, `E/34_Functions_RegionMap.rb:1832`, so the sewer NapEvent sets it or calls the raid roll directly) | `LC/120_Raids.rb`, `Config/Bases.json` defaults | 200 |
Reused unchanged: tile paint and autotile, build mode, doors, enclosure spawn rule, siege driver,
furniture in bases, Destroy-all.
## 6. Choices for the owner
| # | Choice | PROPOSED |
|---|---|---|
| 1 | Where: A the game's sewer / B the mod's Deep Sewer / C sewer tiles on the world map | B |
| 2 | Entry to the Deep Sewer: a ladder inside the game's sewer / a new world-map point near the slums | the ladder |
| 3 | A Stone Wall piece (3 Stone Block + 1 Rope, bench) | yes |
| 4 | Danger: nap raid 35 % day / 60 % night, scenario CommonMobs 50 / Breedlings 30 / rats 30 / Undead 10, vermin every entry | as listed |
| 5 | Water: bring it / a dirty-water spot later | bring it for now |
| 6 | More than one Deep Sewer map later (variety) | one now |