Skip to content

Add undiscovered room hints with per-character known-room caching - #566

Open
Sunnyl75 wants to merge 1 commit into
MUME:masterfrom
Sunnyl75:feature/undiscovered-room-dots
Open

Sunnyl75 wants to merge 1 commit into
MUME:masterfrom
Sunnyl75:feature/undiscovered-room-dots

Conversation

@Sunnyl75

@Sunnyl75 Sunnyl75 commented Oct 27, 2026 •

Copy link
Copy Markdown

Uses the inverse of rooms.known to indicate which rooms have not been entered and marks them with a red dot. It requires a serverID to be present in the map to match.

For existing characters this list can be quite large, and takes about a minute. For new characters, it would be practically immediate. A warning pops up on first use that it may take a minute.

The first time used per character it runs in the background and adds the red dots once the list is complete. List and dots update in gameplay.

Future use will use a saved file that checks rooms.known in the background and silently updates the list.

This is set to be opt in- i.e. by default the checkbox is not selected.

This system could be built on to create fog of war.

Summary by Sourcery

Add character-aware undiscovered-room mapping hints backed by asynchronous GMCP history loading and persistent caches.

New Features:

  • Add an optional mapping hint that marks mapped rooms absent from the current character’s known-room history with red dots.
  • Support GMCP Room.Known history, live discovery updates, character/server separation, and background refreshes.

Bug Fixes:

  • Prevent stale asynchronous cache and highlight results from being applied after character, server, or display-state changes.
  • Handle malformed, incomplete, unavailable, and interrupted known-room data without replacing valid history.

Enhancements:

  • Persist per-character, per-server known-room histories in versioned JSON caches with coalesced atomic background updates.
  • Add first-use loading warnings with remembered preferences and non-blocking dialog behavior.
  • Improve asynchronous highlight invalidation so GUI updates do not block on in-flight workers.

Documentation:

  • Document undiscovered-room hints, caching behavior, limitations, and validation procedures.

Tests:

  • Add coverage for known-room protocol handling, live updates, character switching, cache persistence, corruption, server identity, and warning dialogs.

Chores:

  • Increase named-color capacity to accommodate the undiscovered-room highlight.

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implements configurable undiscovered-room hints by consuming Room.Known GMCP history, maintaining per-server/per-character cached snapshots, and asynchronously rendering red map dots with stale-result and background-I/O safeguards.

Sequence diagram for undiscovered room history and cache refresh

sequenceDiagram
    participant Server
    participant Proxy
    participant Observer as GameObserver
    participant Cache as KnownRoomsCache
    participant Renderer as MapCanvas

    Server->>Proxy: Room.Known.List
    Proxy->>Observer: observeSentToUserGmcp
    Observer->>Observer: receive
    Observer->>Cache: save
    Observer-->>Renderer: sig2_knownRoomsChanged
    Renderer->>Renderer: paintDifferences
    Renderer->>Renderer: maybeAsyncUpdate
    Renderer-->>Renderer: Render red dots for unknown server IDs

    Server->>Proxy: Room.Known.Add
    Proxy->>Observer: observeSentToUserGmcp
    Observer->>Cache: save
    Observer-->>Renderer: sig2_knownRoomsChanged
    Renderer->>Renderer: paintDifferences
Loading

Flow diagram for authoritative known-room updates

flowchart TD
    Start[Character identified] --> Load[Load per-character cache]
    Load --> Request[Request Room.Known.List]
    Request --> Receive[Receive Room.Known.List chunks]
    Receive --> Valid{Complete and valid list?}
    Valid -- No --> Keep[Keep usable cache snapshot]
    Valid -- Yes --> Replace[Replace snapshot with server truth]
    Keep --> Render[Render current discovery hints]
    Replace --> Save[Atomically save cache]
    Save --> Render
    Render --> Live[Apply Room.Known.Add updates]
Loading

File-Level Changes

Change Details Files
Add per-character undiscovered-room tracking backed by GMCP history and persistent caches.
  • Parse Room.Known list, add, and update messages into immutable room-ID snapshots.
  • Request and refresh histories on connection, character changes, and live protocol updates.
  • Persist validated per-server/per-character JSON caches with serialized background I/O, coalesced writes, atomic replacement, and stale-result protection.
  • Expose cache-miss warnings and handle incomplete, malformed, or unavailable server histories safely.
src/observer/KnownRooms.cpp
src/observer/KnownRooms.h
src/observer/KnownRoomsCache.cpp
src/observer/KnownRoomsCache.h
src/observer/gameobserver.cpp
src/observer/gameobserver.h
src/proxy/GmcpMessage.h
src/proxy/GmcpModule.h
src/proxy/MudTelnet.cpp
src/proxy/proxy.cpp
Render undiscovered mapped rooms as configurable red corner dots without blocking the GUI.
  • Add discovery state, revision, generation, and immutable snapshots to asynchronous highlight batches.
  • Reject stale highlight results across map, display-option, character, and history changes while retaining in-flight workers.
  • Give undiscovered dots precedence over unsaved-change dots and exclude temporary, invalid-ID, and unavailable rooms.
  • Reuse the existing highlight batch and texture rendering path, with GUI-thread-only OpenGL access.
src/display/mapcanvas.cpp
src/display/mapcanvas.h
src/display/mapcanvas_gl.cpp
src/configuration/configuration.cpp
src/configuration/configuration.h
src/global/NamedColors.h
Add user-facing preference, confirmation flow, and persistence for the discovery overlay.
  • Add an off-by-default graphics preference and named red highlight color.
  • Show a non-blocking first-load warning with OK/Cancel and remembered opt-out behavior.
  • Keep saved-settings and preference-page loading silent while warning on missing cache during an enabled character session.
  • Document behavior, cache limitations, protocol semantics, portability, and manual validation steps.
src/preferences/UndiscoveredRoomsDialog.cpp
src/preferences/UndiscoveredRoomsDialog.h
src/preferences/graphicspage.cpp
src/preferences/graphicspage.ui
src/mainwindow/mainwindow.cpp
docs/undiscovered-rooms.md
Expand automated coverage for protocol state, cache lifecycle, UI behavior, and asynchronous edge cases.
  • Test chunked and malformed histories, live additions, refreshes, character/server switches, disabled states, and observer notifications.
  • Test cache restart, identity separation, case folding, corruption handling, interrupted refreshes, stale-ID removal, queued writes, and shutdown flushing.
  • Test dialog defaults, cancellation, remembered warnings, and automatic deletion.
tests/TestProxy.cpp
tests/TestProxy.h
tests/TestMainWindow.cpp
tests/TestMainWindow.h
tests/CMakeLists.txt
src/global/JsonDoc.h

Possibly linked issues

  • #2716: The PR implements issue 2716’s proposed use of Room.Known to mark unknown rooms, adding red map dots and per-character caching.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the history or cache handling is wrong, the map can show incorrect discovery dots and a bad room-ID set can remain in the local cache after reverting. The authoritative GMCP list can replace it, or the cache can be cleared, so the persisted error is bounded and repairable.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

This branch has not been deployed

No deployments
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