Dedicated - UberWaffe/OpenRA GitHub Wiki
Original developer keks-n
Ported into OpenRA by ihptru
Search for dedicated server related bug reports
Linux - works
Windows - works
Mac OSX - works
You can run any Mod as dedicated.
Compile or install the game. You will notice that there is a launch-dedicated.sh shell script that you can run and use as a template for your own starters.
Special notes:
- Using Null Renderer, Null SoundEngine
- Ignores development versions to join
- A first client is admin; if admin leaves, admin rights are assigned to a client who joined the server earlier then any other client.
- A new instance is spawned once previous game is finished (counting that you are using Server.DedicatedLoop=True). If game is started with 1 client, a new instance is spawned immediately (we can destroy OpenRA process - it will not affect client's game)
Special abilities:
- You can configure TimeOut after which started game have to be self-eliminated. Settings option:
Server.TimeOut=value
where <value> is a digit in miliseconds (1000 miliseconds = 1 second)
- You can create a Black-IP-List containing a list of IP addresses which are forbidden to join server. Settings option:
Server.Ban=IP1,IP2,IP3,...,IPn
- Use
Server.LockBots=True
to forbid bots on your server
You can add a MOTD on your server.
release-20131223: create the file motd_ra.txt
, motd_cnc.txt
or motd_d2k.txt
(depending on mod) in the OpenRA Support Directory, which is /home/<user>/.openra/
in Linux.
anything newer then release-20131223: create the file motd.txt
in the OpenRA Support Directory.
Example Scripts:
Here is an example init.d script that uses daemon to run an OpenRA Server (from a shell script within the OpenRA directory) as the user openra.
#!/bin/sh
### BEGIN INIT INFO
# Provides: openra_ded
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Initscript for an OpenRA server
# Description: Starts a dedicated OpenRA server and allows
# it to be started/stopped/restarted with init.d
### END INIT INFO
# Author: Dan9550
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenRA dedicated server"
NAME="openra_ded"
# The executable to use:
DAEMON=/usr/share/openra/start.sh
SCRIPTNAME=/etc/init.d/$NAME
#The game will be executed as this user. NEVER execute as root
USERNAME=openra
#USERNAME must have write access to the HOMEDIR
HOMEDIR=/home/$USERNAME
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start()
{
daemon --name="$NAME" --user=$USERNAME --running && return 1
daemon --name="$NAME" --respawn --user=$USERNAME --output=/home/openra/openra_ded.out --env=HOME=$HOMEDIR $DAEMON > /dev/null
}
do_stop()
{
daemon --name=$NAME --user=$USERNAME --running ] || return 1
daemon --name=$NAME --user=$USERNAME --stop
pkill -f "mono OpenRA*"
}
do_reload() {
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
Below is an example script for automation of OpenRA updates, it is designed to be run daily and could be much more sophisticated. If your server is not running on a Debian based system it should be modified accordingly.
#! /bin/bash
# Magical OpenRA Server (bleed) update script
#
# By Dan9550
# At this point i should stop the current server
/etc/init.d/openra stop
# Gets date, formatted for the download link of course
TODAY=$(date +"%Y%m%d")
# Attempts to download new build
wget http://openra.res0l.net/download/linux/deb/playtest/$TODAY -O /tmp/oraupdate.deb
# Installs new build
dpkg -i /tmp/oraupdate.deb
# Removes the package
rm /tmp/oraupdate.deb
# Server restart
/etc/init.d/openra start
Another example Scripts:
There're very crude, but works.
Auto-building the git version:
cron: * * * * * chroot /srv/wheezy /usr/src/update-openra.sh
/srv/wheezy/usr/src/update-openra.sh
#!/bin/bash
cd /usr/src
update() {
/usr/src/build-openra.sh
}
cleanup() {
lockfile-remove /tmp/update-openra
}
trap cleanup EXIT TERM
lockfile-create /tmp/update-openra
cd openra-bleed
git pull https://github.com/OpenRA/OpenRA.git bleed | grep 'Already up-to-date' >/dev/null || update
cd - >/dev/null
/srv/wheezy/usr/src/update-openra.sh
#!/bin/bash
cd /usr/src
VERSION=$(date +'%Y%m%d%H%M')
cd openra-bleed
make clean
cd -
rm -rf openra-bleed*{gz,deb,dsc} openra-bleed_* openra-bleed/debian
cp -Rp openra-bleed openra-bleed_$VERSION
cd openra-bleed_$VERSION
hash=$(git log | head -1 | awk '{print $2}')
shorthash=${hash:0:4}
for patch in $(cat ../openra-patches/series); do
sed -e "s/bleed-XXXX/bleed-$shorthash/g" < ../openra-patches/$patch | patch
done
for file in mods/*/mod.yaml; do
mv "$file" "$file"~
sed -e "s/{DEV_VERSION}/bleed-$shorthash/g" > "$file" < "$file"~
done
cd -
tar -czf openra-bleed_$VERSION.tar.gz openra-bleed_$VERSION
cd openra-bleed_$VERSION
make dependencies
dh_make -e [email protected] -f ../openra-bleed_$VERSION.tar.gz -p openra-bleed_$VERSION -C s -y
printf 'override_dh_auto_build:\n\tmake all\n\n' >> debian/rules
echo correction | dpkg-source --commit -q
dpkg-buildpackage -rfakeroot
cd -
cat *deb > builds/openra-bleed.deb-new
if [ "$(stat -c %s builds/openra-bleed.deb-new)" -gt "0" ]; then
cat builds/openra-bleed.deb-new > builds/openra-bleed.deb
echo "$hash" > builds/bleed-hash
fi
rm -f "builds/openra-bleed.deb-new"
Auto-updating the servers:
cron:
* * * * * /usr/local/sbin/openra-bleed-update.sh
* * * * * /usr/local/sbin/openra-release-update.sh release
* * * * * /usr/local/sbin/openra-release-update.sh playtest
/usr/local/sbin/openra-bleed-update.sh
#!/bin/bash
HASHURL='http://openra.ipdx.ru:82/deb/bleed-hash'
DEBURL='http://openra.ipdx.ru:82/deb/openra-bleed.deb'
newhash=$(wget "$HASHURL" -O - -o /dev/null)
oldhash=$(cat /home/openra/chroot/bleed-hash)
if [ "$newhash" = "" ]; then
exit;
fi
if [ "$newhash" != "$oldhash" ]; then
wget "$DEBURL" -O /home/openra/chroot/tmp/openra-bleed.deb -o -
chroot /home/openra/chroot mkdir -p /usr/local/openra/bleed/current
chroot /home/openra/chroot rm -rf /usr/local/openra/bleed/current/*
chroot /home/openra/chroot dpkg --force-all --instdir /usr/local/openra/bleed/current -i /tmp/openra-bleed.deb
kill $(netstat -nap | grep :1[234]2[0-9]\ | tr "/" " " | awk '{print $7}')
echo "$newhash" > /home/openra/chroot/bleed-hash
fi
/usr/local/sbin/openra-release-update.sh
#!/bin/bash
PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
TYPE="$1"
URL=$(wget 'http://openra.res0l.net/download/linux/deb/' -o /dev/null -O - | grep "$TYPE/[0-9]" | head -1 | awk -F '"' '{print $2}')
VERSION=${URL##*/}
OLDVERSION=$(cat /home/openra/chroot/"$TYPE"-version)
case "$TYPE" in
release)
n=3
;;
playtest)
n=4
;;
esac
if [ "$VERSION" = "" ]; then
exit;
fi
if [ "$VERSION" != "$OLDVERSION" ]; then
wget "http://openra.res0l.net$URL" -O "/home/openra/chroot/tmp/openra-$TYPE-${VERSION}.deb" -o -
chroot /home/openra/chroot mkdir -p "/usr/local/openra/$TYPE/${VERSION}"
chroot /home/openra/chroot dpkg --force-all --instdir "/usr/local/openra/$TYPE/${VERSION}" -i "/tmp/openra-$TYPE-${VERSION}.deb"
chroot /home/openra/chroot rm -f "/usr/local/openra/$TYPE/current"
chroot /home/openra/chroot ln -sf "${VERSION}" "/usr/local/openra/${TYPE}/current"
kill $(netstat -nap | grep :1[234]${n}[0-9]\ | tr "/" " " | awk '{print $7}')
echo "$VERSION" > /home/openra/chroot/$TYPE-version
fi
How are the servers runned:
cat /etc/rc.local
screen -dm -S openrarel_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1230 release"
screen -dm -S openrarel_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1231 release"
screen -dm -S openrarel_2 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1232 release"
screen -dm -S openrarel_3 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1233 release"
screen -dm -S openrarel_4 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1234 release"
screen -dm -S openrarel_5 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1235 release"
screen -dm -S openrarel_6 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1236 release"
screen -dm -S openrarel_7 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1237 release"
screen -dm -S openracncrel_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_cnc.sh 1330 release"
screen -dm -S openracncrel_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_cnc.sh 1331 release"
screen -dm -S openrad2krel_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_d2k.sh 1430 release"
screen -dm -S openrad2krel_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_d2k.sh 1431 release"
screen -dm -S openrapt_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1240 playtest"
screen -dm -S openrapt_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1241 playtest"
screen -dm -S openrapt_2 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1242 playtest"
screen -dm -S openrapt_3 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1243 playtest"
screen -dm -S openrapt_4 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1244 playtest"
screen -dm -S openrapt_5 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1245 playtest"
screen -dm -S openracncpt_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_cnc.sh 1340 playtest"
screen -dm -S openracncpt_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_cnc.sh 1341 playtest"
screen -dm -S openrad2kpt_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_d2k.sh 1440 playtest"
screen -dm -S openrad2kpt_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_d2k.sh 1441 playtest"
screen -dm -S openrableed_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1220 bleed"
screen -dm -S openrableed_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start.sh 1221 bleed"
screen -dm -S openracncbleed_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_cnc.sh 1320 bleed"
screen -dm -S openracncbleed_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_cnc.sh 1321 bleed"
screen -dm -S openrad2kbleed_0 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_d2k.sh 1420 bleed"
screen -dm -S openrad2kbleed_1 chroot /home/openra/chroot su -l openra -c "/home/openra/bin/start_d2k.sh 1421 bleed"
/home/openra/chroot/home/openra/bin/start.sh
#!/bin/bash
Name="xaionaro_hetzner_$2"
Mod="ra"
Dedicated="True"
DedicatedLoop="True"
ListenPort="$1"
ExternalPort="$1"
AdvertiseOnline="True"
#Map="ba403f6bcb4cae934335b78be42f714992b3a71a"
#Map="399372de425c9e8e9d49df90fbbc467dcfc52ac7"
# Haos Ridges
Map="3bc995f925d5b1a894513fb3e570ce22784adcf1"
while true; do
cd "/usr/local/openra/$2/current/usr/share/openra" 2>/dev/null ||
cd "/usr/local/openra/$2/current/usr/local/share/openra" 2>/dev/null ||
cd "/usr/local/openra/$2/current/usr/share/openra-bleed" 2>/dev/null ||
cd "/usr/local/openra/$2/current/usr/local/share/openra-bleed"
if [ "$2" = "release" ]; then
mono OpenRA.Game.exe Game.Mod=$Mod Server.Dedicated=$Dedicated Server.DedicatedLoop=$DedicatedLoop \
Server.Name=$Name Server.ListenPort=$ListenPort Server.ExternalPort=$ExternalPort \
Server.AdvertiseOnline=$AdvertiseOnline Server.Map=$Map
else
mono OpenRA.Game.exe Game.Mod=$Mod Server.Dedicated=$Dedicated Server.DedicatedLoop=$DedicatedLoop \
Server.Name=$Name Server.ListenPort=$ListenPort Server.ExternalPort=$ExternalPort \
Server.AdvertiseOnline=$AdvertiseOnline Server.Map=$Map
fi
done
To synchronize maps from http://resource.openra.net use this guide.