Skip to content

Give room tiles configurable hit points per room type - #33

Open
Upabjojr wants to merge 1 commit into
tomluchowski:shaders-improvementfrom
Upabjojr:split/room-hp
Open

Give room tiles configurable hit points per room type#33
Upabjojr wants to merge 1 commit into
tomluchowski:shaders-improvementfrom
Upabjojr:split/room-hp

Conversation

@Upabjojr

@Upabjojr Upabjojr commented Aug 6, 2026

Copy link
Copy Markdown

Proposal 2 of the set following the mechanics discussion in #23 (#23 (comment)) — the "rooms destructible" side of the "claimable or destructible" question.

Rooms are in fact already destructible today: enemy fighters (not workers) target visible enemy rooms, damage them tile by tile, and a tile at 0 HP is removed from the room — with the recently merged room splitting (#23) even cutting a room in two. But every tile of every room has a flat Building::DEFAULT_TILE_HP = 10.0, which a mid-level creature removes in a couple of swings, and there is no way to tune it. As a mechanic it exists but has no knobs.

This PR gives it knobs: Room::getTileHP() reads <RoomName>HP from rooms.cfg (e.g. DormitoryHP, TreasuryHP, DungeonTempleHP), falling back to the old 10 when an entry is missing, so older config files keep working. Shipped defaults make rooms meaningfully sturdier than a creature (30–50 HP per tile, 100 for the dungeon temple) — first-guess numbers, meant to be argued about in the config file rather than in code.

Notes for the design discussion:

  • A destroyed room tile stays claimed by its old owner (Building::removeCoveredTile does not unclaim), so the owner can rebuild on it cheaply, while the attacker would still have to dance the ground afterwards. Destruction is therefore already less "permanent" than it sounds — the owner loses the building and half the gold, not the territory.
  • Repair (Room::repairRoom) is currently only ever called by the AI keeper; human players just re-buy tiles. Making repair a player action could be a follow-up if the destructible route is chosen.

This proposal is independent of the others in the set: it can be merged alone, together with the traps one (#32), or alongside the claimable-rooms prototype — the mechanics compose (some rooms could be claimable and all of them destructible, DK2-style).

Validated: builds and the full test suite passes via ctest.

🤖 Generated with Claude Code

Enemy fighters already attack and destroy rooms tile by tile, but every
tile of every room had the same flat Building::DEFAULT_TILE_HP = 10 --
a couple of swings from a mid-level creature -- and there was no way to
tune it. Room::getTileHP() now reads <RoomName>HP from rooms.cfg (e.g.
DormitoryHP, DungeonTempleHP) through a new
getRoomConfigDoubleOrDefault that falls back to the old value of 10
when the entry is missing, so older config files keep working.

The shipped values make rooms meaningfully sturdier than a creature and
the dungeon temple the hardest to bring down; they are meant to be
argued about in the config file, not in code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant