Building on the map
Every server keeps a map of its level: the game’s own meshes placed by its admins and its game mode - a wall, a gate, a market’s stalls, a whole camp - turned every way and scaled, parts of the level itself taken away - a house, a wall, a rock, a tree -, named areas, the game’s lights, fires, sounds and doors, and links that tell the server’s characters where they can jump. Players get it when they join, before they appear in the world, and keep it for the next time; every change after that reaches everyone at once. Nothing is installed by the players: every object is one of the game’s own meshes, which every copy of the game has.
Turning it on
Section titled “Turning it on”[world] map in server.toml says where the server keeps the map - one folder per level:
[world]map = "data/maps/{level}" # "" = no mapThat is the default, so a new server has a map from the start. Nothing is written until the first edit; from then on the folder holds the map’s files (readable JSON, one object a line), the shapes the server learned for the meshes it uses, the exports and the backups. Copy the folder to give another server of the same level the same map.
Building in the game
Section titled “Building in the game”An admin types /editor. The player becomes the camera and flies (W A S D, Space up, C down, Shift faster), the
right mouse button held turns the view, and the editor’s panel opens at the side - it needs the game’s web engine, which comes with
KCD:MP (without it the /map commands below still work). Using the map editor walks through all of it
step by step; in short:
- Placing: the panel’s browser lists the game’s meshes by folder, with a search; a click on one starts placing it - it follows
the pointer over the ground and other objects,
Q/Eturn it, a click puts it there. Before the meshes come the game’s working things: a light (its colour, reach and strength in the inspector), an effect (a fire, smoke, a candle’s flame), a sound playing where it stands, a marker only the game mode sees (a spawn point, a race’s gate), a door that opens, closes and locks for everyone, and a seat to sit or sleep on anything. The game’s own chairs, benches and beds are sat on and slept in by themselves, like the level’s; a chair’s At a table in the inspector seats the player at a table instead of on its own. The game’s own ladders (objects/manmade/common_fixtures/ladders/: the village ladders and the siege ladders) are climbed like the level’s while they are solid and not stretched - lean one against a wall or a loft, its foot on the ground. - Changing: a click selects (with
Shiftmore than one), and the tools change the selection by hand:1move along an arrow or over the ground,2turn about a ring,3scale - the centre box scales the object whole, an arrow’s box stretches it along that axis (a wall made longer, a beam thinner).Xswitches the arrows between the world’s axes and the object’s own,Nthe snap (its grid and angle in the panel),Gdrops the selection to the ground,Ctrl+Dcopies it,Deletetakes it away. The inspector types the numbers instead: place, turn, scale along X / Y / Z, material, solid, a use prompt. - Undo (
Ctrl+Z) and redo (Ctrl+Y) are each admin’s own; several admins can build at once and see what the others have selected. - Prefabs: a selection saved under a name (“Save as prefab”) is placed again anywhere, turned as you like, from the panel’s Prefabs list - as separate objects, or as one unit: one map object drawn as the prefab’s objects, which follows the prefab when it is saved again (the way to build a big village light).
- Areas (
4): a drag on the ground draws a box, withShifta circle; the polygon shape takes a click per corner. An area has a name, a label players may see when they walk in, and its rules are the game mode’s. - Navigation (
5,V): the view shows where the server’s characters can walk; two clicks test a path, or draw a link for a jump or a gap their walk cannot join.
/editor again closes it.
Without the editor
Section titled “Without the editor”The same works from the chat for admins: /map place <mesh> places a mesh at your feet facing your way, /map near lists what is
near (with each object’s number), /map move | turn | scale | delete <id> ... changes one, /map remove look takes out the house,
wall, rock, tree or level object you look at and /map restore <id> puts it back, /map layer <name> on|off switches a layer.
/help lists them all.
Taking parts of the level away
Section titled “Taking parts of the level away”What /map remove look takes out is gone for everyone - drawn no more, and players and the server’s characters walk where it stood.
A building is often several pieces (a facade, a roof, a cloister): take them out one look at a time. From very far away the game draws
a level’s buildings as merged far-view models, so a house taken out can show again at that distance.
Pictures and pages
Section titled “Pictures and pages”Your own pictures go on the map too: put PNG files in the map folder’s pictures/ folder (a file’s name is the picture’s - letters
a-z first, then letters, digits, _ and -; at most 2048 pixels a side, 64 pictures and 8 megapixels in all) and type
/map pictures reload - /map pictures lists them. In the editor they are under “Pictures and pages”, beside the web interface’s
surface pages (notice boards, signs - the web interface guide): pick one and click a wall or any face, and it hangs
there, its face towards you, a centimetre out of the wall. Q and E turn it about the wall, the inspector sets its size in metres,
whether its see-through parts show the world behind them (soft or hard) and how bright it stays at night (its glow). A picture with
see-through parts starts soft; “Solid” puts it on a plain board.
A picture or a page hung on a placed object sits on that object: it moves, turns and stretches with it and goes when it is deleted.
“Take it off” in the inspector (or /map attach <id> 0) lets it go; /map attach <id> <other id> puts any object on another. Without
the editor: /map place picture <name> [width] and /map place surface <page> [width] hang one in front of you. The pictures go with
an export.
Layers
Section titled “Layers”Every object belongs to a map layer (base unless you say otherwise). A layer switched off hides all of its objects for everyone at
once - an event’s build put up and taken down with one command. A game mode can also show a layer to some players only
(SetPlayerMapLayer): a quest’s camp only its hero sees, a house’s furniture for its
owner.
Sharing a map
Section titled “Sharing a map”/map export <name>writes the whole map as one file in the map folder’sexports/;/map exportslists them.- Copied into another server’s
exports/,/map import <name> replacemakes that server’s map the same - the same objects under the same numbers, so/map hashgives the same fingerprint on both - and/map import <name> mergeadds its objects beside the map’s own. A replace backs the old map up first. - The map is also backed up once a day, into
backups/, the newest 14 kept;/map backupmakes one now. /map import sandbox <file>takes in a layer made with the game’s official modding tools (a.lyrfile inexports/): its meshes, lights and effects, on a map layer of the layer’s name.
Building plots for players
Section titled “Building plots for players”The example mode gamemodes/plots.lua hands the editor to players, safely: an admin marks plots with /plot create <radius>, a
player claims the plot they stand on (/plot claim) and builds on it (/plot build) - only their own objects, at most a number of
them, and nothing outside their plot. Read it for the pattern: SetPlayerEditor opens
the editor with what the player may do, OnMapEdit says no to an edit the mode does not want.
For game modes
Section titled “For game modes”A game mode builds the same map from its script: CreateMapObject and its kin place
and change objects (a mode’s own may last for its run only), RemoveLevelObject
takes parts of the level away, CreateArea draws areas with
OnPlayerEnterArea / OnPlayerLeaveArea,
CreateMapLight, CreateMapDoor,
CreateMapSeat and the other working things, a use prompt and OnPlayerUseMapObject, and
ExportMap / ImportMap,
PlaceMapPrefab for the rest - or CreateMapPrefab
for a prefab placed as one unit, its objects listed by GetMapPrefabParts (their doors’ keys,
their ids for a use prompt). Pictures and pages: CreateMapPicture,
CreateMapSurface (its surface talks to the mode like any web surface:
GetMapObjectSurface), a map object’s attach. Every function is in the server’s
index under “Map”.
Limits
Section titled “Limits”- A map holds at most 10,000 objects (the game has a limited number of entities per level).
- A stretched object’s look stretches exactly; a round piece of its collision (a barrel’s, a column’s) stays round, its width the mean of the two sideways stretches - the server follows the game in that.
- Chests and ladders are not among the working things yet.
