Skip to content

Commit

Permalink
Fix for running multiple gameservers
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuettner committed Oct 7, 2021
1 parent e9b0720 commit fd3069f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ The easiest way to start your own BFBC2 LAN-Server is to use [docker-compose](ht
docker-compose up -d
```

this command will start up both servers with default configurations.
this command will start up the master-server and two game-servers (ruah and sqdm) with default configurations.

alternatively you can run the docker-images manually:

```sh
# master-server
docker run \
docker run -t \
-d --net=host \
quay.io/docker-gameserver/bfbc2-master-server

Expand All @@ -49,7 +49,7 @@ To enable persistence you have to create a local database folder and mount it to

```sh
mkdir ./database
docker run \
docker run -t \
-d --net=host \
-v "./database:/home/bfbc2/database" \
quay.io/docker-gameserver/bfbc2-master-server
Expand Down Expand Up @@ -100,6 +100,10 @@ docker run \
quay.io/docker-gameserver/bfbc2-server
```

## Multiple Game-Server

make sure that you have unique `SERVER_PORT` and `SERVER_ADMIN_PORT` env variables set per server instance.

# Build

Naturally you do not have to use the pre-build images from docker-hub. Simply build your own images:
Expand Down
26 changes: 22 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ version: "3"

services:

bfbc2-master-server:
master-server:
image: quay.io/docker-gameserver/bfbc2-master-server
# build: ./master-server
#build: ./master-server
restart: always
network_mode: "host"
tty: true # for real-time output
volumes:
- "./database:/home/bfbc2/database"
# - "./custom-config.ini:/home/bfbc2/config.ini"

bfbc2-server:
rush-server:
image: quay.io/docker-gameserver/bfbc2-server
# build: ./game-server
#build: ./game-server
restart: always
network_mode: "host"
environment:
MASTER_SERVER: "127.0.0.1"
Expand All @@ -22,3 +25,18 @@ services:
SERVER_ADMIN_PORT: 48888
SERVER_ADMIN_PASSWORD: "langaming"
SERVER_MAX_PLAYERS: 8

sqdm-server:
image: quay.io/docker-gameserver/bfbc2-server
#build: ./game-server
restart: always
network_mode: "host"
environment:
MASTER_SERVER: "127.0.0.1"
SERVER_TYPE: "sqdm"
SERVER_NAME: "SQDM LAN-Server"
SERVER_PORT: 19568
SERVER_ADMIN_PORT: 48889
SERVER_ADMIN_PASSWORD: "langaming"
SERVER_MAX_PLAYERS: 8

4 changes: 2 additions & 2 deletions game-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ USER bfbc2
ENV WINEARCH=win32 \
WINEPREFIX="/home/bfbc2/.wine32"

RUN wineboot \
&& xvfb-run winetricks -q \
RUN xvfb-run -e /dev/stdout -a -s "-nolisten tcp -screen 0 1280x1024x24" wineboot \
&& xvfb-run -e /dev/stdout -a -s "-nolisten tcp -screen 0 1280x1024x24" winetricks -q \
dinput8 \
vcrun2005 \
vcrun2008 \
Expand Down
9 changes: 4 additions & 5 deletions game-server/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cat <<EOF >bfbc2.ini
host=${MASTER_SERVER}
connect_to_retail=0
executable_type=auto
show_console=0
show_console=1
[client]
reroute_http=0
Expand Down Expand Up @@ -56,16 +56,15 @@ function start_bfbc2_server() {
write_config "${SERVER_PATH}"

echo "Starting ${SERVER_MODE} server ..."
rm -f "${SERVER_PATH}maplist.txt"
ln -s "/home/bfbc2/server/maplists/${MAPLIST_PATH}" "${SERVER_PATH}maplist.txt"

sleep 1

xvfb-run wine "Frost.Game.Main_Win32_Final.exe" \
xvfb-run -e /dev/stdout -a -s "-nolisten tcp -screen 0 1280x1024x24" wine "Frost.Game.Main_Win32_Final.exe" \
-serverInstancePath "${SERVER_PATH}" \
-mapPack2Enabled 1 \
-timeStampLogNames \
-region OC \
-heartBeatInterval 20000
-heartBeatInterval 20000
}

shopt -s nocasematch
Expand Down

0 comments on commit fd3069f

Please sign in to comment.