World map (Tab menu) - 2026-11-23, Claude
Owner request (Janari, approved "jah" 23.11): full world map in the Tab menu, drawn from the real MainWorld like the minimap, unvisited land dark (fog of war) and remembered per character, easy to navigate.
How to open
- Tab -> Quick Menu -> Map (was "Coming soon"), or M directly.
- Close: M, Tab, Esc or the Close button. Gameplay input is blocked while open (registered with GameplayInputGate); the world keeps simulating like other menus.
- Navigate: drag, mouse wheel (zooms at the cursor), +/- buttons or keys, WASD/arrows, Space or @ = back to the player, Places list = jump to a place, double-click = own marker (right-click the marker to remove it).
Files
Scripts/UI/WorldMapMenu.gd- the map window, rendering, markers, input.Scripts/UI/WorldMapFog.gd- explored cells (data only), save/load.Shaders/world_map_fog.gdshader- soft dark fog with a faint hatch.Scripts/Menus/SelectMenu.gd- createsGUI/WorldMapLayer/WorldMap(own CanvasLayer, layer 90, unscaled; GUI is scaled 0.65, quest HUD is 80) and opens it from the Map button. Pre-change copy:D:/WieldHavenBackups/archive/world_map_20261123/before/.
How the picture is made (why it follows the real world)
- No copied art, no second world. Terrain TileMapLayers and static world objects (
get_effective_sort_y_offset= WorldOccluder/MiningNode) get canvas visibility bit 18 (WORLD_MAP_LAYER); actors (CharacterBody2D, groups Player/Enemy/NPC/Pet) never get it. The minimap keeps using bit 19. - On open, SubViewports that share the world's
world_2drender the overworld once (canvas_cull_mask = bit 18). Base scale follows the screen: 0.09375 at 1080p, 0.1875 at 4K (tiles of max 2048 px). Zooming past the base renders a screen-sized detail view once per view change, at physical pixels (sharp 4K). - Re-render only when a world object/tile layer is added inside the overworld or the screen size changes. Nothing renders while the map is closed.
- World rect = union of TileMapLayer used rects whose centre is < 15000 px from the origin (interiors live at NativeAreaHost.interior_origin 20480,20480). Today: (-4064,-4064) size 14400x9984.
Fog of war / save
- Cells are absolute 256x256 world squares; revealed within 1000 px of the player, checked 4x per second (also while closed). Not revealed inside interiors; there the player marker sits at the door (
return_position). - File:
user://SaveSlots/slot_N/WorldMap.save(store_var dictionary: format, token, areas.haven_overworld.cells PackedInt32Array x,y pairs, pin). Written every 10 s when changed, on close, on exit; temp file + rename. Separate from PlayerStats/Inventory so it can never break a character save. PlayerStats.Stats["WorldMapToken"]ties the file to the character. New Game resets Stats, so a new character starts dark even if an old file is there.- Online later: the same cell list can be owned by the server per character; the client only draws it. Online code was not changed.
Markers
Player arrow (heading), NPCs (group NPC, scroll icon), entrances (each native_area_host outdoor_portal), place names (PLACES constant in WorldMapMenu.gd - edit positions/names there; unknown ones show "???"), own marker. Everything except the player only shows on explored land.
Evidence
Probe: D:/WieldHavenBackups/proof_recordings/worldmap_20261123/ (run.ps1 -Out <name> -Probe verify_map.gd, isolated perf test profile, never the owner's saves). Runs verify3 and verify4 (final code): all 17 checks pass (M/Tab/Esc/Map button open+close, gameplay blocked, quick menu not reopened by Tab, Esc does not open Pause, save+reload cells and pin, new character starts dark).
- Closed map cost: 203.7 FPS vs 202.3 with the map node disabled (none).
- Open map: 238 FPS whole-world view, 238 zoomed (RTX 4080, 1080p).
- Whole-world render 19 ms (bake probe). VRAM +~58 MB after first open, mostly textures of far areas becoming resident; 4K window screenshots 05/06 sharp.
Not checked / open
- Both final runs end with Godot's exit-time "ObjectDB instances leaked" warning (also seen in earlier perf runs, e.g. armor1); source not identified yet.
- Owner feel not confirmed; place name positions are hand-picked.
- Forests that fade near the player render with their current fade alpha.
- Online client map (OnlineMainWorldSlice has its own M map) untouched.