[Feature] Mapper: surface map-file parse errors and room-mismatch details in the game window

Open
#391 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp
Domain
desktop

Research direction

Start with the swallowed exceptions in MapZoneRepository.Load, ZoneRoomIndex.Scan, and MapperViewModel (TryAutoLoadZoneFor and LoadSelectedZone), then the mismatch path in src/Genie.Core/Mapper/AutoMapperEngine.cs. Done means a malformed Map*.xml produces a game-window [mapper] line with file and line/column, and an exits mismatch names the nearest candidate and the differing exits. The issue spans several subsystems and includes design choices, so confirm the scope with maintainers before starting.

Written by the indexing model from the issue text.

Description

area:mapper enhancement est:1-2d P2

Summary

Two related pieces of mapper feedback from Discord (Miskton, 2026-11-06), raised while preparing a community map PR:

  1. Map-file parse errors should be consistent and prominent. If one of the Map*.xml files in the Maps directory fails to parse, the user should get a clear notice saying which file and why — not a silently missing zone.
  2. Room mismatches need more information. The Genie 4 mapper at least echoes a room-description mismatch; a mismatch on exits silently fails to match in both clients. Map authors iterating on a new map need to see what the mapper saw vs. what the map file says, so they can fix the file.

"some more consistent and prominent notices if there's a parsing error in an XML file would probably be helpful. And maybe some more information about room mismatches. It seems like the G4 mapper at least is moderately good about showing a room description mismatch, but if there's a mismatch on exits it may just silently fail to match."

Context: the new-map PR is in GenieClient/Maps (likely https://github.com/GenieClient/Maps/pull/268, Hollow Eve 2026). The author did multiple passes over every room fixing matching issues by trial and error — exactly the loop better diagnostics would shorten.

Current behaviour (Genie 5, beta.9.10.1)

Part 1 — map-file parse errors are swallowed

Every path that reads a zone XML drops the exception, so a map with a stray &, an unclosed tag, or a bad encoding just vanishes:

Path What happens on a malformed file
MapZoneRepository.Load catch { return null; } — the XmlException (which carries file line/column) is discarded
Genie4MapImporter.ImportDirectory catch { /* skip malformed files */ }
ZoneRoomIndex.Scan "unreadable zones are skipped" — no count, no names
MapperViewModel auto-detect index build catch { continue; } then if (zone is null) continue; — the zone silently drops out of cross-zone auto-detect, so #goto into it and arrival auto-switch both fail with no hint why
MapperViewModel.LoadSelectedZone LoadStatus = "Could not load {file}.xml" — no reason, and only shown in the mapper panel's small grey status line, never in the game window

The auto-detect summary line ("Indexed for auto-detect: N fingerprints, M server ids") does not say how many files were skipped.

Only MapsUpdater does this well — per-file errors are collected and reported in the update summary.

Genie 4 for comparison: AutoMapper.RoomOnDisk echoes [AutoMapper] Invalid maps in genie map directory: <file> {message} straight into the game window. Genie 5 has no equivalent.

Part 2 — room-mismatch diagnostics are hidden

The engine matches a room through tiers (server id → graph walk → title+exits fingerprint → reverse arc → description-only → title + any-exit-overlap). When nothing matches:

  • The engine fires RoomNotFoundInZone; the app answers with LoadStatus set to either No local zone contains "<title>" with exits … or Engine can't match "<title>" (exits: …) in '<zone>'.
  • That text appears only in the mapper panel's 10pt status line (and in the Live Audit log if that is on). It never reaches the game window.
  • The [mapper] -> NO MATCH in zone … echo and the per-move match-tier echo exist, but only under #config mapperdebug.
  • A description mismatch where title+exits still match uniquely is accepted silently — no notice at all, which is the one case Genie 4 does announce ([AutoMapper] Room description mismatch #id).
  • An exits mismatch (title matches, zero compass-exit overlap, description differs) produces the "can't match" status above — and nothing says which exits differed. Genie 4 does not check exits at all (// Check exits here in a later version), so a map author gets no help from either client.

Net effect: when a freshly authored room fails to match, the player sees the map view stop following them and nothing else. The information needed to fix the map file (expected title/exits/description vs. what the file holds for the nearest candidate) is computed but discarded.

Proposed

Part 1 — parse errors

  • MapZoneRepository.Load keeps returning null for callers, but records the failure (file name + XmlException message incl. line/column) on a LastLoadError / out-param, or exposes a TryLoad(path, out zone, out error).
  • Every directory scan (auto-detect index, ZoneRoomIndex.Scan, ImportDirectory) collects the skipped files and the app echoes one [mapper] system line per bad file into the game window at connect/scan time, e.g. [mapper] Skipped Map123_Foo.xml: '=' is an unexpected token. Line 418, position 27.
  • The "Indexed for auto-detect" summary appends , N file(s) skipped (see above) when N > 0.
  • LoadSelectedZone failure includes the reason and also echoes to the game window.

Part 2 — mismatch feedback

  • On a no-match in a zone that the index says should contain the room, echo a [mapper] line to the game window (not just the status strip) naming the nearest candidate(s) by title and showing the live exits vs. the node's exits, and whether the description matched. Example:
    [mapper] Room "Hollow Eve Festival, Midway" not matched in Map1_Crossing. Nearest: #4120 (exits in map: n, s, w — live: n, e, s; description differs).
  • Keep this on by default (it only fires on a miss), with the existing #config mapperdebug still owning the verbose per-move tier trace.
  • Optional parity nicety: when a match succeeds on title+exits but the description differs, echo Room description mismatch #id like Genie 4 does, gated behind a #config mappernotify / Record-mode so it does not spam normal play.

Verification

  • Drop a deliberately broken Map999_Test.xml (unclosed tag) into Maps, connect: expect a [mapper] Skipped … line with line/column, and the index summary showing 1 skipped.
  • Edit a known room's exits in a copy of a map, walk into it: expect the mismatch line naming the candidate and the differing exits.
  • #config mapperdebug true still produces the full tier trace; off by default produces only the miss/skip lines.

Related

  • Map room-matching tiers and the lookup-only/record-mode split: src/Genie.Core/Mapper/AutoMapperEngine.cs
  • Cross-zone auto-detect: src/Genie.App/ViewModels/MapperViewModel.cs (TryAutoLoadZoneFor)
Dominant language
C#
Stars
2
Forks
5
Avg merge
4d 3h
Merged PRs (30d)
22

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenieClient/Genie5

All issues in GenieClient/Genie5

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.