[FIX] Walls vanishing (stale command replay) & rock/wall tiles not merging #57

Open
agent-claude wants to merge 0 commits from claude/56-tiles-and-ghost-commands into main
Collaborator

Fixes #56

Disappearing walls: root cause

The production command log for the affected colony showed 67 wall placements, 24 CANCEL_BLUEPRINTs, the same tiles placed twice within seconds, and 5 RELOCATE_COLONY resets.

RELOCATE_COLONY reset the colony clock to tick 0, so the log mixed several timelines. On every server restart (each deploy), the server replayed every log entry dated after the snapshot tick. That included old cancels, which deleted newly placed walls at the same coordinates, and old relocations, which wiped the map and reset the clock again, feeding the cycle.

Fix:

  • Relocation keeps the tick monotonic, preserves completed research and the raid record, and sends removals for every old-map entity, so clients don't keep ghosts.
  • On load, the server replays only the crash-recovery window, up to 6 checkpoint intervals after the snapshot, and purges stale future-dated log rows. This cleans up existing production data on the next deploy.

Rock & wall tiles not merging

  • Mountain rock used a single Blender block sprite per tile, which looked like a crate grid. Wall tops repeated a plank pattern, so vertical runs looked like ladders.
  • A new shared 8-neighbour autotiler for walls and rock:
    • flat tops that run through joins
    • bevels and outlines only on open sides, with notched inner corners
    • a face only where the south side is open, plus step edges where a neighbour continues south
    • per-tile rock variants, with visible ore veins
  • Tiles re-join when neighbouring rock is mined out.
  • roundPixels prevents hairline seams at fractional zoom.

Testing

  • New server test: stale far-future CANCEL_BLUEPRINT and RELOCATE_COLONY log rows are purged and never fire, and a genuine in-window command is still recovered.
  • New sim test: relocation keeps the tick and research, and removes old entities.
  • npm test passes (92 sim-core, 6 server), typecheck is clean, and the client builds.
  • Checked a tile gallery (mountain with ore and a cave, marble, timber and slate rooms with doors, L-shapes) and the live local colony.

🤖 Generated with Claude Code

Fixes #56 ## Disappearing walls: root cause The production command log for the affected colony showed 67 wall placements, 24 `CANCEL_BLUEPRINT`s, the same tiles placed twice within seconds, and **5 `RELOCATE_COLONY` resets**. `RELOCATE_COLONY` reset the colony clock to tick 0, so the log mixed several timelines. On every server restart (each deploy), the server replayed every log entry dated after the snapshot tick. That included old cancels, which deleted newly placed walls at the same coordinates, and old relocations, which wiped the map and reset the clock again, feeding the cycle. **Fix:** - Relocation keeps the tick monotonic, preserves completed research and the raid record, and sends removals for every old-map entity, so clients don't keep ghosts. - On load, the server replays only the crash-recovery window, up to 6 checkpoint intervals after the snapshot, and **purges stale future-dated log rows**. This cleans up existing production data on the next deploy. ## Rock & wall tiles not merging - Mountain rock used a single Blender block sprite per tile, which looked like a crate grid. Wall tops repeated a plank pattern, so vertical runs looked like ladders. - A new shared **8-neighbour autotiler** for walls and rock: - flat tops that run through joins - bevels and outlines only on open sides, with notched inner corners - a face only where the south side is open, plus step edges where a neighbour continues south - per-tile rock variants, with visible ore veins - Tiles re-join when neighbouring rock is mined out. - `roundPixels` prevents hairline seams at fractional zoom. ## Testing - New server test: stale far-future `CANCEL_BLUEPRINT` and `RELOCATE_COLONY` log rows are purged and never fire, and a genuine in-window command is still recovered. - New sim test: relocation keeps the tick and research, and removes old entities. - `npm test` passes (92 sim-core, 6 server), typecheck is clean, and the client builds. - Checked a tile gallery (mountain with ore and a cave, marble, timber and slate rooms with doors, L-shapes) and the live local colony. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Disappearing walls (root cause, found in the production command log):
- RELOCATE_COLONY reset the colony clock to tick 0, so the command log
  mixed several timelines. On every server restart, entries dated after
  the snapshot tick were replayed, including old CANCEL_BLUEPRINT and
  RELOCATE_COLONY commands that fired into the new colony, deleting
  freshly placed walls or wiping the map (and resetting time again).
- Relocation now keeps the tick monotonic, preserves research and the
  raid record, and tells clients to drop every old-map entity.
- On load the server replays only the crash-recovery window after the
  snapshot and purges stale future-dated log rows (cleans existing data).

Tiles not merging:
- Shared 8-neighbour autotiler for walls and mountain rock: flat top that
  runs through joins, bevels/outlines only on open sides, notched inner
  corners, face only where the south side is open, step edges where a
  neighbour continues south. Per-tile rock variants; ore veins visible.
- Rock tiles re-join when neighbours are mined out.
- roundPixels to prevent hairline seams at fractional zoom.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Collaborator

Merge approved by @johnw via Claude Code chat on 2026-10-20: "Once you have the fix in for both, go ahead and approve merge and push"

Merge approved by @johnw via Claude Code chat on 2026-10-20: "Once you have the fix in for both, go ahead and approve merge and push"
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin claude/56-tiles-and-ghost-commands:claude/56-tiles-and-ghost-commands
git switch claude/56-tiles-and-ghost-commands

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff claude/56-tiles-and-ghost-commands
git switch claude/56-tiles-and-ghost-commands
git rebase main
git switch main
git merge --ff-only claude/56-tiles-and-ghost-commands
git switch claude/56-tiles-and-ghost-commands
git rebase main
git switch main
git merge --no-ff claude/56-tiles-and-ghost-commands
git switch main
git merge --squash claude/56-tiles-and-ghost-commands
git switch main
git merge --ff-only claude/56-tiles-and-ghost-commands
git switch main
git merge claude/56-tiles-and-ghost-commands
git push origin main
Sign in to join this conversation.
No description provided.