Nolf2srv 1.4M Dedicated Linux Server

General Nolf2

Post Reply
User avatar
Spawn
Admin
Admin
Posts: 1312
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Nolf2srv 1.4M Dedicated Linux Server

Post by Spawn » Mon Apr 18, 2022 4:42 am

Linux distro usedLinux Mint 20.3 Cinnamon v5.2.7
Linux Kernel5.4.0-107-generic
Winetricks version20220411
Wine version7.0


1) Install Wine

Wine is an open-source compatibility layer that allows you to run Windows applications on Unix-like operating systems such as Linux. I will be installing the latest stable version from winehq.org in this setup.

Open up a terminal

If your system is 64 bit, enable 32 bit architecture:

Code: Select all

sudo dpkg --add-architecture i386
Download and add the repository key:

Code: Select all

wget -nc https://dl.winehq.org/wine-builds/winehq.key

Code: Select all

sudo mv winehq.key /usr/share/keyrings/winehq-archive.key
Add the repository:

Code: Select all

wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources

Code: Select all

sudo mv winehq-focal.sources /etc/apt/sources.list.d/
Update packages:

Code: Select all

sudo apt update

Code: Select all

sudo apt install --install-recommends winehq-stable


2) Install Winetricks

The normal install is either through the software manager or command line:

Code: Select all

sudo apt-get install winetricks
Update it:

Code: Select all

sudo winetricks --self-update


3) Setup a wine Prefix for Nolf2

Just to explain this concept so that people who aren't used to dealing with this will understand how it works, a few programs such as NOLFSrv.exe for Nolf1 will run out of the box without any extra dependencies. Other software like Nolf2Srv.exe needs extra windows components in order to function.

I have my custom wine prefixes (also refered to as wine bottles) in a directory named Wine in my user's home directory.
Each program should have its own prefix, unless they are somewhat related and runs with the same dependencies.

So in a nutshell:
Image

Here are 3 examples that have their own separate registry, dll files, C:\ drive and other windows components.
This is where Winetricks becomes relevant. You use this program to choose what extra components the program needs to function.

Let's create a wine prefix for Nolf2

From this point forward, you won't need sudo rights to configure the rest. This means that you can create a user with limited privileges who will run the game server.

Nolf2 is a win32 application, so we specify that with WINEARCH=win32, we also want to create the wine prefix, and last we put in the wine command that will create this prefix. I also prefer short names on folders when dealing with terminal, less to write and less problems with spaces. So I'll name my prefix folder nolf2 rather than No-One-Lives-Forever-A-Spy-In-Harms-Way.

Code: Select all

WINEARCH=win32 WINEPREFIX=~/Wine/nolf2 winecfg
(~ is short for /home/<your username>)

After running this command, this window will eventually appear:

Image

I'll choose Windows 7 here because I am not sure how the 2015 C++ redistributables will react to for example Windows XP.

You can then close the window.

To make Nolf2Srv run in wine, you'll need a couple of dependencies
Back in your terminal change the last word to winetricks

Code: Select all

WINEARCH=win32 WINEPREFIX=~/Wine/nolf2 winetricks
This window will magically appear

Image

Select the default wine prefix

Image

And choose to install a windows dll or component

Image

vb6run should take care of the original code for the game
vcrun2015 or newer should work just fine for the modernizer code
vcrun6 I suspect that I needed this in order to pass arguments to NOLF2Srv

Install these and most likely ignore a lot of errors, if they don't install all at once, try installing them one by one.

When you're back to the main windows in winetricks, you click cancel to exit.

Tada, the prefix is ready!



4) Copy over Nolf2

When you go into Wine --> nolf2 (your wineprefix) you will find a bunch of newly created stuff
This folder named drive_c is now your C:\ drive

Image

In there you will also find some familiar windows component that has a minimum of what Nolf2Srv needs to function

Image

This is where I make another folder named nolf2, and copy the game (in preinstalled form) into it.

To finally test if the whole thing even runs, type this into your terminal

Code: Select all

WINEPREFIX=~/Wine/nolf2 wine ~/Wine/nolf2/drive_c/nolf2/nolf2srv.exe
Image

If everything works, you should see this, you may or may not be able to choose a profile to load. I could never get the dropdown menu for profiles show up. ERROR - Unable to load resources simply means that it cannot find your profiles.

To load the server with a flag/argument you will need to alter the command slightly

Code: Select all

WINEPREFIX=~/Wine/nolf2 wine start /unix ~/Wine/nolf2/drive_c/nolf2/nolf2srv.exe -profile spawn
This will load a profile named spawn, just replace this name with your own profile name.



5) Create a new profile

NOTE: Make sure that lithtech.exe runs with admin privledges

In order for the profile to work with modernizer, it is a good idea to create a new profile from scratch, select:

Image

Create a new profile and type in a profile name, hit ok and back

Image

Next step is to start a new server by clicking Multiplayer (internet),
then select the game type you want to host.

Select Host, and this screen appears

Image

Click Campaign and create a new campaign

Image

The name here can be anything, this is not the one you pass on to the server later
Next up is map selection, this explains itself pretty well.

Image

Next you should set a network port and forward this port and the next one in your firewall.
In this case port:27892 and port:27893

Make sure Dedicated Server is set to Yes
and finally click Launch

Image

This will create everything you need in your game folder in order to run dedicated with the stand alone NOLF2Srv.exe



6) Copy profile over to the linux server

Open your Profiles folder on the computer you used to configure your game server and copy your <profile.txt> and the folder with the same name over to the Profiles folder on the server.

Also make sure that your DMMissions.txt and DDMissions.txt from the game folder are the same as the ones you have on the computer where you configured the game server.

Image

Let's start this thing:

Code: Select all

WINEPREFIX=~/Wine/nolf2 wine start /unix ~/Wine/nolf2/drive_c/nolf2/nolf2srv.exe -profile spawn
Image

If the Running time counter starts to run, it should work :thumb:




7) Keep it alive


Nolf2 servers tend to crash from time to time, so a auto restart function could be a good idea.

My initial plan was to have Crontab running a check every mine to see if the server was alive or not, but Wine doesn't seem to be friends with Crontab. This is why I ended up creating a launcher that starts the server + a script that will guard it.

First of all, you would want to shut down any display of error messages after a crash, this will prevent the script from restarting Nolf2srv.exe. Launch Winetricks:

Code: Select all

WINEPREFIX=~/Wine/nolf2 winetricks
Select the default wineprefix

Image

This time choose "Change settings"

Image

Then disable the crash dialog by selecting nocrashdialog

Image

Open up your favorite text editor and copy/paste this:

Code: Select all

#!/bin/bash

while :
do

(/bin/ps aux | /bin/grep -v 'grep' | /bin/grep 'nolf2srv' 2>&1 >/dev/null || WINEPREFIX=~/Wine/nolf2 wine start /unix ~/Wine/nolf2/drive_c/nolf2/nolf2srv.exe -profile spawn)

sleep 60
done
You'll need to change profile and path to your likings.

This little script will search for the process nolf2srv and execute the start server command if the process doesn't exist. This function is packed into a while loop that will run every 60 seconds and will go on forever.

I saved it as nolf2dm.sh in my Wine folder and made it executable.

Code: Select all

chmod +x ~/Wine/nolf2dm.sh
or go into the file's properties -> Permissions and check Executable : Allow executing file as program

Image

You can now start the server and script by command

Code: Select all

sh ~/Wine/nolf2dm.sh


If you prefer a clickable button on your desktop, this can be done by right clicking the desktop and creating a new launcher with the command:

Code: Select all

/home/<your username>/Wine/nolf2dm.sh
The launcher needs full path, ~ won't work here.
Image

User avatar
TP555 1981
Advanced Member
Advanced Member
Posts: 45
Joined: Fri Nov 19, 2021 2:07 am

Re: Nolf2srv 1.4M Dedicated Linux Server

Post by TP555 1981 » Wed Apr 20, 2022 4:13 pm

Hi

I had allready ask you that before. in a another Thread for a CJ Server !

How to install Wine or Box86/64 (Needed for Pi) on a Pi3b , under Raspberry OS 32/64Bit Bullseye or another Distro for a Pi ?

You did use Wine older Version 6.xx or current 7.xx ?

User avatar
Spawn
Admin
Admin
Posts: 1312
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Re: Nolf2srv 1.4M Dedicated Linux Server

Post by Spawn » Wed Apr 20, 2022 8:52 pm

TP555 1981 wrote:
Wed Apr 20, 2022 4:13 pm
I had allready ask you that before. in a another Thread for a CJ Server !
Oh, I must have missed that somehow..

I have never messed with a Raspberry OS, it seems that installing wine on it isn't the easiest thing to do, but it seems like it might be possible..

https://forum.winehq.org/viewtopic.php?f=2&t=36304

I used the lastest stable release.. Wine 7.0
Image

Post Reply
jedwabna poszewka 50x60