[TUTORIAL] Hosting server on Linux

A modification for the popular game 'Bed Companion 2'.
User avatar
Posts: 353
Joined: Mon Dec 17, 2012 4:48 pm
Location: Poland
PostPosted: Tue Dec 18, 2012 6:40 pm
A little guide I made for another game, but after a few changes it still works with Bed Companion 2 Server :) This will allow you to run 24/7 server on your headless (command line only) Linux. If you are running it on a system with a graphical desktop environment, you don't need to install Xvfb or x11vnc and you can skip steps 4 through 7.

REQUIREMENTS

On your remote server:
Server files - if you don't have them, ask around. We won't provide them to you.
libgl1-mesa-dev - Mesa OpenGL libraries
WINE - preferably newest version you can get
Xvfb - framebuffer emulator. This utility will allow you to run GUI applications on your headless server.
x11vnc - VNC server. Thanks to this utility, you will be able to interact with GUI applications on your remote server using a VNC client.
winetricks - required to easily download and install some required libraries


On your local machine:
VNC client. On Linux you can use gvncviever, on Windows tightvnc.


Setting up server

1. Download server files and extract them:

Code: Select all
wget <link to server files>
unrar x BFBC2_Server_R32_Full.rar


Then go to your extracted directory:

Code: Select all
cd BFBC2_Server_R32_Full



2. Make sure you have the lastest server hook (dinput8.dll) in your game/server directory. Look on the forums or ask on #emulatornexus IRC channel.


3. Install dinput8:

Code: Select all
winetricks dinput8


Alternatively, you can rename dinput8.dll to xinput1_3.dll


4. Start Xvfb

Code: Select all
Xvfb :1 -screen 0 800x600x16 &



5. If it's the first time you are running the VNC server you need to generate a new password:

Code: Select all
x11vnc -storepasswd



6. Now you can start your VNC server

Code: Select all
x11vnc -display :1  -bg -forever -rfbauth ~/.vnc/passwd



7. Set your DISPLAY environment variable

Code: Select all
export DISPLAY=:1



8. Conect to your VNC server and install Visual C++ runtime libraries:

Code: Select all
winetricks vcrun2005
winetricks vcrun2008
winetricks vcrun2010



9. Modify your server options in /Instance/ServerOptions.ini
MAKE SURE TO CHANGE YOUR ADMIN PASSWORD!


10. And finally, start your server

Code: Select all
wine Frost.Game.Main_Win32_Final.exe -serverInstancePath "Instance/" -mapPack2Enabled 1 -port 19567 -timeStampLogNames -region OC -heartBeatInterval 20000




Known problems

1. The server cannot be normally shut down once started, so it's best to run it in a screen session. When you want to shut it down, just kill its process:

Code: Select all
kill -9 `ps x | grep Frost | grep -v grep | gawk '{print $1}'`



2. The server crashes sometimes. You can verify wether it's working or not by checking your VNC server.

Alternatively, you can make your server not display any errors, by adding the following parameteers to your startup command:

Code: Select all
-displayErrors 0 -displayAsserts 0


If you do this, remember, that this doesn't prevent the errors from happening. It just hides them. Keep that in mind, especially if you run into some problems with your server.


3. Failed to use ICMP (network ping), this requires special permissions.

This happens if you are running the server on a limited (non-root) account. To solve it, type:

Code: Select all
sudo setcap cap_net_raw+epi /usr/bin/wine-preloader


More information can be found here:

http://wiki.winehq.org/FAQ#head-acdec64 ... 02576e6a63

Thanks to Vaques for letting me know about it!


Useful links

Getting procon to work 24/7 on Linux
Configuring your server
Where to look for server files
Where to find the latest hook (Download section)
Last edited by CactusPie on Sat Dec 22, 2012 7:31 pm, edited 5 times in total.

Posts: 12
Joined: Tue Dec 18, 2012 10:06 am
PostPosted: Wed Dec 19, 2012 1:13 pm
Hello,

How much free memory does the server need to run the bc2 server files please?

Posts: 37
Joined: Mon Dec 17, 2012 7:56 pm
PostPosted: Wed Dec 19, 2012 3:11 pm
lycanwrath wrote:Hello,

How much free memory does the server need to run the BeeCeeToo server files please?

The server (without players) needs about 100 MB Ram while idling.

A server with 12 players needs about 200 MB Ram.
<NoFaTe>stupid people
User avatar
Posts: 167
Joined: Tue Dec 18, 2012 4:35 pm
PostPosted: Sat Dec 22, 2012 1:31 pm
I am sticking this post as it has proven to be helpful to many people, but please explain in more detail on how to install the prerequisites such as winetricks.

Thanks,
Imposter
Well, I am real, aren't I?

Posts: 37
Joined: Mon Dec 17, 2012 7:56 pm
PostPosted: Sat Dec 22, 2012 4:22 pm
For myself I was running the server in a screen session like this:
Code: Select all
screen -AmdS $SCREEN wine Frost.Game.Main_Win32_Final.exe -port $IP:$PORT -numGameClientSlots $SLOTS -serverInstancePath "Z:$INSTANCEDIR" -displayErrors 0 -displayAsserts 0 -crashDumpAsserts 0 -heartBeatInterval 20000 -plasmaServerLog 0 -crashDumpErrors 1 -timeStampLogNames -mapPack2Enabled 1 -region EU


You can kill it by closing the screen:
Code: Select all
screen -dr $SCREEN -X quit
<NoFaTe>stupid people
User avatar
Posts: 353
Joined: Mon Dec 17, 2012 4:48 pm
Location: Poland
PostPosted: Sat Dec 22, 2012 7:33 pm
Imposter wrote:I am sticking this post as it has proven to be helpful to many people, but please explain in more detail on how to install the prerequisites such as winetricks.


Aye, I will write something up later. Although this will probably vary depending on the distro you use.

Posts: 2
Joined: Mon Jan 28, 2013 8:40 pm
PostPosted: Fri Feb 01, 2013 12:44 am
hi,
I'm sorry for my English first bad. Explained above, we need to do to run the game after installing a single thing on the following library.

apt-get install libgl1-mesa-swx11-dev

My distro is ubuntu server 12,10 i386

EAKGAMING COM

Posts: 1
Joined: Tue Feb 19, 2013 6:43 pm
PostPosted: Tue Feb 19, 2013 6:47 pm
Hi,
is it possible with this Linux-Server to host a BF:BC2 Game in a LAN with a Internet-Connection to verify the account with the EA-Servers? It would be great if you could play BF: BC2 on Lan-Parties with that.
User avatar
Posts: 1524
Joined: Mon Dec 17, 2012 8:50 pm
PostPosted: Tue Feb 19, 2013 8:46 pm
Bobbobbsen wrote:Hi,
is it possible with this Linux-Server to host a BF:BC2 Game in a LAN with a Internet-Connection to verify the account with the EA-Servers? It would be great if you could play BF: BC2 on Lan-Parties with that.


LAN will probably be implemented in a future revision.
Image

Posts: 2
Joined: Tue Apr 16, 2013 9:21 pm
PostPosted: Sun Apr 28, 2013 1:59 pm
Hello,
got a popup with "Unable to find a volume for file extraction" when executing "winetricks vcrun2008". Same for the 2010.
Running on dedicated Debian

Also, got this when trying to start the server (without all lib ?):
Code: Select all
err:module:import_dll Library d3dx10_42.dll (which is needed by L"Z:\\root\\BFBC2\\BFBC2_Server_R30_Full\\Frost.Game.Main_Win32_Final.exe") not found
err:module:import_dll Library MSVCP100.dll (which is needed by L"Z:\\root\\BFBC2\\BFBC2_Server_R30_Full\\XINPUT1_3.dll") not found
err:module:import_dll Library MSVCR100.dll (which is needed by L"Z:\\root\\BFBC2\\BFBC2_Server_R30_Full\\XINPUT1_3.dll") not found
err:module:import_dll Library XINPUT1_3.dll (which is needed by L"Z:\\root\\BFBC2\\BFBC2_Server_R30_Full\\Frost.Game.Main_Win32_Final.exe") not found
err:module:import_dll Library d3d9.dll (which is needed by L"Z:\\root\\BFBC2\\BFBC2_Server_R30_Full\\Frost.Game.Main_Win32_Final.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"Z:\\root\\BFBC2\\BFBC2_Server_R30_Full\\Frost.Game.Main_Win32_Final.exe" failed, status c0000135


Thanks if you can help ;-)
Next

Return to Rome

Who is online

Users browsing this forum: Google Adsense [Bot], Pist0nsfan and 2 guests