Skip to content

Add auto-tiling walls, multi-floor buildings, CA cave gen, and enhanced dungeons - #26

Merged
phaax merged 1 commit into
mainfrom
claude/plan-graphics-dungeons-yf3nH
Mar 30, 2026
Merged

Add auto-tiling walls, multi-floor buildings, CA cave gen, and enhanced dungeons#26
phaax merged 1 commit into
mainfrom
claude/plan-graphics-dungeons-yf3nH

Conversation

@phaax

@phaax phaax commented Mar 30, 2026

Copy link
Copy Markdown
Owner
  • 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

…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
@phaax
phaax merged commit 95016b5 into main Mar 30, 2026
2 checks passed
@phaax
phaax deleted the claude/plan-graphics-dungeons-yf3nH branch March 30, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants