Knights Map Editor
This is a tool for editing Knights maps. It is currently in a "beta" state so it may not be fully working or have the best interface yet. This will be improved in future releases.
Installation
Installation instructions for Windows:
Step 1: Download the latest map editor from http://www.knightsgame.org.uk/download.html. Unzip to a directory of your choice.
Step 2: You also need to install GTK runtime libraries, otherwise the map editor will not start. Get these from http://sourceforge.net/userapps/mediawiki/alex-sh/index.php?title=Downloads (just grab the latest version of the "runtime" package).
Step 3: We now need to configure the map editor to tell it where to find the Knights files. First start the map editor (double click knights_editor.exe). Then go to File -> Settings and enter the location of your knights_data directory (e.g. "C:\Program Files (x86)\Knights\knights_data") and the Knights executable itself (e.g. "C:\Program Files (x86)\Knights\Knights.exe"). After doing this you will need to close and re-open the map editor. (This only needs to be done once; the settings will be remembered the next time you start the editor.)
How the Knights random dungeon generator works
Before using the map editor you have to understand how the dungeon generator in Knights works. Basically, there are a bunch of pre-designed 12×12 map sections, which I call “segments”. There are 259 of these segments defined currently. The game randomly selects a number of these and combines them to make a dungeon. The number of segments used depends on the dungeon type: for example, a Tiny dungeon is a single segment, a Basic dungeon is 4 segments (in a 2×2 arrangement), and a Huge dungeon is 9 segments (3×3). Each segment is then further split into “rooms” which are the rooms you actually see in-game.
Overview of the map editor
The segments that come with Knights are stored in a file called "knights_rooms.txt", which lives in the "knights_data" directory. You can load this into the map editor by going to File -> Open. After doing this you will have a screen like the following:
All map segments stored in the file are shown down the left-hand side, as indicated in the screenshot. You can page through the segments using the small vertical scroll-bar. Double clicking a segment will open it in the main edit window.
The editor has three modes: Paint, Switches and Rooms. These can be selected by clicking the small buttons below the main edit window.
Paint mode
In this mode you can draw tiles onto the map. First click a tile from the tile palette, then click onto the main edit window to "paint" that tile into the map. Note you can select different tiles for the left and right mouse buttons.
Description of the available map tiles
Most of the tiles in the tile palette are self explanatory, however some tiles have small letters attached, which have the following meanings:
- P - This is an active pentagram. (The pentagram without the letter P is a "fake" pentagram and doesn't do anything when stepped on.)
- G - This is the location of the Tome of Gnomes. (Segment category must be "gnome_room")
- N - This is the location of the Necronomicon. (Segment category must be "liche_tomb")
- S - This is the location of the Special Pentagram, for "destroy book with wand" quests. (Segment category must be "special_pentagram")
- L - This is a locked door. No key will be able to unlock this door, instead you must define a switch somewhere to open/close it.
Note that "entry point" tiles (where knights respawn) are shown with a red block of colour in the map editor. This does not appear in-game (unless a wand of securing is used).
Switches mode
In this mode the effects of switches and pressure pads can be defined. When this mode is selected, any square with a defined switch effect will be highlighted with a red square. You can double-click a map square to add a new switch effect, or right-click to remove one.
Switch effects are defined by short Lua scripts. Currently there is no way to edit these effects using a GUI, instead you just have to type a Lua script (surrounded by double quotes) in the switch dialog box. The interface for this will be improved in a future version of the map editor.
Rooms mode
In this mode you indicate the boundaries of the actual dungeon rooms. Example:
The yellow boxes represent room boundaries. To place these, simply click and drag with the left mouse button.
Note that each yellow box represents the "interior" of each room. There is also a one square "border" region (just outside the yellow box) which is shared between two adjacent rooms. For example, in the above screenshot, the 3×3 room containing the crystal ball is actually a 5×5 room, because it includes a one square border around each edge. And the 5×5 "yellow box" in the top left actually represents a 7×7 room once the border is included (note the north/west border is assumed to be solid walls). This means, for example, that the iron door to the north of the crystal ball is actually part of both of these rooms. And so on.
It is important to ensure that every reachable square on the map is "covered" by some room (i.e. every square must be either within one of the yellow boxes, or in a "border region" between two yellow boxes); otherwise the map will not work properly in the game.
Adding new segments and Segment Categories
You can add a new segment to the file by going to Segment -> Add. This will add a blank segment which you can then edit to your heart's content. The segment will be given a default name, but you can edit this if you want by changing the value in the "Name" edit box.
There is also a "Category" edit box. For normal segments this is left blank. If this segment is intended to be used in certain quests (such as a Gnome Book room) then you will need to enter a special value into the "Category" box, as follows:
- "gnome_room" -- this segment should be used for Tome of Gnomes quests (one "gnome_room" segment will be chosen randomly and included somewhere in the dungeon, whenever a Tome of Gnomes has been selected by the players).
- "liche_tomb" -- this segment should be used for Necronomicon quests.
- "guarded_exit" -- this segment should be used for Guarded Exit quests. The segment should contain a single exit point, which should be placed behind locked doors; this will form the exit point for the quest. Also, the floor tile with the small scratch marks has a special meaning within "guarded_exit" segments; it indicates the initial location of vampire bats. (This only applies within "guarded_exit" segments and the tile has no special meaning in any other kind of segment.)
- "special_pentagram" -- this segment should be used for Destroy Book with Wand quests. (The segment should contain a single pentagram with the "S" symbol. This should be placed somewhere obvious, with lots of steps, so players can easily identify it.)
Note all of these should be entered without the quotes (and with exactly the correct spelling) into the "Category" box.
Play-testing segments
Once you have edited a segment you can play-test it by going to Segment -> Test. This will load up a copy of Knights and start up a single-player game within your currently selected segment. You can use this to explore and test that everything works properly. Note that your knight will automatically respawn at a random location ("entry points" are not used), and to assist in testing, your knight will start with lock picks and "number of keys" will be set to 1.
Attachments
- map_editor_screenshot.png (111.1 KB) - added by stephen 5 months ago.
- rooms_screenshot.png (68.1 KB) - added by stephen 5 months ago.


