Mapping & SDK

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.

ViewportControlAction
3DHold LMBMove the camera horizontally: forward/back and turn left/right
3DHold RMBFree look
3DBoth mouse buttonsMove vertically and strafe sideways
2DAny mouse buttonPan the view
2DBoth mouse buttonsZoom in/out

Camera speed is set with the Change Camera Speed button.

Basics: the brush, Subtract and Add

  1. Click the cube button on the left toolbar. Right-clicking it opens the CubeBuilder window where you set the size; enter 512×512×512.
  2. A brush with a red outline appears. This is your "paintbrush" (the builder).
  3. 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

  1. 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.
  2. 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%.
  3. Apply textures, for example BrickWall on the walls and wood_floor on the floor and ceiling.
  4. 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.0 to 0.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

  1. 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.
  2. Move the builder away and select the corridor in the top view by clicking its outline.
  3. Duplicate it: RMB → Duplicate (or Ctrl+W).
  4. Rotate the copy 90 degrees by moving the mouse with RMB held, and place it in the centre.
  5. To make the copy fully appear in 3D, click Build Geometry on the top toolbar.
  6. 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

  1. Right-click any surface and choose Add Light Here.
  2. To see the light, click Build Lighting. The 3D viewport must be in Dynamic Light mode (Alt+5).
  3. 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.
  4. Place several lights with a smaller radius in the corridor.

Zed spawns, paths and the player start

  1. 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.
  2. 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".
  3. The player start is placed the same way: RMB → Add Player Start Here.

Ammo and weapons

  1. Open the Actor Class Browser and go to Actor → Pickup. For ammo, expand Ammo and select KFAmmoPickup.
  2. 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.
  3. 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

ButtonAction
AddAdds space along the builder's red outline
SubtractCarves out space along the builder's outline
IntersectReshapes the builder: trims it to the solid space inside it
DeintersectReshapes 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.

ParameterDescription
HeightHeight
Width, BreadthLength and width
WallThicknessWall thickness (when Hollow = True)
GroupNameGroup name; does not matter much (all builders have it)
HollowCreates a brush with a cavity and walls WallThickness thick. Useful for additive brushes, such as buildings in open areas
TessellatedSplits the brush faces into triangles

Cylinder

An n-sided prism approximating a cylinder.

ParameterDescription
HeightHeight
OuterRadiusRadius of the circumscribed (AlignToSides = False) or inscribed (True) circle in the top view
InnerRadiusCavity radius when Hollow = True
SidesNumber of side faces
AlignToSidesTies the radius to the side faces
HollowSame as for the cube

Cone

An n-sided pyramid approximating a cone.

ParameterDescription
HeightHeight
CapHeightCeiling height when Hollow = True
OuterRadiusSame as for the cylinder, for the pyramid base
InnerRadiusCavity radius
SidesNumber of side faces
AlignToSides, HollowSame as for the cylinder

Sphere

A tetrahedron-based shape approximating a sphere.

ParameterDescription
RadiusDistance from the centre to each vertex
SphereExtrapolationHow 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:

ParameterDescription
StepHeightHeight of one step
StepWidthWidth of the staircase
NumStepsNumber of steps

LinearStaircase: a straight staircase.

ParameterDescription
StepLengthLength of one step
AddToFirstStepExtra height added to the first step

CurvedStaircase: a staircase with a turn.

ParameterDescription
InnerRadiusRadius from the origin to the start of the stairs
AngleOfCurveTurn angle from the first step to the last
AddToFirstStepSame as for LinearStaircase
CounterClockwiseWhen True the stairs turn counter-clockwise

SpiralStaircase: a spiral staircase.

ParameterDescription
InnerRadiusInner radius to the start of the stairs
StepThicknessStep thickness
NumStepsPer360Number of steps per full 360-degree turn
SlopedCeilingMakes the underside of the stairs smooth
SlopedFloorSmooths the steps, turning the stairs into a slope
CounterClockwiseTurns counter-clockwise

Flat surfaces

Sheet: a flat quad. Used for decoration or for splitting the map into zones.

ParameterDescription
Height, WidthSize
HorizBreaksNumber of horizontal segments
VertBreaksNumber of vertical segments
AxisAxis the sheet is created on

Volumetric: several flat sheets intersecting at the centre. Sometimes used for decoration.

ParameterDescription
Height, RadiusSize
NumSheetsNumber 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.

ParameterDescription
Height, Width, BreadthSize
WidthSegments, DepthSegmentsNumber of segments along the length and width

Units

Height, length, radius and other sizes are given in UU (Unreal Units).

QuantityIn UU
1 UU0.75 inch
1 m52.5 UU
1 cm0.525 UU
1 foot16 UU
256 UU487.68 cm = 16 feet

Pitch, Roll and Yaw rotations use their own units, measuring deviation from the original orientation:

ValueAngle
10245.625°
819245°
1638490°
24576135°
32768180°

A negative value rotates in the opposite direction.

Shape editing tools

VertexEditing

Changes a brush's shape by moving its vertices.

  1. Select the brush and switch to VertexEditing mode.
  2. Hold Ctrl and pick the vertices you need (in any projection).
  3. 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.

  1. Select the brush and switch to BrushClipping mode.
  2. Left-click a brush vertex to place a marker, then hold Ctrl and drag it where you need it.
  3. 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.
  4. Pick one of the mode's commands:
CommandAction
Clip Selected BrushesCut the brush off in the direction of the tick
Split Selected BrushesSplit the brush into parts along the line
Flip Clipping NormalSwap the side that gets cut off
Delete Clipping MarkersRemove all markers

Other useful buttons

ButtonAction
Mirror X / Y / ZMirrors geometry around the pivot along the chosen axis
Select All InsideSelects every object inside the builder