Skip to content

Commit

Permalink
Adding the ability to generate custom map configurations. Requires move
Browse files Browse the repository at this point in the history
to Focal Fossa image due to requirements in the recent KF2 updates. Adds
a game.yml file which customization of maps.
  • Loading branch information
jimbo8098 committed Jul 19, 2020
1 parent 517099b commit ffa87d8
Show file tree
Hide file tree
Showing 15 changed files with 2,563 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./kf2server
./kf2_steamdir
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kf2server
kf2_steamdir
docker-compose.yml
game.yml
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM ubuntu:xenial
FROM ubuntu:focal

RUN \
apt-get -y update && \
apt-get -y install wget lib32gcc1 && \
apt-get -y install wget lib32gcc1 ruby && \
apt-get clean && \
find /var/lib/apt/lists -type f | xargs rm -vf

Expand All @@ -12,7 +12,8 @@ WORKDIR /home/steam
USER steam

ADD kf2_functions.sh kf2_functions.sh
ADD main main
ADD main main
ADD configurator configurator

# Steam port
EXPOSE 20560/udp
Expand Down
48 changes: 23 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,33 +133,31 @@ You *must* also copy the basic config files from server1
Steam Workshop maps
-------------------

Under `kf2server`, modify the file `KFGame/Config/LinuxServer-KFEngine.ini` as per [Tripwire's wiki][1]
Find the map you wish to use on the Steam workshop, for example [https://steamcommunity.com/sharedfiles/filedetails/?id=1551913612][]. Note the ID argument from the URL (1551913612) and the name of the map (KF-NachtDerUntoten_TraderPod) and add this to a `game.yml` file in the root directory using the `custommaps` property, like so:

```
custommaps:
- name: "KF-NachtDerUntoten_TraderPod",
steamworksids:
- 1551913612
```

At runtime, the configuration files will be written and will include the map alongside the defaults. A number of things are possible to set for each map added. These are listed below:

| Property | Default | Description |
|----------------------|---------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| name | N/A | Must be set otherwise the configuration will not be generated. The name of the map you're adding, per it's name in the Cache directory of the server. |
| steamworksids | N/A | Must be set in order to download the map at runtime. An array of IDs provided to the KFEngine ini file to download the relevant map. This can be set to multiple things for accessibility. |
| mapfilename | `name` | The name of the file used for the KFMapSummary section mapname. Can be set differently for accessibility. |
| screenshot | UI_MapPreview_TEX.UI_MapPreview_Placeholder | The thumbnail image to use for the map. |
| playableInSurvival | true | Determines if the map can be played in survival mode. |
| playableInWeekly | true | Determines if the map can be played in weekly mode. |
| playableInEndless | true | Determines if the map can be played in endless mode. |
| playableInVsSurvival | true | Determines if the map can be played in vs survival mode. |
| playableInObjective | true | Determines if the map can be played in objective mode. |
| mapAssociation | 1 | Determines if the map is official (2) or custom (1). This should almost always be 1 but is settable for accessibility. |

Example shown below is for [Biolapse - Biotics Holdout][2] by

[1]: https://wiki.tripwireinteractive.com/index.php?title=Dedicated_Server_(Killing_Floor_2)#Setting_Up_Steam_Workshop_For_Servers
[2]: http://steamcommunity.com/sharedfiles/filedetails/?id=1258411772


[OnlineSubsystemSteamworks.KFWorkshopSteamworks]
ServerSubscribedWorkshopItems=1258411772


You'll also need to add the maps to `LinuxServer-KFGame.ini` as described in the wiki [here][3] and [here][4].

[3]: https://wiki.tripwireinteractive.com/index.php?title=Dedicated_Server_%28Killing_Floor_2%29#Maps
[4]: https://wiki.tripwireinteractive.com/index.php?title=Dedicated_Server_%28Killing_Floor_2%29#Get_Custom_Maps_To_Show_In_Web_Admin

Examples:

[KFGame.KFGameInfo]
...
GameMapCycles=(Maps=("KF-BurningParis","KF-Biolapse"))
...

[KF-Biolapse KFMapSummary]
MapName=KF-Biolapse
ScreenshotPathName=UI_MapPreview_TEX.UI_MapPreview_Placeholder


Building the image
Expand Down
95 changes: 95 additions & 0 deletions configurator/DefaultMaps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
- name: KF-Airship
mapAssociation: 2
playableInObjective: false
playableInSurvival: false
- name: KF-AshwoodAsylum
playableInObjective: false
- name: KF-Biolapse
playableInEndless: false
playableInObjective: false
- name: KF-BioticsLab
mapAssociation: 2
- name: KF-BlackForest
mapAssociation: 2
playableInObjective: false
- name: KF-BurningParis
mapAssociation: 2
playableInObjective: false
- name: KF-Catacombs
mapAssociation: 2
playableInObjective: false
- name: KF-ContainmentStation
playableInObjective: false
- name: KF-Desolation
playableInObjective: false
- name: KF-DieSector
mapAssociation: 2
playableInSurvival: false
playableInWeekly: false
playableInVsSurvival: false
playableInObjective: false
- name: KF-EvacuationPoint
mapAssociation: 2
playableInObjective: false
- name: KF-Farmhouse
mapAssociation: 2
playableInObjective: false
- name: KF-HostileGrounds
playableInObjective: false
- name: KF-InfernalRealm
playableInObjective: false
- name: KF-KrampusLair
playableInObjective: false
- name: KF-Lockdown
playableInObjective: false
- name: KF-MonsterBall
mapAssociation: 2
platableInObjective: false
- name: KF-Nightmare
mapAssociation: 2
playableInVsSurvival: false
playableInEndless: false
- name: KF-Nuked
- name: KF-Outpost
mapAssociation: 2
- name: KF-PowerCore_Holdout
playableInVsSurvival: false
playableInEndless: false
playableInObjective: false
- name: KF-Prison
mapAssociation: 2
playableInObjective: false
- name: KF-Sanitarium
playableInObjective: false
- name: KF-SantasWorkshop
mapAssociation: 2
playableInVsSurvival: false
playableInObjective: false
- name: KF-ShoppingSpree
playableInVsSurvival: false
playableInObjective: false
- name: KF-Spillway
playableInObjective: false
- name: KF-SteamFortress
mapAssociation: 2
playableInVsSurvival: false
- name: KF-TheDescent
mapAssociation: 2
playableInVsSurvival: false
playableInEndless: false
- name: KF-TragicKingdom
mapAssociation: 2
playableInObjective: false
- name: KF-VolterManor
mapAssociation: 2
playableInObjective: false
- name: KF-ZedLanding
mapAssociation: 2
- name: KF-Default
mapAssociation: 0
playableInSurvival: false
playableInWeekly: false
playableInVsSurvival: false
playableInEndless: false
playableInObjective: false
17 changes: 17 additions & 0 deletions configurator/Game.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Game
attr_accessor :maplist

def initialize(gamehash)
@maplist = MapList.new(gamehash["maplist"])
end

def renderGameConfig()
template = File.read("LinuxServer-KFGame.ini.erb")
return ERB.new(template).result(binding)
end

def renderEngineConfig()
template = File.read("LinuxServer-KFEngine.ini.erb")
return ERB.new(template).result(binding)
end
end
27 changes: 27 additions & 0 deletions configurator/GenerateConfig.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'erb'
require 'yaml'

require './Game.rb'
require './Map.rb'
require './MapList.rb'

#Generate map list
#Get the official map list then add any custom ones to the end of the array
gameconfig = YAML.load(IO.read("/home/steam/game.yml"))
maplist = YAML.load_file("DefaultMaps.yml")
if gameconfig.key?("custommaps")
if gameconfig["custommaps"] != []
puts "Found #{gameconfig["custommaps"].length} custom map configs"
maplist.concat(gameconfig["custommaps"])
end
end

gamehash = {
"maplist" => maplist
}

game = Game.new(gamehash)

IO.write("#{ENV['HOME']}/kf2server/KFGame/Config/LinuxServer-KFGame.ini",game.renderGameConfig())
IO.write("#{ENV['HOME']}/kf2server/KFGame/Config/LinuxServer-KFEngine.ini",game.renderEngineConfig())
puts "Wrote Server Config Successfully!"
Loading

0 comments on commit ffa87d8

Please sign in to comment.