Map editor

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 20:40, 21 September 2026 by QCherry (talk | contribs) (Release 0.1.4 BUILD133 / Protocol 36 and document authenticated event origin)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Map editor

Available since 0.1.4. Use the complete 0.1.4 client (BUILD133 or later) with the matching Protocol 36 server and current map_editor/map_scene resources. Both resources are included in the Windows and Linux server packages but are not auto-started. Object-cap removal and the held-key freecam fix are included.

The Lua editor places existing game meshes in MainMap. It provides a searchable model browser, local placement preview, numeric transforms, scene list, duplicate, undo/redo, save/load and export. No separate reference Map Editor mod is needed.

Three different workflows: Save/Open keeps an editable project; Export Lua deploys a static scene through map_scene; legacy JSON exchanges layouts with the reference editor. Saving alone does not make objects appear for other players.

Start the editor

  1. Install the complete map_editor resource in the running server's resources directory, including its client, server, shared and UI files.
  2. In the server console, run refresh, then start map_editor.
  3. Use a client supporting these 0.1.4 APIs. If scripts were replaced while connected, reconnect to obtain the current client resource files.
  4. With the supplied gothic_rp gamemode running, log in, finish spawning and use /mapeditor. Your account needs admin.world permission.

The editor is not autostarted. Its server authorization bridge currently trusts the gothic_rp resource by name. Other gamemodes need an equivalent server-side permission bridge and an intentional update to the trusted-source check in map_editor/server/storage.lua; merely sending an open event from another resource is not sufficient. Never authorize editing using client-supplied permission claims.

Place your first object

  1. Type a model name or part of its asset path in Models. Use Previous/Next to page through results (40 per page).
  2. Click a model to create a local preview. Move the pointer over the central world viewport: the placement ray follows the world surface.
  3. Use the wheel to adjust preview height. Click the viewport to place the object and wait for confirmation.
  4. Choose Cancel preview or Escape before selecting an existing object. You can select it in the world or in the bottom Scene list.
  5. In Inspector, edit position, rotation, scale or name and click Apply transform / name. Position is in metres; rotation is in degrees; scale is a multiplier.

The Scene list supports name/ID search and 30 rows per page. [H] means hidden, [L] locked, and [!] failed to render. Use this list for hidden or non-colliding objects that a world ray cannot select. Hide, Lock and Collision are saved properties. Preview collision is disabled.

Controls

Control Action
W / E / R outside text inputs Select Move / Rotate / Scale mode for axis-step editing.
X/Y/Z minus and plus buttons Apply the current transform mode on that axis. Rotation X/Y/Z corresponds to roll/pitch/yaw; scale steps are 0.1.
Grid / Angle Position step in metres / rotation step in degrees. Zero disables placement snapping; axis buttons still use a fallback step (0.1 m or 1 degree). Numeric input retains exact values.
Delete; Ctrl+C / Ctrl+V / Ctrl+D Delete; copy / paste / duplicate.
Ctrl+Z / Ctrl+Y Undo / redo confirmed create, delete and property/transform changes.
F Focus the camera on the selected object.
Escape Cancel preview, or deselect when no preview is active.

Freecam: hold the right mouse button over the world viewport, or click Fly camera. Move the mouse to look around. W/S flies along the full view direction, including up/down pitch; A/D strafes horizontally; Q/E moves vertically; Shift is faster. Release RMB or press Tab/Escape to return to GUI interaction. Speed sets flight speed; the viewport wheel adjusts it when no placement preview is active. W/E/R are transform shortcuts outside fly mode, not during flight. Closing the editor releases its camera and input ownership.

There are no mesh thumbnails or draggable 3D axis gizmos in this implementation: use the live preview, Inspector fields and axis buttons. Selection requests custom-depth rendering, but a visible world outline depends on the game's post-processing; the selected hierarchy row is also highlighted.

Save, reopen and export

Use the name field at the top. Names contain 1-48 ASCII letters, digits, underscores or hyphens, without a file extension. Example: untitled or old_camp_rocks.

Save / Save As: click once, then click the same action again within six seconds to confirm saving/overwriting. Wait for Saved atomically on server (.storage). before exporting or leaving. For Save As, first change the name field; it uses the same save mechanism. * marks unsaved changes. There is no automatic save on closing or stopping the resource.

Open an existing project: enter its name (for example untitled) and click Open. If there are unsaved changes, the second click confirms discarding them. Open replaces the editor scene; it does not merge another map into it. A successful load reports the object count and failed render count. You do not need either export file to reopen a saved project.

New: clears the working scene after confirmation; it does not delete saved files. Save under a new name to avoid overwriting a previous project. Undo/redo history is session-local and resets on load.

The following files live on the server, not in your client's Downloads directory:

Path relative to the running server Purpose
resources/map_editor/.storage/data-map_untitled.json Working project: Save creates it; Open reads it.
resources/map_editor/.storage/data-map_untitled.json.bak Previous overwritten save, if one existed. One backup generation, not unlimited history.
resources/map_editor/.storage/data-export_untitled.lua Export Lua output for map_scene deployment.
resources/map_editor/.storage/data-export_legacy_untitled.json Export legacy JSON output; not the ordinary Open format.
resources/map_editor/.storage/data-legacy_untitled.json Input filename read by Import legacy.

Exports use the last acknowledged save for the current name. Save again after editing, wait for the confirmation, then export again. Back up .storage before replacing server/resource folders. To move an editable project to another server, copy its data-map_NAME.json into that server's map_editor storage, then Open NAME; the target must have a compatible model catalog.

Make objects visible to players

Follow Map scene deployment: Export Lua, copy the output as resources/map_scene/map.lua alongside the supplied loader and manifest, close the editor, then start/restart map_scene. This is the supported static scene workflow with reconstruction for late joiners. The editor's private live preview is not multiplayer collaborative editing.

Legacy JSON import

  1. Copy a compatible legacy JSON layout to resources/map_editor/.storage/data-legacy_NAME.json.
  2. Enter NAME in the editor and click Import legacy. Confirm discarding unsaved changes if prompted.
  3. Save the converted project, then use ordinary Open for future editing.

Legacy entries contain mesh, x, y, z, yaw, scale. Coordinates are centimetres and are converted to metres. The working project and Lua export already use metres: do not feed them to the legacy importer. Legacy Lua import is not supported. Export legacy JSON rejects pitch/roll, non-uniform scale, hidden/locked objects or disabled collision instead of silently losing those properties.

Limits and troubleshooting

  • No fixed object-count cap in the editor, legacy import, native client or map_scene loader since the BUILD124 revision of 0.1.4. Actual capacity depends on mesh complexity, RAM/VRAM, CPU and the remaining document/transport limits. Undo history still holds 200 commands.
  • The shared JSON codec accepts up to 1 MiB and 65536 table entries per document (nested fields count), while editor transfers remain bounded to 1000000 bytes. Split larger projects into separate scene resources when needed; removing the count cap does not make one file unlimited. Test representative maps in-game before deployment.
  • Position: +/-100000 metres; rotation: +/-36000 degrees; each scale axis: 0.01-100. Editor upload/download JSON is limited to 1000000 bytes. See World objects and Resource data storage for engine limits.
  • One user holds a named-map lock until their editor session closes/expires. This prevents simultaneous conflicting saves, not a collaborative editing session.
  • Start map_editor in the server console first: check that map_editor is running and the compatible GothicRP bridge is installed.
  • Export refuses: save the current name, confirm with the second click and wait for the save response. Do not change the name between Save and Export.
  • [!] / failed render: inspect the reported asset failure. The document retains that object's record so another save does not silently lose it. Unknown catalog entries fail validation before the old scene is cleared.
  • Native state uncertain: reload the saved map before further editing; blindly retrying a timed-out mutation can create an inconsistent scene.
  • A first load of a large mesh can hitch. The catalog is an index, not a guarantee every mesh/material/collision behaves suitably in gameplay.
  • Restarting the resource or closing/disconnecting removes the preview and unsaved editor state. Save first. For deployed objects, keep map_scene running.

Lua developers

Use WorldObjects.request and its two result/reset events for generic resource-owned meshes. MapEditor helpers documents the four convenience functions inside the editor only. Resource data storage documents the three new server persistence functions. Mouse capture includes the new optional exclusive-input mode; UpdateCameraPose streams the editor's camera.