← All packages

MapRebalance

MapRebalance - repair a mapped area's layout

Download .mpackage
Version
1.7.1
Author
Gorgar @ Icesus
Created
5 Oct 2026
Updated
19 Oct 2026

Install from Mudlet's command line

mpkg install MapRebalance

Mudlet 4.20+ with mpkg installed

Or drag it in

Drag into MudletDrop it on the main window

Mudlet 4.11+ · click to download instead

Description

Repairs a mapped area's layout so the drawn map matches the exits you can actually walk. Works with any MUD and any mapper script -- it reads nothing but Mudlet's own map. It repairs indoor-style areas whose rooms were placed by exit direction; grid-mode areas are refused, so read "Where it does not apply" below before installing.

Automappers place each room as they discover it, and when a room's obvious cell is already occupied most of them simply spiral outward and take the first free spot. The result is rooms stacked on top of each other, exits that point the wrong way, and connection lines running straight through unrelated rooms -- and it never gets cleaned up afterwards. MapRebalance recomputes one area's coordinates from its exit graph and writes them back, so the picture matches the map.

It first builds an exact coordinate embedding from all exits and checks every cycle, joining floors through their entrances. Crowded tree branches can be stretched together along their exit directions. When that fast solution does not fit, a joint constraint model changes exit lengths throughout cycles while preserving every compass alignment, including 45-degree diagonals. Geometry conflicts add separation constraints, and each candidate is checked again. Existing repair strategies remain available for contradictory maps. A failed unit-length embedding is never treated as proof that an area is impossible.

The search uses an elapsed-time budget, including map collection. Each run reports time spent reading, analyzing, solving, and writing coordinates, so slow mapper operations are visible as well as solver time.

Unfinished compass arrows reserve their first two cells. This includes exits to rooms that exist in the map database but have not been placed in an area, as well as ordinary unexplored exit stubs. Nearby rooms must not look like destinations those arrows do not actually lead to. Whole connected sections can move to leave that space while keeping their own exit directions intact.

What it enforces, in priority order

  1. No room is hidden underneath another room.
  2. No connection line passes through an unrelated room.
  3. No two connection lines cross, unless the exits make crossing unavoidable.
  4. Every exit leaves on its correct compass side -- a west exit is never drawn to the north-west.
  5. Cardinal exits stay axis-aligned and diagonals stay at 45 degrees.
  6. Rooms sit one cell apart wherever that is possible; entire sections are bumped outward only when they have to be.

Where it does not apply

Grid-mode areas -- outworld, wilderness and overland maps, anything your mapper placed with setGridMode -- are refused outright. rebalance and rebalance check stop with a message naming the area rather than touching it. Those rooms sit at absolute coordinates the server sent, instead of being positioned by the direction you walked, so they are usually already consistent and none of the rules above mean anything there. rebalance export still works on them.

If the areas you wanted fixed are grid-mode, this package cannot help with them. Everything else below applies to ordinary direction-placed areas.

Stored floors are never changed: a room recorded on another z level stays there, and its exits are still checked for direction. Rooms belonging to other areas are never moved. Cross-area exits are reported separately; areas have independent coordinate systems, so those exits do not constrain placement.

Commands

  • rebalance -- repair every floor of the area you are standing in
  • rebalance check -- report what is wrong without moving anything
  • rebalance undo -- restore the exact coordinates from before the last run
  • rebalance export <area> -- write one area to JSON, for a bug report

Rebalancing only changes coordinates in Mudlet's live map and never saves by itself, so nothing reaches your map file until you save it -- and rebalance undo is exact until then. Needs no configuration and no third-party Lua, only Mudlet's standard mapper API, so it sits alongside whatever mapper script you already use rather than replacing it.

Aliases (4)

Script (1)

Files (2)

188 KB unpacked

Select a script or file on the left to preview it here.