Killing Floor 2

Killing Floor 2

63 ratings
KF2 Modding for Dummies
By ℍ𝕚𝕔𝕜𝔻𝕖𝕒𝕕
Work in Progress...

I'd like to make modifications for KF2, but I don't know where to start and the guides I have found so far assume a great deal of knowledge and experience which I do not have. I'm hoping that one day this guide will be usefull to others going through the same.

The focus will be on code modding, at least for now.
   
Award
Favorite
Favorited
Unfavorite
Prerequisites
Stuff you're obviously going to need:
  • PC
  • Internet
  • Windows
  • Steam
  • Killing Floor 2
Getting started
After obtaining all of the above, you will need to install the KF2 SDK.

  1. From the LIBRARY menu, select TOOLS.
  2. Find "Killing Floor 2 - SDK" in the list.
  3. Right click it and select "Install Game..." from the menu that popped up.
  4. Wait for the download to complete.
The first problem I ran into was that I have installed KF2 on a small SSD, and the SDK on another (larger regular) drive, it was solved by copying the KF2 folder over the SDK folder. You may want to avoid this issue by installing both in the same (default) location.

Throughout the rest of the guide I shall refer to these three placeholders for directories:

<KF2Userdir>
C:\Users\<UserName>\Documents\My Games\KillingFloor2
<KF2Gamedir>
C:\Program Files (x86)\Steam\steamapps\common\killingfloor2
<KF2SDKdir>
D:\Program Files\SteamLibrary\steamapps\common\killingfloor2
These may (and probably will) be different in your situation, depending on where you chose to install things, the <KF2Gamedir> and <KF2SDKdir> could be one and the same directory.

Now create a directory to hold the source code for our DummyMod:
  1. Make a directory called "Src" in <KF2Userdir>\KFGame.
  2. Make a directory for your mod in the Src directory (<KF2Userdir>\KFGame\Src\DummyMod).
  3. Make a "Classes" directory in your new mod directory (<KF2Userdir>\KFGame\Src\DummyMod\Classes).
And let the KFEditor know about it:
  1. Edit <KF2Userdir>\KFGame\Confg\KFEditor.ini and add ModPackages=DummyMod to the [ModPackages] section.
The value of ModPackages (DummyMod) must be the name of the directory you created in the previous step.

Adding a game type
If you want to create a new game type, you're going to extend the KFGameInfo class or one of it's descendants. Here is a dummy example which does that and overrides KFGameInfo_Survival's InitGame() event to write a message in the log.

Create a new file in <KF2Userdir>\KFGame\Src\DummyMod\Classes called Dummy_Survival.uc with the following text in it:

class Dummy_Survival extends KFGameInfo_Survival; event InitGame( string Options, out string ErrorMessage ) { Super.InitGame( Options, ErrorMessage ); `log("Dummy game type initialized"); }

Note: the class name is up to you but it must match the filename, in this case Dummy_Survival
Adding a mutator
If you want to create a new mutator, you're probably going to extend the KFMutator class. Here is a dummy example which does that and overrides KFMutator's InitMutator() function to write a message in the log.

Create a new file in <KF2Userdir>\KFGame\Src\DummyMod\Classes called Dummy_Mutator.uc with the following text in it:

class Dummy_Mutator extends KFMutator; function InitMutator(string Options, out string ErrorMessage) { super.InitMutator( Options, ErrorMessage ); `log("Dummy mutator initialized"); }

Note: the class name is up to you but it must match the filename, in this case Dummy_Mutator
Compiling the code
Compiling will generate binary code (from the source code) that the game engine can read. You will need to do this every time the source code files are changed.

Open a command prompt in <KF2SDKdir>\Binaries\Win64 (shift right-click the folder). And run:
.\kfeditor make -useunpublished -log
The -useunpublished argument isn't really needed as the example code doesn't depend on other unpublished items yet, you may need it later though.

After a while a console window should pop up to inform you what it did.


The compiled .u files (e.g. DummyMod.u) can then be found in your <KF2Userdir>\KFGame\Unpublished\BrewedPC\Script directory.
Testing
Open a command prompt in <KF2Gamedir>\Binaries\Win64 (shift right-click the folder), then run one of the following commands.

Open the command prompt and navigate to your Steam Killing Floor 2 binaries directory (

To test the gamemode:
KFGame KF-BurningParis?game=DummyMod.Dummy_Survival -log -useunpublished

To test the mutator:
KFGame KF-BurningParis?mutator=DummyMod.Dummy_Mutator -log -useunpublished

Or combine to try both at once:
KFGame KF-BurningParis?game=DummyMod.Dummy_Survival?mutator=DummyMod.Dummy_Mutator -log -useunpublished

Brewing
Open a command prompt in <KF2SDKdir>\Binaries\Win64 (shift right-click the folder). And run:
.\kfeditor make brewcontent -platform=PC DummyMod -log

After a while a console window should pop up to inform you what it did.

The newly generated file(s) (e.g. DummyMod.u) can then be found in your <KF2Userdir>\KFGame\Published\BrewedPC directory.

Now you can start KF2 as described under Testing without needing the -useunpublished argument.
Uploading to the workshop
Double (or right) click Killing Floor 2 - SDK (see Getting started above) and select Workshop Upload Tool.



Make the window look somewhat like this (there is no need to upload the dummy mod, I've already done that for you) and hit Start then with a little luck (and some patience), you may find your shiny new mod in the workshop. It should be under the Workshop Items tab on your content page.

Advanced uploading
When your mod gets more sophisticated you might need to add more files to the workshop like configuration (.ini) and localization (.int /.deu /.fra /.rus / etc.) files. This can be done with the command line uploader WorkshopUserTool.exe.

Including configuration files this way turned out not to be very practical, it is better to generate them from your mod's code and/or include an example config under a different name. This is because they will be overwritten (with the copy under ...\steamapps\workshop\content\232090\<workshopId>\Config\ which is rather hard to locate) every time the game starts.

Create a text file <KF2Userdir>\wsinfo_DummyMod.txt with the following contents:
$Description "This is an example mod from the K2 Modding for Dummies guide." $Title "DummyMod" $PreviewFile "C:\Users\<UserName>\Pictures\DummyModPicture.png" $Tags "Maps,Mutators,Gamemodes,Weapons" $MicroTxItem "false" $PackageDirectory "C:\Users\<UserName>\Documents\My Games\KillingFloor2\DummyModUpload"
Do NOT re-order the lines differently, they must be exactly in this order. And the quotes are needed too. Replace <UserName> with the appropriate username. Or put the file and/or the directory somewhere else entirely.

$Description
A description of your mod, can be edited later in the workshop.
$Title
The name of your mod, can be edited later in the workshop.
$PreviewFile
The name (and full path) of a preview image.
$Tags
A comma separated list of categories that apply to your mod (can NOT be modified in the workshop, if you want to change this do a re-upload) The available tags are: Maps, Mutators, Gamemodes and Weapons.
$MicroTxItem
microf♥♥♥ingtransactions, should ALWAYS be set to false.
$PackageDirectory
Full path of your upload directory, see the example below for what file to put where. You can put this directory anywhere you like.

Example directory structure of $PackageDirectory (DummyModUpload):
  • DummyModUpload\
    • BrewedPC\
      • KF-DummyMap.kfm
      • Packages\
        • DummyModPackage.upk
        • ENV_DummyMap\
          • ENV_DummyMap_MAT.upk
          • ENV_DummyMap_TEX.upk
      • Script\
        • DummyMod..u
    • Config\
      • DummyMod.ini
    • Localization\
      • INT\
        • DummyMod.int
No two filenames should be the same, even if they are in different directories. Other languages can be put under Localization\ as well, just like under <KF2Gamedir>\KFGame\Localization\.

Open a command prompt in <KF2SDKdir>\Binaries\ and enter:
WorkshopUserTool wsinfo_DummyMod.txt
Note: this will reset your description, so if you edited it, you may want to save it somewhere first.

<add screenshot>

Errors while uploading?
- Double check the full paths.
- Convert image to .jpg for smaller size.
To be continued...
Serving, some more useful examples... who knows?

Meanwile some more or less relevant links:

Pages used for reference:
30 Comments
Chicken Rice Nov 2, 2023 @ 11:04pm 
Hello, anyone know how to modify this line:

KFGame KF-BurningParis?mutator=DummyMod.Dummy_Mutator -log -useunpublished

to launch the game on other difficulties/lengths etc.?
Trisisisisisisisisisisisisisisis Mar 2, 2021 @ 11:15am 
Can I use that to run multiple already made mods at once ? I can't find anything on how to run multiple mods :(
Gamemaster May 28, 2020 @ 11:26pm 
Hi there.

I am attempting to follow this tutorial and when I get to the compile stage, my SDK comes up with the terminal window, but then crashes partway through (I'm not able to capture the logs) and I get a BugSplat screen after. No files are output in the Script screen.

I double checked my code, and it is 1:1 to what you're providing in the example. I have no idea why it's crashing or how to debug this. Any assistance would be appreciated.

Windows 10 64 bit/9900k/GTX 1080/Intel UHD Graphics 630/32 GB RAM
Zim Sep 26, 2019 @ 11:13pm 
uninstalling and reinstalling fixed the editor and commands so far
Zim Sep 26, 2019 @ 10:48pm 
ohh and it would be great if the tripwire forums werent dead as they seem to have all the recources
Zim Sep 26, 2019 @ 10:46pm 
so launching the SDK does nothing, running SDKFrontend.exe manually will launch some kind of mod packing tool but trying to launch the unreal editor from there just crashes and neither does it create any any files and finally the .\kfeditor command is not a recognized command and KFSDK is installed in the default location which is my kf game directory. does anyone know how to get this running?
RA|» Fio Kron Aug 8, 2019 @ 6:25am 
EDIT: I have been able to solve the problem. For the reference of anyone else who has a similar problem, one simply has to get the Unreal Editor via the KF2 SDK to run, then that file and a few others for the UnrealEditor will be generated automatically.
RA|» Fio Kron Aug 7, 2019 @ 6:22am 
Hello there, I am trying to go through creating a sample mod. as detailed in this guide, but at the last step of the 'Getting Started' section:

And let the KFEditor know about it:
Edit <KF2Userdir>\KFGame\Confg\KFEditor.ini and add ModPackages=DummyMod to the [ModPackages] section.

I am able to locate the Config folder, but there is no KFEditor.ini file within it, I am able to find a similar <GameName>Editor.ini file for other games that use Unreal Engine 3, but not for KF2 (the .ini files present are KFEngine, KFGame, KFInput, KFSystemSettings, KFUI, KFUnofficialMod, KFTIM, KFTIM_Example_Config, KFAI, KFWeb, KFBenchmarking and KFLightmass).

This is a shame, as I would like to put together a mod. for KF2 and your guide is a very nice starting point :).
Kepler-452b Oct 10, 2018 @ 1:44am 
Bardys Oct 3, 2018 @ 4:27am 
Completely forgot to thank You: Thanks :D