Author Topic: HowTo: Set up a Linux Crysis Wars dedicated server  (Read 25584 times)

0 Members and 1 Guest are viewing this topic.

Offline HAARP

  • Living Legend
  • *******
  • Posts: 2335
  • l33tp0intz: +212/-1
  • I regret nothing
    • Clan Jade Wolf
HowTo: Set up a Linux Crysis Wars dedicated server
« on: December 26, 2010, 05:46:09 AM »
EDIT: This is massively out of date. If you still need to run such a server, please post here and I will update it.

Hello.

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! :)


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

Code: [Select]
#!/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
        startserver

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

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

else
        while true; do
                pidof Xvfb && killall Xvfb
                sleep 2
                startserver
                sleep 4
        done
fi

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.
« Last Edit: June 21, 2013, 05:16:35 PM by HAARP »
don't bother sending me PMs, I probably won't be reading them in time.

Offline CapperDeluxe

  • MWLL Developer
  • Living Legend
  • *
  • Posts: 2910
  • l33tp0intz: +162/-0
  • Life is cheap, mechs are expensive.
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #1 on: December 26, 2010, 05:58:43 AM »
cool i hope this will work for others, makes rebooting a thing of the past :)

Offline (TLL)Siilk

  • Techpriest software engineer
  • Apprentice Dev
  • Living Legend
  • *
  • Posts: 3059
  • l33tp0intz: +140/-7
  • A single trueborn is an army by himself
    • My facebook profile
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #2 on: December 26, 2010, 08:06:56 AM »
 Excellent work, HAARP! Now all those Linux boxen wouldn't be idling when 0.4.0 would come out. An xmas cookie for you! :)



"This Clan posses intelligence, the burning passion of true hunters, and a spirit that serves as a beacon to the rest. I mingle my blood with the Wolves."
- ilKhan Nicholas Kerensky, Strana Mechty, 2815

Offline Seraph

  • Lead Developer
  • Living Legend
  • *
  • Posts: 4183
  • l33tp0intz: +124/-1
    • The Living Legends Mercenary Unit
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #3 on: December 26, 2010, 08:16:19 AM »
@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!
Seraph - "The Can Man"
In the heat of battle, legends are born ...



Offline HAARP

  • Living Legend
  • *******
  • Posts: 2335
  • l33tp0intz: +212/-1
  • I regret nothing
    • Clan Jade Wolf
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #4 on: December 26, 2010, 07:24:49 PM »
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! :)
don't bother sending me PMs, I probably won't be reading them in time.

Offline CHH Siege

  • Lead Texture Artist
  • MWLL Developer
  • Lance Captain
  • *
  • Posts: 564
  • l33tp0intz: +44/-0
  • Inveniemus Viam Aut Faciemus
    • Clan Hell's Horses: Gamma Galaxy Reborn
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #5 on: December 26, 2010, 10:37:19 PM »
+1 for awesome



Proud designer of the Mk II E 'Siege Engine' and the 'Perseus'...
Lo-Wang say, "Animated .gif is worth one mega-word."

Offline aTolyK

  • Lance Sergeant
  • **
  • Posts: 433
  • l33tp0intz: +13/-0
  • Prepare to be confused
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #6 on: December 27, 2010, 05:40:02 PM »
awesome! sad that most friends (and me too, not that it matters YET) run (X)(K)Ubuntu  ;D
Are we here yet?

Dwarf Fortress: The weak shall be culled, so the strong can have nicer socks.

I killed stuff with Sparrowhawks in 0.3.2

Offline Seraph

  • Lead Developer
  • Living Legend
  • *
  • Posts: 4183
  • l33tp0intz: +124/-1
    • The Living Legends Mercenary Unit
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #7 on: December 27, 2010, 06:49:09 PM »
awesome! sad that most friends (and me too, not that it matters YET) run (X)(K)Ubuntu  ;D

Which is Debian at its core so you won't have any issues. Besides the XServer being installed that is ... :(
Seraph - "The Can Man"
In the heat of battle, legends are born ...



Offline aTolyK

  • Lance Sergeant
  • **
  • Posts: 433
  • l33tp0intz: +13/-0
  • Prepare to be confused
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #8 on: December 27, 2010, 07:02:04 PM »
which is what I meant...  ::)
silly ubuntu devs  ;D ...  >:(

(guess I'll tell 'em to stick to windows for now. sadly almost the only times I get some MWLL in are the lan parties  :'( but that shall change soon)
Are we here yet?

Dwarf Fortress: The weak shall be culled, so the strong can have nicer socks.

I killed stuff with Sparrowhawks in 0.3.2

Offline HAARP

  • Living Legend
  • *******
  • Posts: 2335
  • l33tp0intz: +212/-1
  • I regret nothing
    • Clan Jade Wolf
Re: HowTo: Set up a Crysis server on a headless *Linux* machine
« Reply #9 on: January 02, 2011, 09:36:59 PM »
Updated for Wars/0.4
don't bother sending me PMs, I probably won't be reading them in time.

Offline SquareSphere

  • Living Legend
  • *******
  • Posts: 5176
  • l33tp0intz: +228/-6
  • pancake slinging, Square (care) Bear of MWLL
    • 12th Vegan Rangers - Boards
Re: HowTo: Set up a Linux Crysis Wars dedicated server
« Reply #10 on: January 05, 2011, 07:05:02 PM »
very nice HAARP

Offline sleet01

  • Recruit
  • *
  • Posts: 153
  • l33tp0intz: +5/-0
Re: HowTo: Set up a Linux Crysis Wars dedicated server
« Reply #11 on: January 06, 2011, 10:53:49 PM »
I've been toying with the idea of setting up a 24-slot Windows VM server on one of the game-oriented server farm services.  Is there any reason to go with a *Nix server and Wine rather than a Windows image or machine?  I mean, outside of the machine already being available, the tools being free and open-source, etc. 

Offline HAARP

  • Living Legend
  • *******
  • Posts: 2335
  • l33tp0intz: +212/-1
  • I regret nothing
    • Clan Jade Wolf
Re: HowTo: Set up a Linux Crysis Wars dedicated server
« Reply #12 on: January 07, 2011, 03:51:57 AM »
Don't use VMs. They offer less performance than a natively running application and usually suffer from bottlenecks. If you want to run this on an Unix machine, I highly recommend Wine instead.
It certainly is a matter of knowledge and preferences. I'm assuming you know why Linux is most often being used in server environments? Speed, stability, security, simplicity, free environment, powerful tools, etc. On the other hand people coming from the Windows world may need to relearn a few things. ;) If you're interested in doing other stuff than only gameservers on this machine, or if security is a concern, use Linux. Otherwise, whatever ;)
don't bother sending me PMs, I probably won't be reading them in time.

Offline sleet01

  • Recruit
  • *
  • Posts: 153
  • l33tp0intz: +5/-0
Re: HowTo: Set up a Linux Crysis Wars dedicated server
« Reply #13 on: January 07, 2011, 07:20:42 PM »
Been there, done that, got the tee-shirt... started the community college LUG.  *Nix machines outnumber Windows boxes at home by 50% and at work by 75%, but I'm not looking to admin another box at the moment.  I'd just want to set and forget a single Wars/MWLL server so I could mess around with the settings and provide some service to the community.  To that end, I'd think that one of the OSes the server *was* written for would be a better platform than Linux and WINE, no matter how good WINE has gotten.  So I was just wondering what the impetus for using Linux and WINE in this particular instance was.

Offline HAARP

  • Living Legend
  • *******
  • Posts: 2335
  • l33tp0intz: +212/-1
  • I regret nothing
    • Clan Jade Wolf
Re: HowTo: Set up a Linux Crysis Wars dedicated server
« Reply #14 on: January 07, 2011, 08:44:42 PM »
Wine has gotten a long way in the past few years. It supports a lot and works very well for many apps. As far as the ded is concerned, you won't find many differences, there isn't really an advantage or disadvantage. It's just as stable, just as fast and almost as simple. A basic shell script will keep the server running if it crashes (unrelated to Wine). You will lack the pretty interface to input commands and show you logs, although that can also be done with Rcon/logfiles. But honestly, I'd rather use rcon than VNC to connect to the server to access a console window _
don't bother sending me PMs, I probably won't be reading them in time.