Add auto-tiling walls, multi-floor buildings, CA cave gen, and enhanced dungeons - #26
Merged
Merged
Conversation
…ed dungeons - Auto-tiling wall system (autotile.ts): walls now render as context-aware box-drawing characters (╭╮╰╯ rounded corners, ─│ runs, ├┤┬┴┼ junctions) based on neighbours. Runs at render time only — collision is unchanged. - Multi-floor buildings (towngen.ts): inns and guilds get 2 upper floors, temples get 1. Each upper floor is a subdivided layout with beds/furniture and return stairs (cyan >). Service NPCs (innkeeper, shopkeeper, healer, etc.) are ground-floor only. Generic and quest NPCs may appear on upper floors (30%/20% chance). Upper floors have a 20% chance of containing a chest. - Basements (towngen.ts): taverns (15%) and inns (10%) may have a basement (floor -1). Basements have 8% chance of monsters (with guaranteed chest), 5% chance of a quest NPC, and 15% independent chest chance. Encounter rate in basements is 20% of dungeon rate. - Floor transition (location.ts + game.ts): STAIRS_FLOOR_UP (cyan <) ascends, STAIRS_FLOOR_DOWN (cyan >) descends. game.currentFloor / currentFloorData / currentFloorEntry track the active floor. All tile/NPC/chest lookups route through the active floor data. Player.currentFloor persists through save/load. - Floor dimming (location.ts): when currentFloor ≠ 0 (upper floors or basement), tiles outside the current building's bounding box render with fg = DARK_GRAY, making the outdoor environment appear dim. - Cellular automata cave generation (dungeogen.ts): caves now use a CA algorithm (45% random fill → 4 smooth passes → keep largest connected region) for organic, non-rectangular cave shapes instead of BSP rectangular rooms. - Dungeon room variety: 10% chance of cross-shaped rooms, 10% chance of wide corridor halls, in addition to standard rectangular rooms. - New decorations: caves get CAVE_WATER pools (≈), STALACTITE drips (i), MUSHROOM (°), and CRYSTAL (*) tiles. Dungeons get RUBBLE (%) in corners and CRYSTAL on walls. Ruins now use RUBBLE instead of floor holes for a better appearance. - 7 new LOC_TILE values (24-30), updated isWalkableTile, new FloorData/BuildingFloorEntry types, DUNGEON_TILES and TOWN_TILES entries for all new tile types. All 59 existing unit tests pass. Build succeeds cleanly. https://claude.ai/code/session_01ER9P4Z8PP6r2cKjfUhoUgy
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.
Auto-tiling wall system (autotile.ts): walls now render as context-aware box-drawing
characters (╭╮╰╯ rounded corners, ─│ runs, ├┤┬┴┼ junctions) based on neighbours.
Runs at render time only — collision is unchanged.
Multi-floor buildings (towngen.ts): inns and guilds get 2 upper floors, temples get 1.
Each upper floor is a subdivided layout with beds/furniture and return stairs (cyan >).
Service NPCs (innkeeper, shopkeeper, healer, etc.) are ground-floor only. Generic and
quest NPCs may appear on upper floors (30%/20% chance). Upper floors have a 20% chance
of containing a chest.
Basements (towngen.ts): taverns (15%) and inns (10%) may have a basement (floor -1).
Basements have 8% chance of monsters (with guaranteed chest), 5% chance of a quest NPC,
and 15% independent chest chance. Encounter rate in basements is 20% of dungeon rate.
Floor transition (location.ts + game.ts): STAIRS_FLOOR_UP (cyan <) ascends,
STAIRS_FLOOR_DOWN (cyan >) descends. game.currentFloor / currentFloorData /
currentFloorEntry track the active floor. All tile/NPC/chest lookups route through
the active floor data. Player.currentFloor persists through save/load.
Floor dimming (location.ts): when currentFloor ≠ 0 (upper floors or basement), tiles
outside the current building's bounding box render with fg = DARK_GRAY, making the
outdoor environment appear dim.
Cellular automata cave generation (dungeogen.ts): caves now use a CA algorithm
(45% random fill → 4 smooth passes → keep largest connected region) for organic,
non-rectangular cave shapes instead of BSP rectangular rooms.
Dungeon room variety: 10% chance of cross-shaped rooms, 10% chance of wide corridor
halls, in addition to standard rectangular rooms.
New decorations: caves get CAVE_WATER pools (≈), STALACTITE drips (i), MUSHROOM (°),
and CRYSTAL (*) tiles. Dungeons get RUBBLE (%) in corners and CRYSTAL on walls.
Ruins now use RUBBLE instead of floor holes for a better appearance.
7 new LOC_TILE values (24-30), updated isWalkableTile, new FloorData/BuildingFloorEntry
types, DUNGEON_TILES and TOWN_TILES entries for all new tile types.
All 59 existing unit tests pass. Build succeeds cleanly.
https://claude.ai/code/session_01ER9P4Z8PP6r2cKjfUhoUgy