Skip to content

Let enemy workers claim room tiles (DK2-style), behind a config switch - #35

Merged
tomluchowski merged 4 commits into
tomluchowski:shaders-improvementfrom
Upabjojr:split/claimable-rooms
Aug 28, 2026
Merged

Let enemy workers claim room tiles (DK2-style), behind a config switch#35
tomluchowski merged 4 commits into
tomluchowski:shaders-improvementfrom
Upabjojr:split/claimable-rooms

Conversation

@Upabjojr

@Upabjojr Upabjojr commented Aug 6, 2026

Copy link
Copy Markdown

Proposal 4 of the set following the mechanics discussion in #23 — the "rooms claimable" (DK2-style) side of the "claimable or destructible" question, as a prototype to play-test, off by default.

Builds on top of the square-by-square bridge PR (#34) and generalizes its tile-transfer machinery: enemy workers can dance enemy room tiles down one at a time, exactly like ground tiles and (now) bridge tiles. When a room tile falls it moves into a room of the same type owned by the claimer — merging with an adjacent room of theirs when there is one — and the victim's room splits if it was cut in two. Room-level state is shared out through the existing splitRoom hook, so e.g. a treasury tile takes its share of the stored gold with it (and merges it back into the claimer's treasury on absorption).

Because Tom explicitly wanted a community discussion on this one, the whole mechanic is gated behind a config switch in rooms.cfg, with three settings:

RoomsClaimableByEnemies	0    # rooms cannot be claimed, only destroyed (pristine ODP, shipped default)
RoomsClaimableByEnemies	1    # workers can claim room tiles, fighters can still destroy rooms
RoomsClaimableByEnemies	2    # only workers can take a room, tile by tile; fighters leave rooms alone

0 keeps today's behaviour. 1 is the DK2-ish mode where conquest is possible and reversible — you can dance your dormitory back after driving the enemy out — while rooms can still be razed. 2 (Tom's request below) takes destruction off the table: a room in this mode is not attackable, so fighters skip it when picking targets and stray damage (boulders, area spells) is dropped in Room::takeDamage; the only way it changes hands is being danced away. Workers still only reach tiles at the border of fully-claimed ground, so a room deep in enemy territory erodes from the edge inward, which in practice makes claiming slower than destruction unless the area is secured.

Portals keep their own whole-room claiming, bridges their per-tile claiming; the dungeon temple is excluded from claiming (losing it means defeat and that path expects destruction).

Points for the Discord/community discussion this is meant to feed:

  • Tom's concern that claimability handicaps aggressive players cuts both ways: with the switch on, what you lose can be danced back; with it off, destruction is final for the owner but the attacker gains nothing either. Having both mechanics live (rooms destructible and claimable, like DK2) and tuning HP/claim speed may be the sweeter spot — this PR plus the room-HP one (Give room tiles configurable hit points per room type #33) makes that combination available for testing.
  • Claim speed per room type could be made configurable later (<RoomName>ClaimValue) if the flat 1.0-per-tile feels wrong.

Validated: builds, full test suite passes via ctest, both with the switch off (default behaviour unchanged) and on.

🤖 Generated with Claude Code

The DK2-style side of the claimable-or-destructible question: when
RoomsClaimableByEnemies is set to 1 in rooms.cfg, enemy workers can
dance room tiles down one at a time, the way they already claim ground,
bridges and traps. A claimed tile moves into a room of the same type
owned by the claimer, merging with an adjacent room of theirs, and the
victim's room splits when it is cut in two. Room-level state travels
through the existing splitRoom hook, so a treasury tile takes its share
of the stored gold with it. What was lost can be danced back.

The switch ships as 0: default behaviour is exactly as before, rooms
can only be destroyed. The dungeon temple is never claimable since
losing it means defeat and that path expects destruction. Portals keep
their whole-room claim, bridges their per-tile claim.

The per-tile claim progress moves from BridgeTileData into the base
TileData so every room type shares it; TrapTileData keeps its own field
of the same name until trap serialization can move too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tomluchowski

Copy link
Copy Markdown
Owner

Great job, except one cannot visually estimate which room belongs to whom when playing game.

This would be a large drawback,I will have to work on that SOMETIME.
( for example only Training rooms contain some hints in the terms of color of hanged shields on walls)....

@Upabjojr

Copy link
Copy Markdown
Author

Fixed in #37 — room floors now carry the owning seat's colour, the same way claimed ground does. Every room floor material runs through the shared Room.frag, which now blends the floor texture towards the owner's colour via the same per-seat material clone that already colours claimed tiles (Treasury — also the temple floor — was the last one on the fixed-function path, so it moved onto the shared shaders too). On the ForgottenTreasures2 level, seat 1's temple and treasury shade red where seat 2's shade green, in the editor and in-game.

That PR stands on its own (the ambiguity already exists today with enemy rooms seen through vision), so it doesn't need to wait for the claimable-rooms decision — but with it merged, this PR's claimed squares recolour one by one as they change hands, which is exactly the feedback the mechanic was missing. The blend weight (currently 0.5) is a single knob if you want the tint subtler or louder, and the look can be switched to a claimed-style cross overlay instead of a whole-floor tint if you prefer.

Issue tomluchowski#42 asks for explicit types instead of auto.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tomluchowski

Copy link
Copy Markdown
Owner

Still .... With this on, my fighters still are in the spearhead when attacking. That means they reach the enemy rooms first and destroy them , so from the actual point of gameplay not much has changed. If there could be a third switch like :
0 -- the pristine state of ODP
1 -- reclaimable tiles and destructible tiles
2 -- only reclaimable tiles by kobolds/drones

With rooms both claimable and destructible, fighters at the spearhead
still reach enemy rooms first and destroy them, so in practice little
changed. RoomsClaimableByEnemies now takes three values: 0 keeps the
historical behaviour (destroy only), 1 allows both, and 2 lets only
workers take a room, tile by tile — rooms in that mode are not
attackable, so fighters skip them when choosing targets, and damage that
bypasses target selection is dropped in Room::takeDamage. The dungeon
temple, which cannot be claimed, stays destructible in every mode since
destroying it is how a player is defeated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Upabjojr

Copy link
Copy Markdown
Author

Done in 81cbc4fRoomsClaimableByEnemies in rooms.cfg is now the three-way switch you describe:

RoomsClaimableByEnemies	0    # rooms cannot be claimed, only destroyed (pristine ODP)
RoomsClaimableByEnemies	1    # workers can claim room tiles, fighters can still destroy rooms
RoomsClaimableByEnemies	2    # only workers can take a room, tile by tile; fighters leave rooms alone

In mode 2 a room reports itself as not attackable, so fighters never pick it as a target — that is the same check CreatureActionFight and GameMap::getEnemyForces already use, so the spearhead walks past enemy rooms and fights creatures instead. Damage that does not go through target selection (a boulder rolling through, an area spell) is dropped in Room::takeDamage as well, so a room in this mode only ever changes hands by being danced away.

One exception I had to keep: the dungeon temple cannot be claimed (that was already the case), so in mode 2 it stays destructible — otherwise no game could ever be won. If you would rather the temple be claimable too, say so and I will look at what the defeat path needs for that.

Note for when this and #33 both land: <RoomName>HP = 0 there makes an individual room type indestructible in any mode, so the two knobs combine (per-type off switch on top of the global mode). Both add an isAttackable override to Room, so whichever merges second will need a small conflict resolved; I will take care of that.

Verified: builds, ctest passes (room, room-split, creature and trap tests).

@tomluchowski
tomluchowski merged commit 8735e0c into tomluchowski:shaders-improvement Aug 28, 2026
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