KF SDK: First Map, CSG/BSP and Geometry Tools
The first two lessons of K-2's KF SDK series, published on the killingfloor.ru forum in 2011: "Where to start?" and "Geometry". The first walks through building a minimal map; the second covers CSG, the brush builders and the shape editing tools in detail. For a general editor overview see map editor basics; advanced topics are in the mapping guide.
Getting the editor
Killing Floor runs on Unreal Engine 2.5, and the KF SDK is a slightly modified UnrealEd 3.0 (not to be confused with Unreal Engine 3). The editor is launched with KFEd.exe in the game's System folder. For the Steam version, install the SDK from the Tools section of your Steam library.
The editor must be installed into the Killing Floor root folder so that KFEd.exe ends up in System. If launching it fails with an error that Core.dll cannot be found, the SDK was most likely installed in the wrong place.
Viewports and camera
On startup you get four projection viewports (top, front, side and 3D) plus the Texture Browser, which you can close. K-2 considered the default layout the most convenient, but it can be changed under View → Viewports → Configure…. If the viewports disappear and the editor shows only a white screen, pick one of the layouts in the same View → Viewports → Configure… menu and the white window goes away ("White screen in the editor" thread, killingfloor.ru forum).
The 3D viewport shows the view through the camera; in the 2D projections the camera is drawn as an eye icon.
| Viewport | Control | Action |
|---|---|---|
| 3D | Hold LMB | Move the camera horizontally: forward/back and turn left/right |
| 3D | Hold RMB | Free look |
| 3D | Both mouse buttons | Move vertically and strafe sideways |
| 2D | Any mouse button | Pan the view |
| 2D | Both mouse buttons | Zoom in/out |
Camera speed is set with the Change Camera Speed button.
Basics: the brush, Subtract and Add
- Click the cube button on the left toolbar. Right-clicking it opens the CubeBuilder window where you set the size; enter 512×512×512.
- A brush with a red outline appears. This is your "paintbrush" (the builder).
- Click Subtract on the left toolbar. You get a room covered in "bubbles" (the default texture).
There is no empty space as such in Unreal Engine: the whole editor space is "solid material", and the room was "carved out" of it. The Add button does the opposite: it adds the brush into carved-out space and fills it.
Move the builder in a 2D projection by holding Ctrl and moving the mouse. Movement snaps to the editor grid; choose the cell size via RMB → Grid or on the bottom toolbar. Move the builder away and a subtractive brush with a yellow outline is left behind: that is the room you created.
A minimal map
Textures
- Select surfaces by clicking them. Hold Ctrl to select several, click a selected surface again to deselect it, and press Shift+B to select all surfaces of that brush.
- Open the Texture Browser, click File → Open… and pick, for example,
KillingFloorManorTextures.utx. The top field shows the name of the open package (you can also switch packages there); the second field shows the texture group. The All button left of the group field shows every texture in the package. For convenience, shrink the previews with View → 25%. - Apply textures, for example
BrickWallon the walls andwood_flooron the floor and ceiling. - These textures are high resolution and look better scaled down: RMB on the selected surfaces → Surface Properties, Pan/Rot/Scale tab, and in the Scaling field change Simple
1.0to0.25.
Textures can also be aligned with the texture pan/rotate tools directly in the viewport, but Surface Properties lets you place them more precisely.
A corridor and a fork
- Open CubeBuilder and set 256×1024×256. Use the 2D viewports to place the builder at the base of the room and click Subtract. The new corridor is no longer covered in bubbles: all its faces get the last selected texture. Apply the same textures as in the room, scaled to 0.25.
- Move the builder away and select the corridor in the top view by clicking its outline.
- Duplicate it: RMB → Duplicate (or Ctrl+W).
- Rotate the copy 90 degrees by moving the mouse with RMB held, and place it in the centre.
- To make the copy fully appear in 3D, click Build Geometry on the top toolbar.
- The copy keeps the same texture scale, but the textures are rotated 90 degrees too. Fix them in Surface Properties: the Rotation field rotates a texture, the Pan field shifts it.
Lighting
- Right-click any surface and choose Add Light Here.
- To see the light, click Build Lighting. The 3D viewport must be in Dynamic Light mode (Alt+5).
- Move the "light bulb" to the centre of the room and open Light Properties (F4). In the LightColor group the Color button picks the colour, and brightness, hue and saturation are set there too; the Lighting group sets the light radius.
- Place several lights with a smaller radius in the corridor.
Zed spawns, paths and the player start
- At the ends of the fork create 256×256×256 cubes. RMB on the Volume button → ZombieVolume: a transparent brush with a white outline appears. Make another one in the second branch. Which monsters a volume spawns is configured in its properties.
- For zeds to move properly and find players they need paths: RMB on a surface in the 3D viewport → Add Path Node Here. Lay the nodes out as a "trail".
- The player start is placed the same way: RMB → Add Player Start Here.
Ammo and weapons
- Open the Actor Class Browser and go to Actor → Pickup. For ammo, expand Ammo and select
KFAmmoPickup. - RMB on any surface (floor or wall, it does not matter) → Add KFAmmoPickup Here, then move the ammo into a corner. If nothing was added on the first try, try another surface.
- Weapons are under KFWeaponPickup and are added the same way as any actor from Actor Classes. Random weapon spawn points, as used on the official maps, are under xPickupBase → KFRandomSpawn → KFRandomItemSpawn.
Build and test
Before testing, the map has to be compiled with Build All. To quickly launch the game on this map, click Play Map!.
CSG and BSP
Unreal Engine builds worlds using Constructive Solid Geometry (CSG): a sequence of subtractions and additions. All the black "nothing" in a new map is solid space. First you carve out room for the player with subtractive brushes, then you can add buildings and decoration inside it with additive brushes.
The operations can alternate: for example, carve out a room, add a dividing wall, then cut a doorway in that wall. The order is set by how you build the map, and if you break it, the result changes. If you first add the dividing wall, then cut a window in it, and only then carve out the whole room, you get a single room with no wall, even though the editor still shows all three brushes.
The order of CSG operations is changed from a brush's (or brush group's) context menu: Order → ToFirst (run first) and Order → ToLast (run last).
On indoor maps each room and corridor is carved out separately; outdoor maps are built inside one huge carved-out volume.
BSP (Binary Space Partitioning) is the binary space partitioning used when geometry is compiled. The BSP tree sorts visible objects by distance from the viewer. The position, shape and type of brushes determine the BSP cuts that cover the map after compilation. With complex geometry the cuts can go wrong, producing BSP holes: holes in the world. How to find and fix them is covered in "Build and BSP holes" in the mapping guide.
Moving, rotating and copying brushes
- Moving. Select a brush by clicking its outline and drag it with Ctrl+LMB. Hold Ctrl to select several brushes and move them as a group.
- Rotating. Ctrl+RMB rotates the brush around its pivot, shown as a small dot or crosshair.
- Grid. Movement snaps to the grid, whose size is easy to change on the bottom toolbar. Use a grid of 1-8 for precise placement of small objects and larger sizes for big structures.
- Rotation grid. Rotation has three parameters (Pitch, Roll and Yaw) and its own grid: one step equals 1024 units. Change the step under View → Advanced Options → Editor → RotationGridSize.
- No grid. Snapping for movement and rotation is turned off with Toggle Drag Grid and Toggle Rotation Grid.
- Snapping to a vertex. If a brush vertex is not on a grid intersection, select the brush and right-click that vertex: the brush (or group) shifts so the vertex lands on the grid, and the pivot moves to that vertex.
Any object, brushes included (except the builder), can be copied or duplicated:
- Duplicate (RMB on the selection, or Ctrl+W) for copies on the same map.
- Edit → Copy and Edit → Paste from the context menu to move things to another map. This way you can copy many things, geometry included, even from the UT2004 editor into the KF editor, as long as both are open.
Copied brushes keep their textures and the add/subtract order within the group. After copying or moving, rebuild the geometry with Build Geometry. In a full build (Build All) geometry is processed first.
CSG tools
| Button | Action |
|---|---|
| Add | Adds space along the builder's red outline |
| Subtract | Carves out space along the builder's outline |
| Intersect | Reshapes the builder: trims it to the solid space inside it |
| Deintersect | Reshapes the builder: trims it to the non-solid space inside it |
If you stretch the builder over an area of the map and click Deintersect, the outlines of the BSP cuts become visible. The cuts are also visible in the Zone/Portal viewport mode.
Brush builders and their parameters
The shape buttons are on the left toolbar. They create a builder of that shape; right-clicking a button opens a window with its size and parameters.
Cube
A rectangular box. The most used tool, since it is the most convenient shape and the easiest to edit.
| Parameter | Description |
|---|---|
Height | Height |
Width, Breadth | Length and width |
WallThickness | Wall thickness (when Hollow = True) |
GroupName | Group name; does not matter much (all builders have it) |
Hollow | Creates a brush with a cavity and walls WallThickness thick. Useful for additive brushes, such as buildings in open areas |
Tessellated | Splits the brush faces into triangles |
Cylinder
An n-sided prism approximating a cylinder.
| Parameter | Description |
|---|---|
Height | Height |
OuterRadius | Radius of the circumscribed (AlignToSides = False) or inscribed (True) circle in the top view |
InnerRadius | Cavity radius when Hollow = True |
Sides | Number of side faces |
AlignToSides | Ties the radius to the side faces |
Hollow | Same as for the cube |
Cone
An n-sided pyramid approximating a cone.
| Parameter | Description |
|---|---|
Height | Height |
CapHeight | Ceiling height when Hollow = True |
OuterRadius | Same as for the cylinder, for the pyramid base |
InnerRadius | Cavity radius |
Sides | Number of side faces |
AlignToSides, Hollow | Same as for the cylinder |
Sphere
A tetrahedron-based shape approximating a sphere.
| Parameter | Description |
|---|---|
Radius | Distance from the centre to each vertex |
SphereExtrapolation | How closely the shape approximates a sphere: the higher, the rounder. Values above 6 are not recommended, as the face count grows geometrically |
Staircases
Staircases are brushes made of several segments. Three parameters are shared by all types:
| Parameter | Description |
|---|---|
StepHeight | Height of one step |
StepWidth | Width of the staircase |
NumSteps | Number of steps |
LinearStaircase: a straight staircase.
| Parameter | Description |
|---|---|
StepLength | Length of one step |
AddToFirstStep | Extra height added to the first step |
CurvedStaircase: a staircase with a turn.
| Parameter | Description |
|---|---|
InnerRadius | Radius from the origin to the start of the stairs |
AngleOfCurve | Turn angle from the first step to the last |
AddToFirstStep | Same as for LinearStaircase |
CounterClockwise | When True the stairs turn counter-clockwise |
SpiralStaircase: a spiral staircase.
| Parameter | Description |
|---|---|
InnerRadius | Inner radius to the start of the stairs |
StepThickness | Step thickness |
NumStepsPer360 | Number of steps per full 360-degree turn |
SlopedCeiling | Makes the underside of the stairs smooth |
SlopedFloor | Smooths the steps, turning the stairs into a slope |
CounterClockwise | Turns counter-clockwise |
Flat surfaces
Sheet: a flat quad. Used for decoration or for splitting the map into zones.
| Parameter | Description |
|---|---|
Height, Width | Size |
HorizBreaks | Number of horizontal segments |
VertBreaks | Number of vertical segments |
Axis | Axis the sheet is created on |
Volumetric: several flat sheets intersecting at the centre. Sometimes used for decoration.
| Parameter | Description |
|---|---|
Height, Radius | Size |
NumSheets | Number of sheets |
BSP Based Terrain
A cube-like brush with one face split into segments and the segments into triangles. It is meant for BSP terrain, but it is far from the most convenient tool for that and is very rarely used. Regular terrain is a separate topic; in KF it stays "invisible" until it is painted. See "Terrain" in the mapping guide.
| Parameter | Description |
|---|---|
Height, Width, Breadth | Size |
WidthSegments, DepthSegments | Number of segments along the length and width |
Units
Height, length, radius and other sizes are given in UU (Unreal Units).
| Quantity | In UU |
|---|---|
| 1 UU | 0.75 inch |
| 1 m | 52.5 UU |
| 1 cm | 0.525 UU |
| 1 foot | 16 UU |
| 256 UU | 487.68 cm = 16 feet |
Pitch, Roll and Yaw rotations use their own units, measuring deviation from the original orientation:
| Value | Angle |
|---|---|
| 1024 | 5.625° |
| 8192 | 45° |
| 16384 | 90° |
| 24576 | 135° |
| 32768 | 180° |
A negative value rotates in the opposite direction.
Shape editing tools
VertexEditing
Changes a brush's shape by moving its vertices.
- Select the brush and switch to VertexEditing mode.
- Hold Ctrl and pick the vertices you need (in any projection).
- Drag them with Ctrl+LMB.
This is handy for non-standard shapes. It is also much faster to duplicate an existing brush and change its size or shape with VertexEditing than to create a new one, type in the dimensions and texture it again. To make vertices easier to select, enable Show Large Vertices on the viewport mode toolbar. Snapping vertices to the grid is covered in "Vertex editor" in the mapping guide.
BrushClipping
Clips and splits brushes.
- Select the brush and switch to BrushClipping mode.
- Left-click a brush vertex to place a marker, then hold Ctrl and drag it where you need it.
- Place a second marker. Two markers are enough; a third is not needed. A red line appears between them, with a perpendicular tick in the middle showing which side will be cut off.
- Pick one of the mode's commands:
| Command | Action |
|---|---|
| Clip Selected Brushes | Cut the brush off in the direction of the tick |
| Split Selected Brushes | Split the brush into parts along the line |
| Flip Clipping Normal | Swap the side that gets cut off |
| Delete Clipping Markers | Remove all markers |
Other useful buttons
| Button | Action |
|---|---|
| Mirror X / Y / Z | Mirrors geometry around the pivot along the chosen axis |
| Select All Inside | Selects every object inside the builder |