Beta Discussion > Dedicated Server Discussion

HowTo: Set up a Linux Crysis Wars dedicated server

(1/16) > >>

EDIT: This is massively out of date. If you still need to run such a server, please post here and I will update it.


With the recent news that MWLL will not run on the Wars Linux ded despite it being a native application, I decided to take matters into my own hands.

This Howto applies to both Crysis and Crysis Wars. Only minor changes in the paths are necessary to switch.

Why would you want to do this? Well, as those who know something about servers know, Linux just can't be beaten in that market. It is way more stable, mature and versatile than a Windows-based server and remains lightweight due to lack of a GUI (if you wish so). The majority of the server market these days is Linux-based, and I intend to enable the Crysis server (a Win-only app) to be run this way.

Let's get started.

1) Limitations
- There will be no fancy console window that you can enter server commands into. Rcon will be the only way to manage it. Logs can easily be extracted from the logfile.

2) Requirements
- A Linux-based server with root access; it does not need a graphics card.
- Linux knowledge. I will try to keep this simple, but it will not be a "Jimmy's first Linux server" type of tutorial.
- Wine. Wine is an application layer that allows Windows programs to be run on Linux machines. It is not an emulator, it won't make the server slower than a native Windows machine.
- Xvfb. See below.

3) Explanation
The problem we are facing is the fact that virtually all Windows programs are GUI-based, and therefore require a graphical desktop. That's fine and dandy if your server, for some reason, has an X-server (=graphical desktop) installed, but it will become a problem if you run it on a proper, headless server. That's where Xvfb comes in. It is kind of a fake X-server. There's no input, there's no output. All it does is act like a desktop to the program while actually dumping everything into an information black hole. Light-weight, fast and clever. Perfect for our task at hand!

4) Steps
I will assume that the user running the server will be 'haarp'

- Install Wine. Make sure your distro offers a recent Wine. 1.1.42 should allow you to run the server, but an even newer Wine is needed for Rcon to work! As of now, 1.3.11 is the newest version and it works fine.
Debian/Ubuntu users might want to have a look here or here.

- Install Xvfb and GLX. For Debian: aptitude install xvfb libgl1-mesa-glx

- Install and patch Crysis Wars on a Windows machine, then install MWLL, then copy it to the Linux machine. You can upgrade MWLL in the future by extracting the archives from the Windows updater into the MWLL folder manually.
You'll want to put it into /home/haarp/.wine/drive_c/Games/CrysisWars or a similiar folder. Make sure your user is the owner of all files.

- Install Microsoft's vcrun2005 package into your user's Wine. This is not possible without an GUI, so we're going to extract an already-installed "windows folder".
Download it and extract it into /home/haarp/.wine/drive_c/windows. Make sure the path is correct and that all the files belong to your user!

- Configure the server like usual, server.cfg and stuff. The wiki and the Crysis Wars server documentation help. Don't forget rcon, you'll need it.

- We are now ready to run the server. You might want to write your own scripts to handle server crashes and such. That is not going to be part of this tutorial, although I might add one later.
The command to run the server through Xvfb and Wine is as follows (adjust for your paths!!!):
xvfb-run -s "-screen 0 800x600x24" wine /home/haarp/.wine/drive_c/Games/CrysisWars/Bin32/CrysisWarsDedicatedServer.exe -mod MWLL -root C:/Games/CrysisWars/server +exec server.cfg

This creates a Xvfb session to run the server in. Don't forget the screen part or it won't run.
We need to run it through Wine, of course.
The regular Crysis ded command line. Make sure to use uppercase MWLL and forward slashes. I'm assuming your levelrotation.xml and server.cfg is in a folder called server in the CrysisWars root dir. All logs and other runtime files will also go there.

Well, here we go! It should be running now. You can kill it by pressing Ctrl+C.
You can verify it's status by logging into it with rcon or by watching the log. To do that, open a new session or put it in the background, then use tail -f on the log file:
tail -f /home/haarp/.wine/drive_c/Games/CrysisWars/server/Server.log
This provides live updates of the current log. Exit with Ctrl+C.

Attention: If Xvfb and Wine seem to start but then hang prior to launching the server, you might want to kill the process with "Gecko" in its command line. It opens a window prompt that's not visible without a desktop. Just kill the process and it should continue. This is only needed once.

That's it in a nutshell! Feel free to ask if something is not clear or doesn't work.
Enjoy! :)

This is the server script that =CJW= Funbocks is using. Save it as and make it executable.

--- Code: ---#!/bin/bash

startserver() {
        xvfb-run -s "-screen 0 800x600x24" \
        wine "/home/haarp/.wine/drive_c/Games/CrysisWars/Bin32/CrysisWarsDedicatedServer.exe" \
        -mod MWLL -root "C:/Games/CrysisWars/server" +exec server.cfg

if [[ $1 = single ]]; then

elif [[ $1 = boot ]]; then
        wineserver -k

elif [[ $1 = stop ]]; then
        pidof Xvfb && killall Xvfb
        wineserver -k

        while true; do
                pidof Xvfb && killall Xvfb
                sleep 2
                sleep 4
--- End code ---

Once launched it will continue to restart the MWLL server, should it crash or otherwise go down. You can also restart the server manually by starting the script with the 'boot' parameter or stop it completely with 'stop'. If you're not interested in automatic restarts, just use 'single' as a parameter.

cool i hope this will work for others, makes rebooting a thing of the past :)

 Excellent work, HAARP! Now all those Linux boxen wouldn't be idling when 0.4.0 would come out. An xmas cookie for you! :)

@HAARP: Each install (full or update) will by default keep the update files on disk for either putting them into uTorrent (or similar torrent client) or for an easy upload to a game server. Those files are regular ZIP files that can be extracted. The only files distributed in an installer are he launcher and auto updater (which are optional for a server).

Hope that helps!

Tutorial is updated. I tested it on my own Debian-based server and it ran, tested it with 2 people playing on it.
I'd appreciate it if someone could try this out to see if it works for others and whether I missed anything!

Have fun! :)


[0] Message Index

[#] Next page

Go to full version