Overview
This is a comprehensive guide to creating and editing maps in Forts. We’ll add screenshots and videos as we have time to make things clearer.Warning: don’t upload maps to the workshop that contain copyright material such as music or sounds and images from other games or movies. Doing so will result in a ban.Version française du guide ici : https://steamcommunity.com/sharedfiles/filedetails/?id=927525825
Starting Up
The Forts map editor is built right into the game, making it easy for everyone to build levels! Some work needs to be done to make it more user friendly. Feel free to make feature requests. For now, here are the basics.
First select ‘Map Editor’ from the main menu. From the editor menu you can create a new map with a specific name, or chose to edit or copy an existing map. There are template maps to copy to get you started quickly.
The Map Folder and Display Name
When the map is created or copied, a new folder is created under data/maps to contain it. That folder contains a script which specifies basic properties of the map, such as enabled mods, where it should appear in the game, and is it symmetrical, as well as any custom logic to make an interesting mission. This is where the campaign missions do their work. It can contain dialogue between characters, player instruction, AI configuration, disabling of items, custom HUD elements, special events and custom win conditions.
The rest of this guide will refer to this as the mission script, so you should know how to find it, as well as other files related to the map.
Right click on Forts in Steam, then properties, then the local files tab. Browse local files, then navigate to data/maps and then find the folder for the map you are creating. It will either have the name you gave it at creation, or something like playermap1 if you used non-ANSI characters or other problematic characters such as slashes and periods. In there will be a .lua file with the same name. That’s the mission script.
You will also see a displayname.lua, which can be edited to change what people see, including in non-English languages. The map itself is made of an .spr file, which contains all structures and devices, and a .fwe file which contains the environment setting, ground and props. A few preview jpg images are used to show the map in the menu. If you have scripted an AI for the map they will appear here as .lua files starting with “fort”. If you have already uploaded your map you will see publishedfileid.lua which just tells the game which Workshop item this map relates to.
Keyboard Layout and the Console
All key bindings listed in this guide are for the QWERTY keyboard layout. On other keyboard layouts the key will be in the same physical position as on QWERTY. For example on the QWERTZ layout Undo is Ctrl + Y and Redo is Ctrl + Z. You can query the actual key bindings in the game using the proflist and keylist console commands listed below. Keys can be rebound in Options menu -> Input tab -> All Keys tab.
Some functions require issuing commants into the console. Drop the console by using the ~/` (tilde/grave) key, usually left of the 1 key, or F3. Commands start with a backslash. Tab will autocomplete the current contents. A few useful commands are:
cmdlist => shows a list of commands
proflist => shows a list of key profiles
keylist [id] => shows a list of keys in key profile [id] taken from proflist
cvarlist => shows a list of console variables
Undo/Redo
There is unlimited undo/redo functionality so don’t be worried about making mistakes.
Ctrl + Z => Undo
Ctrl + Y => Redo
Remember that key bindings given in this guide is for QWERTY keyboards. On QWERTZ keyboards these keys are swapped.
Editor Modes
There are five editing modes:
- Structure
- Device/Weapon
- Terrain
- Surfaces
- Props
The tabs on the HUD will switch to the appropriate mode. In some situations you can switch to structure and device/weapon mode by left clicking on items in the world. Z, X, and V can still used to cycle between materials, devices and weapons respectively. C doesn’t cycle technology since this tab is disabled in the map editor for space reason. Technology items are included in the device tab instead.
Terrain Mode
This mode allows you to create and manipulate ground ‘blocks’ and set properties of the world. These are the polygons that the players build on and projectiles can hit. The texture can be changed in the Terrain tab, but for now there is only one useful texture. The other is for special blocks.
You can select a single block by right clicking on it, or using [ and ] to cycle between them. Single block selection is necessary to manipulate the nodes (vertices) of a block. Multiple blocks can be selected to copy or manipulate many blocks at once. Right click in open space will deselect all blocks.
Right mouse => select block under mouse or deselect all (in empty space)
Ctrl + Right mouse => add or remove the block under the mouse to/from the selection
Alt + Right mouse => remove block under the mouse from the selection
Shift + Left mouse + drag => add area selected blocks to the selection *
Alt + Left mouse + drag => remove area selected blocks from the selection
* when a single block is already selected this will select the block’s nodes instead
Each block is made up of a number of ‘nodes’, or vertices. With a single block selected you can left click on nodes to select them individually. Ctrl + A will select all nodes, and Ctrl + D will select none. Ctrl + Left Mouse allows you to add nodes to a selection. Shift+Left Mouse Drag allows you to add nodes in a rectangular region to the selection. Alt + Left Mouse Drag allows you to subtract nodes from the selection under a region.
With one or more nodes selected you can left click on one and drag them all. The one you dragged will snap to nodes and edges of other blocks.
Lose any selection by right clicking in open space, and then left click to start placing new nodes in a clockwise order. The white lines in the middle of each edge should point outwards, these are the normals of the surface. If you get it wrong, just press Shift + F to flip the normals.
You can left click on an edge to add a new node any time after the block is made.
There are several keyboard and mouse shortcuts for manipulating blocks. Remember that you can use Ctrl+Z to undo anything.
Ctrl + A => select all nodes
Left mouse => select node under mouse (with block already selected)
Left mouse + drag => move the selected nodes
Alt + Arrow Keys => nudge selected nodes
Shift + Left mouse => add single node to selection
Shift + Left mouse + drag => add area selected nodes to selection
Alt + Left mouse => remove single node from selection
Alt + Left mouse + drag => remove area selected nodes from selection
Ctrl + C => copy the currently selected block
Ctrl + V => paste copied block at the mouse position
H => mirror selected block horizontally
Shift + V => mirror selected block vertically
Page Up => adjust the render order of the block up (toward the background)
Page Down => adjust the render order of the block down (toward the foreground)
Backspace/Delete => delete selected nodes
Alt + X => Split a group between two selected non-adjacent nodes
J + Left mouse => Join the group under the mouse at two selected nodes. Selected nodes must be adjacent and correspond to adjacent nodes in the merge target.
Ctrl + Backspace => delete the currently selected block.
Ctrl + Delete => delete all blocks. Be careful! Remember Ctrl+Z.
To make environments feel distinct, we have made our official maps with a certain style, consistent for each environment. Maps that use the fields environment all have rolling hills, for example.
You can improve the quality of your maps by following the same style, described in the Map Editor Style Guide.
When a block is selected you can see a faint orange circle surrounding it. This is the bounding circle. When the game is looking for collisions with a projectile, beam, or structure, it is used to quickly disregard blocks which are not nearby.
Ideally, the size and shape of the block will closely match that of the bounding circle. Put another way, you want to minimise the amount of empty space which projectiles and beams can pass through before hitting the block. This is because once the object is inside the bounding circle, the game must check each edge of the block to see if there is a collision.
To reduce the work the game must do and make your map faster to play, avoid making long blocks, especially if the surface has many nodes. Instead it’s better to break them into smaller blocks placed next to each other.
If the bounding circle overlaps other blocks or space where colliding objects can’t exist (e.g. under the ground surface) then it’s not a problem.
In Terrain mode you can adjust the size of the visible world. Regions Inaccessible to the camera are shaded in green. Placing the mouse to the desired location, and pressing Ctrl + an arrow key corresponding to the desired extent. Blocks should extend a little beyond the world extents so that when the camera shakes you don’t see cracks.
You can also use Ctrl + Home to set the extents based on the current view.
There is also an easy way to expand and contract the extents and all the contents of the world horizontally to make the map wider or narrower. Place the cursor where you would like the expansion or contraction to take place, and press the following key combinations. Avoid placing the cursor in the middle of a structure.
Alt + Minus => contract world at cursor
Alt + Plus => expand world at cursor
The initial view of players is set using the following keys while the Terrain tab is selected:
Ctrl + 1 (numpad) for team 1
Ctrl + 2 (numpad) for team 2
Ctrl + 3 (numpad) will save the overview perspective (full map) from the current view.
The map preview images are taken using these screen positions when it is saved. They must be set properly for the map to be presented well and for players to not be disoriented.
You can allocate ground blocks to specific teams, or otherwise, using the following keys:
1 => Team 1
2 => Team 2
3 => Any team
4 => No team (unbuildable)
5 => Background (unbuildable)
In order to allow ropes to be pegged to non-foundation blocks, you should set the owner to Any team, but disable foundations and mines (see next).
The following keys allow you to set various properties of a ground group:
Alt + F => Toggle allow foundations
Alt + M => Toggle allow mines
Alt + W => Toggle wind floor (used to determine efficiency of wind turbines)
Alt + V => Toggle view floor (used to determine size of weapon aiming circles)
Alt + D => Toggle no draw
Wind floors and view floors are typically have their Background and No-Draw properties set.
This is really a sub-mode of the Terrain editor. Each surface of a block can have a different ‘edge set’ applied. Each node in a block controls the surface in the clockwise direction. To change a node’s edge set, select the node and then hit the desired edge set graphic on the HUD. You can select multiple nodes to change them all at once.
Edge-sets can have some rules about what’s drawn depending on the orientation of the surface (e.g. grass on top, rocky crags on the under surface). Or they can be all the same. The scripts that set the rules are found in data/environment/<theme>/surfaces/surfaces.lua.
The convention for the game is that surfaces that can be built on use the light brown rocky edge set, while non-buildable surfaces use the grassy/craggy set.
When the surface is buried underground and adjacent to other blocks then there should be no edge set applied, applied with the blank, left-most button on the HUD.
Procedural Terrain and Transformation
It’s possible to create several shapes and patterns without clicking out each vertex precisely. To do this use the terraform console command. The first parameter to this command is the path to a script. The second parameter (the remainder of the line) is arbitrary Lua code to execute in that script. There is an included script called shapes.lua, which has built in documentation, accessed like so:
This will show you the names of available functions to create shapes and manipulate them, which can be passed to the Help function to give further details. For example, Help(“Circle”). Each function has default parameters so you can see what it does and what parameters are sensible. You can undo after the command if the result is unwanted.
The shapes and waves will create the new terrain blocks at the cursor. The transformation functions will operate on the current selection, relative the cursor position.
Rectangle(width, height)
Creates a rectangle at the cursor position. If height is absent it creates a square.
Circle(radius, step, solid)
Creates a circle at the cursor position. The step parameter sets how many vertices are used (a lower value means more vertices). If the solid parameter is set to Hollow it will make a cave of the given size.
Ellipse(a, b, step, solid)
Creates an ellipse at the cursor position, where a is the horizontal extent and b is the vertical extent. The step parameter sets how many vertices are used (a lower value means more vertices). If the solid parameter is set to Hollow it will make a cave of the given size.
Polygon(sides, radius)
Creates a regular polygon with the specified number of sides and radius.
Star(points, radiusOuter, radiusInner)
Creates a regular star with the specified number of points and inner and outer radius values.
Cog(verticesPerTooth, teeth, radiusOuter, radiusInner)
Creates a cog/gear shape. The verticesPerTooth defines how high the resolution is.
SineWave(amplitude, wavelength, step, cycles)
Creates a sine wave in segments. The step parameter sets how many vertices are used (a lower value means more vertices). The number of segments is set by the cycles parameters.
StepWave(stepLength, stepHeight, levels, cycles)
Creates a progressive step wave (terraces) in segments. The number of segments is set by the cycles parameters.
TeethWave(flatLength1, stepLength, stepHeight, flatLength2, cycles)
Creates a repeating pattern of bevelled teeth in segments. The number of segments is set by the cycles parameters.
Rotate(angleDegrees)
Rotate the current selection of blocks around the cursor by angleDegrees.
Scale(x, y)
Scale the current selection of blocks around the cursor by x horizontally, and y vertically.
Translate(x, y)
Translate the current selection of blocks by x units horizontally, and y units vertically.
Prop Mode
The prop mode is for placing detail in the world, such as metal ore deposits, trees, rocks, grass, and dinosaur bones. Texture selection is done by the HUD.
These do not interact with anything during the game, but can be turned on and off by the mission script.
Left click in open space to create a new prop using the current texture. Left click on it again to select it. Once selected you can left click anywhere to move it. Left click selects other props, and right click deselects.
There are three layers which control when props are rendered relative to background blocks, foreground blocks and structures. 1 = Background, 2 = Midground, 3 = Foreground.
Within these layers the props can be ordered with the Ctrl+, (comma) and Ctrl+. (period) keys.
To allow rapid placement of grass, rocks, etc. Use the T key to toggle tile mode. In this mode, you can click a sequence to create the props. You can snap to ground nodes to fix it to the surface. Right click will end the sequence.
Rotate prop => Hold the R key and move the mouse cursor.
Resize prop => Hold the Ctrl+X key and move the mouse cursor.
Remove prop => The Delete key will delete the current prop.
Structure and Device Modes
Building structures, and devices (which includes weapons), is the same as in the normal game, with the following additions:
Alt + 0 => Create for Team None (the neutral team)
Alt + 1 => Create for Team 1
Alt + 2 => Create for Team 2
Ctrl + Space => Toggle the simulation
Ctrl + Delete => Delete all structures
Once a joint is selected you can perform operations on the structure connected to that node:
Backspace => Delete selected structure
H => Mirror selected structure horizontally
Ctrl + C => Copy selected structure to clipboard
Ctrl + V => Paste clipboard to mouse position
M (hold) => Move selected structure to mouse position
Changing the Environment
You can change the environmental theme for a map after creation by using the following command in the console (for example):
set_background alpine
The available environments are currently:
- alpine
- canyon
- desert
- fields
- midwest
- Polluted
- TrainingGround
You can use a Workshop environment mod in the same way. Just use the published Workshop id of the mod instead of one of the above built-in environments. For example:
set_background 1308302446
Some props may be broken by this command, if a texture with the same name is not found in the new background.
The Moonshot DLC added several new environments that are hidden within pack files. These can be set in the same way using the names below. Using them will make your map Moonshot dependent, showing a blue icon and requiring the host to own the DLC.
- dlc1_indo
- dlc1_japan
- dlc1_newzealand
- dlc1_oz
- dlc1_oznight
Setting map details
By default a map will show up in sandbox, skirmish and multiplayer. To show up in skirmish mode, however, you must record at least one AI fort for at least one side – see the section below.
If you want to restrict the map to only certain modes, open the maps mission Lua script and edit the following flags to false as appropriate.
You can also give the map a different display name using wide characters by setting the DisplayName value in the displayname.lua script as below. Beware that map names may not display correctly depending on the characters used and the language loaded. Ordinary alpha-numeric characters will always display correctly.
If you want to give the map names for different languages, you can set the variable like below. Supported languages can be found in the data/mods folder with the language- prefix.
An author and description can be be specified using the following variables. These will show up in the map selection screen.
Supporting Skirmish & Multiplayer
The AI follows a pattern you record while building a fort. To record a new AI fort for a map, go to the main menu and select Sandbox. Select the map and start, then follow these steps:
For Co-op (records a script to control all forts)
- Left click on a joint owned by the team you want to make the fort for
- Make sure nothing is selected by right clicking in space
- Drop the console by using the ~ (tilde) key, usually left of the 1 key, or F3
- Type record and hit enter. This will start a new AI fort and assign it an unused number.
- Build your fort as you like, in a sensible order.
- Quit out of Sandbox
For Team Death Match (records a script to control one fort)
- Follow the same instructions except have a joint of the fort you want to build for selected when you type record.
- Set up the FortGroups table in the map’s mission script if there is more than one fort configuration. By putting identical forts in the same group they will randomly select their shared AI fort scripts. See Stalactites 4v4 for an example (below). The first parameter to TeamFort is the team, the second is the fort number shown at the top left of each fort in the map editor.
You can test it by going to Skirmish and putting the player on the other side. Better yet, restart Sandbox, select a joint of the same fort, and enter build_fort [name] into the console, where [name] is the number or name assigned to the fort on record. Typically build_fort 1, if it’s the first fort, for example.
Here are some tips for making good AI forts:
- Build as if you are playing a battle
- Defend the reactor against AP snipers immediately if necessary
- Be more defensive than usual (sniper and mg nests early)
- Try to keep the structure stable at all times
- Avoid making anything that falls off
- Put cross braces in low and early
- There is no time pressure, so don’t rush, but…
- Remember to build enough resource generation
- Use Ctrl + KeyPadPlus, Ctrl + KeyPadMinus to speed up/slow down time
Tons of Guns is implemented as a mod to the classic game, called weapon_pack. Because of the many differences, we have made the AI fort scripts work only for the mode they were recorded in (classic or Tons of Guns).
If you want the AI to work in both the classic game, and with the Tons of Guns mod enabled, you’ll need to record fort scripts with weapon_pack on and off. You can do this by setting or clearing the Tons of Guns mod when entering Sandbox. The game will write RequiredMods = { “weapon_pack” }; into the AI fort script to indicate that it only works when Tons of Guns is enabled.
Once you have recorded an AI fort, deleting any joints or devices referenced by that fort will cause problems for it. Additions are usually fine, except that new devices can obstruct the AI during play.
If you want to change part of the AI fort after recording you can run it in Sandbox mode by selecting the appropriate team and using build_fort [name]. [name] is the alphanumeric string given to the recording. This can just be an auto-assigned number (e.g. 1). When you get to the point you want to intervene, use the record command again and start building where the AI left off. Quit the Sandbox to save the changes. Ctrl+KeyPadPlus/Minus can be used to speed up and slow down time.
When you use the record command a Lua file will be created or overwritten in the map’s folder. If you make a mistake you can delete the files you created, or rename the suffix (the last part of the filename). Using record with the same name (suffix) will overwite the old file.
As an example, if I use record in Sandbox with a fort selected, a file such as this will appear when I quit:
fort-t1f1-Ledge Grab-1.lua
The second part tells the game which team it was recorded for, and which specific fort, the third part is the mission name, and the suffix is the script name. This last part can be renamed to something that means something to you, perhaps a description of which weapons it uses:
fort-t1f1-Ledge Grab-2Cannon1Laser.lua
If your map and structures are pretty much symmetrical, you can make your AI forts mirror automatically. You need to navigate to the data/maps folder and edit the mission lua file in the map’s directory. For example maps/data/Vanilla/Vanilla.lua. add the following line:
If you now save the map and it’s not symmetrical it will tell you if it’s not, and what’s causing the problem. You can also use check_symmetric in the console to do the same without saving. It will list up to 10 differences and highlight all suspect positions briefly.
To make sure ground devices and weapons are symmetrical you can create them all for one side, then select each one and press Ctrl+M to create a mirror for the other side.
Making a variety of AI fort scripts for your unique starting forts can be quite a lot of work. If you do not need or want to design your own, you can use the ones we included with the game. This will give your forts one or more AI patterns in both the classic game, and Tons of Guns. When we add new fort scripts, they’ll automatically be used by your map.
This is the process:
- Use the import console command to copy in the prefabricated forts that you want
- Set the pasted ground texture to make it conform, if necessary
- Arrange the map as usual, copying, moving, mirroring, and changing the team of the imported forts as appropriate. Do not edit the imported forts!
- Group the identical forts using the FortGroups table in the mission script (see above)
- In each sub-table of the FortGroup table, add the relative paths to the shared AI fort scripts that you want to use
The available forts that can be imported are the subfolders found in the ai/forts folder. Each folder has a preview image of fort’s design. For example import ai/forts/vanilla will paste the common standing fort used in Vanilla 4v4 and many others, plus the surrounding ground. Try not to add ground close to the fort, as this may block the AI as it’s building.
An example FortGroup table can be seen below. This is from the Meat Shield 3v3 Workshop map where there are three different standard forts imported in a symmetrical map. You’ll notice the path added includes a subdirectory of the fort with a category based on range. There are mid and long categories. This is so, for example, in a long range map you don’t have the AI building mortars that can’t reach. In mid range maps you can typically add both the mid and long categories, since the weapons in the long forts are still useful at midrange.
When there are more forts than players in team death match the surplus forts will be deleted. You can determine which by setting up a FortOrder table in the mission script. This basically tells the game which forts to put players and AI into first.
Enabling Mods
In the map’s mission script file there is a line that says Mods = {}. You can see the mods that are available in the data/mods folder. Some of these are special use mods, starting with language-, commander-, keyboard-, and faction-. The others can be enabled on a map-by-map basis. For example, to supply unlimited resources, change the line to:
Any number of mods can be added to this list.
If you have made a map which starts with weapons or tech buildings from Tons of Guns, you will need to add the weapon_pack mod to your Mods list. This forces Tons of Guns on. You could otherwise be missing items if it wasn’t manually activated.