Skip to content

Multiplayer: Add client-side build/sell previews and fix various issues#4839

Merged
Loobinex merged 3 commits into
dkfans:masterfrom
rainlizard:multiplayer-client-side-box-improvements9
May 26, 2026
Merged

Multiplayer: Add client-side build/sell previews and fix various issues#4839
Loobinex merged 3 commits into
dkfans:masterfrom
rainlizard:multiplayer-client-side-box-improvements9

Conversation

@rainlizard
Copy link
Copy Markdown
Contributor

@rainlizard rainlizard commented May 25, 2026

I've spotted a couple of issues with roomspace prediction. The biggest issue was that holding CTRL while holding a creature would display the 5x5 dig box even when the cursor was not over a slab. There were also a few smaller timing issues where the cursor box could switch between client-side prediction and authoritative rendering at the wrong time. Threw in some integer enum renames as well. I've refactored it to use more shared code instead of duplicated code, which will be more resilient for any future changes to roomspace that people might make. The tag/untag state also needed to be simplified.

The roomspace preview box is now 100% client-side for building/selling as well, previously it was only client-side for digging.

@rainlizard rainlizard marked this pull request as draft May 25, 2026 17:31
@rainlizard rainlizard force-pushed the multiplayer-client-side-box-improvements9 branch from 90bf4e8 to 0072ea3 Compare May 26, 2026 03:42
@rainlizard rainlizard marked this pull request as ready for review May 26, 2026 03:42
@rainlizard rainlizard changed the title Multiplayer: fixed a few issues with the roomspace prediction Multiplayer: Add client-side build/sell previews and fix various issues May 26, 2026
@rainlizard rainlizard marked this pull request as draft May 26, 2026 05:33
@rainlizard rainlizard marked this pull request as ready for review May 26, 2026 05:33
@PieterVdc PieterVdc requested a review from Copilot May 26, 2026 07:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors multiplayer roomspace/cursor preview handling to make build/sell previews fully client-side (similar to existing dig prediction) and to fix several timing/state issues in highlight/tag preview behavior.

Changes:

  • Adds client-side build/sell roomspace preview updates and reuses shared roomspace/packet-action logic.
  • Refactors dig tag/untag mode selection to be derived from roomspace state/predicted tag modes (removing the old flag-based set_tag_untag_mode path).
  • Renames/clarifies integer “mode” usage by switching call sites to roomspace_*_mode enum values and consolidating packet action handling via apply_roomspace_packet_action().

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/roomspace.h Updates APIs to pass PlayerInfo/Packet, adds preview update helpers, and exposes shared packet-action application.
src/roomspace.c Implements shared dig tag-mode derivation, highlight refactor, build/sell preview helpers, and apply_roomspace_packet_action().
src/roomspace_prediction.c Extends prediction pipeline to cover build/sell previews and refactors dig prediction to use the new shared APIs.
src/player_data.h Removes unused PlaF_ChosenSlabHasActiveTask flag and simplifies swap_to_untag_mode field comment.
src/packets.h Removes set_tag_untag_mode() declaration.
src/packets.c Routes roomspace packet actions through apply_roomspace_packet_action() and updates mode comparisons to enums.
src/packets_input.c Uses new preview helpers; removes set_tag_untag_mode() calls; updates dig cursor-tagging call signature.
src/engine_redraw.c Updates pointer graphic selection to use drag_placement_mode enum value.
src/cursor_tag.h Changes tag_cursor_blocks_dig() signature to accept PlayerInfo/Packet/RoomSpace.
src/cursor_tag.c Updates implementation to use caller-provided packet/roomspace context (supporting prediction-driven rendering).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/roomspace_prediction.c
@Loobinex Loobinex merged commit 9d225ae into dkfans:master May 26, 2026
4 checks passed
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.

3 participants