Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ The right number is the port (and protocol) defined in your `UT2004.ini` file, a
- `SERVER_START_COMMAND` (default is empty) - If you don't want to use the above 4 environment variables to specify map/gametype/mutators/extras, you can just specify the entire server start command here. All except SERVER_START_EXTRAS will be ignored (for legacy purposes, it's appended to the end of SERVER_START_COMMAND).
- `COMPRESS_DIR` (default is empty) - If you want to compress all of your server files to set up a redirect download server, set this environment variable to a directory (such as `/compressed`). Then, have a volume mount to that directory to access the compressed files. Any file not found in that folder will be compressed there.
- `SKIP_INSTALL` (default is empty) - If you don't want to download/update your server files, set this to `true`. I assume you know what you're doing. Maybe manually installing your own server to the `/data/server` folder or something? I don't know.
- `SERVER_NAME` Set a server name
- `GAME_DURATION` (default is 20 minutes) Set the duration of matches.
- `ENABLE_WEB_INTERFACE` (default is off) Enable the Server Management web interface on port 80 by setting this variable to 1
- `ADMIN_PASSWORD` Must be set to enable Web interface
- `ENABLE_MAP_VOTING` Set this variable to "1" to enable Map voting during and at the end of matches.

## A Note On Downloading the Server
All of the official server downloads hosted in various locations all had issues, such as incorrect filename casing (leading to duplicated non-patched files on Linux), the UWeb and CSS problems, or some archives extracting incorrectly. I have taken the time to compile the server, both bonus packs, and the latest patches (which patch the bonus packs, hence why they were included) and made a nice compressed archive. However, I can't host a ~750MB file myself, due to residential bandwith caps and upload speeds. If for some reason my chosen host does not work (link is too popular), let me know and I will update the installer.
Expand Down
74 changes: 74 additions & 0 deletions root/app/start_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,80 @@ if ! grep -Fxq "Paths=/data/addons/System/*.u" /data/config/UT2004.ini; then
sed -i '/\[Core.System\]/a Paths=/data/addons/System/*.u' /data/config/UT2004.ini
fi

# If $SERVER_NAME is defined, set server name to this value
if [ -n "${SERVER_NAME:-}" ]; then
sed -i "/\[Engine.GameReplicationInfo\]/,/^$/s/^ServerName=.*/ServerName=${SERVER_NAME}/" /data/config/UT2004.ini
fi

# If $GAME_DURATION is defined, set game duration to this value
if [ -n "${GAME_DURATION:-}" ]; then
sed -i "/\[XGame.xDeathMatch\]/,/^$/s/^TimeLimit=.*/TimeLimit=${GAME_DURATION}/" /data/config/UT2004.ini
sed -i "/\[XGame.xTeamGame\]/,/^$/s/^TimeLimit=.*/TimeLimit=${GAME_DURATION}/" /data/config/UT2004.ini
sed -i "/\[XGame.xCTFGame\]/,/^$/s/^TimeLimit=.*/TimeLimit=${GAME_DURATION}/" /data/config/UT2004.ini
sed -i "/\[XGame.xDoubleDom\]/,/^$/s/^TimeLimit=.*/TimeLimit=${GAME_DURATION}/" /data/config/UT2004.ini
sed -i "/\[XGame.xBombingRun\]/,/^$/s/^TimeLimit=.*/TimeLimit=${GAME_DURATION}/" /data/config/UT2004.ini
fi

# If $ENABLE_WEB_INTERFACE are ADMIN_PASSWORD are defined, enable web interface in config
if [ "$ENABLE_WEB_INTERFACE" = "1" ] && [ -n "${ADMIN_PASSWORD:-}" ]; then
sed -i '/\[UWeb.WebServer\]/,/^$/s/bEnabled=False/bEnabled=True/' /data/config/UT2004.ini
sed -i "/\[Engine.AccessControl\]/,/^$/s/^AdminPassword=.*/AdminPassword=${ADMIN_PASSWORD}/" /data/config/UT2004.ini
fi

# xVoting configuration to add for Map Voting
MAP_VOTING_CONFIG='
[xVoting.xVotingHandler]
VoteTimeLimit=30
ScoreBoardDelay=10
bAutoOpen=True
MidGameVotePercent=50
bScoreMode=False
bAccumulationMode=False
bEliminationMode=False
MinMapCount=2
MapVoteHistoryType=xVoting.MapVoteHistory_INI
RepeatLimit=4
DefaultGameConfig=0
bDefaultToCurrentGameType=True
bMapVote=True
bKickVote=False
bMatchSetup=False
KickPercent=51
bAnonymousKicking=True
MapListLoaderType=xVoting.DefaultMapListLoader
ServerNumber=1
CurrentGameConfig=0
GameConfig=(GameClass="XGame.xCTFGame",Prefix="CTF",Acronym="CTF",GameName="Capture The Flag",Mutators=,Options=)
GameConfig=(GameClass="XGame.xCTFGame",Prefix="CTF",Acronym="CTF",GameName="Capture The Flag InstaGib",Mutators="XGame.MutInstaGib",Options=)
GameConfig=(GameClass="Onslaught.ONSOnslaughtGame",Prefix="ONS",Acronym="ONS",GameName="Onslaught",Mutators=,Options=)
GameConfig=(GameClass="XGame.xDeathMatch",Prefix="DM",Acronym="DM",GameName="DeathMatch",Mutators=,Options=)
GameConfig=(GameClass="XGame.xDeathMatch",Prefix="DM",Acronym="DM",GameName="DeathMatch InstaGib",Mutators="XGame.MutInstaGib",Options=)
GameConfig=(GameClass="XGame.xBombingRun",Prefix="BR",Acronym="BR",GameName="Bombing Run",Mutators=,Options=)
GameConfig=(GameClass="UT2k4Assault.ASGameInfo",Prefix="AS",Acronym="AS",GameName="Assualt",Mutators=,Options=)
GameConfig=(GameClass="XGame.xDoubleDom",Prefix="DOM",Acronym="DOM",GameName="Double Domination",Mutators=,Options=)
GameConfig=(GameClass="XGame.xTeamGame",Prefix="DM",Acronym="DM",GameName="Team DeathMatch",Mutators=,Options=)

[xVoting.DefaultMapListLoader]
bUseMapList=False
MapNamePrefixes=DM,DOM,CTF,BR,AS,ONS
'

# Function to enable map voting
enable_map_voting() {
if ! grep -q "^\[xVoting\.xVotingHandler\]" "/data/config/UT2004.ini"; then
# Append map voting configuration if section doesn't exist
echo "$MAP_VOTING_CONFIG" >> "/data/config/UT2004.ini"
else
# Enable map voting if the section exists
sed -i 's/^bMapVoting=.*/bMapVoting=True/' "/data/config/UT2004.ini"
fi
}

# if $ENABLE_MAP_VOTING is defined, enable map voting
if [ "$ENABLE_MAP_VOTING" = "1" ]; then
enable_map_voting
fi

# If $CD_KEY is defined, update the server key
if [ -n "${CD_KEY:-}" ]; then
echo \"CDKey\"=\""${CD_KEY}"\" >/data/config/cdkey
Expand Down