Systems/FreeBSD

From Unvanquished
Jump to: navigation, search

Starting with Unvanquished 0.55.0 it will be possible to run a native FreeBSD Dæmon engine to run the Unvanquished game on FreeBSD.

While the engine is native to FreeBSD, the Native Client virtual machine is not, it runs with the FreeBSD builtin Linux compatibility layer known as Linuxulator.

Enabling Linuxulator for Native Client

Here is how to set-up Linuxulator on FreeBSD (as root):

sysrc linux_enable="YES"
service linux start
pkg install linux_base-c7

Building for FreeBSD

A FreeBSD user can build and run the engine, enable Linuxulator and join online games.

A FreeBSD server owner can build and run a complete native server to host online games.

A FreeBSD developer can build and run the complete game for debugging purpose, but cannot build redistributable NativeClient game code.

Building the client engine for playing the game

To run the Unvanquished game on FreeBSD, it is only needed to build the Dæmon engine and to place the pkg/ folder full of .dpk archives next to the built daemon engine binary (or daemonded for the server).

Fetching and building the current client release:

# Clone the engine sources git clone https://github.com/DaemonEngine/Daemon.git git checkout unvanquished/0.55.2 git submodule update --init --recursive
# Build the client engine mkdir build; cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_LTO=ON -DBUILD_CLIENT=ON -DBUILD_TTY_CLIENT=OFF -DBUILD_SERVER=OFF make -j$(sysctl -n hw.ncpu)
# Download and extract the game data wget https://dl.unvanquished.net/release/unvanquished_0.55.2.zip unzip unvanquished_0.55.2.zip ln -s unvanquished_0.55.2/dpk dpk

Running the game client:

./daemon

It is not possible to build Native Client binaries (.nexe) on FreeBSD. The PNaCl compiler itself runs properly on Linuxulator and with a small patch to the python wrapper driving the clang internals, the .pexe compilation succeeds. Unfortunately the translator meant to translate the .pexe file to .nexe doesn't run properly on Linuxulator.

Building the server engine with the native server game code for hosting a game server

It is possible to build and run native FreeBSD game executable for both server and client, but since online games requiring Native Client client executable (cgame.nexe for cross-platform and sandboxing purpose, only the native server executable (sgame.exe) is useful: a server owner can build and run a completely native FreeBSD Unvanquished server using a native FreeBSD server engine and a native FreeBSD server game code.

Fetching and building the current server release with server game code:

# Clone the game and engine sources git clone https://github.com/Unvanquished/Unvanquished.git git checkout unvanquished/0.55.2 git submodule update --init --recursive
# Build the server engine with server game code executable mkdir build; cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_LTO=ON -DBUILD_CLIENT=OFF -DBUILD_TTY_CLIENT=OFF -DBUILD_SERVER=ON \     -DBUILD_GAME_NACL=OFF -DBUILD_GAME_NATIVE_DLL=OFF -DBUILD_GAME_NATIVE_EXE=ON -DBUILD_CGAME=OFF -DBUILD_SGAME=ON make -j$(sysctl -n hw.ncpu)
# Download and extract the game data wget https://dl.unvanquished.net/release/unvanquished_0.55.2.zip unzip unvanquished_0.55.2.zip ln -s unvanquished_0.55.2/dpk dpk

Running the game server and load a map (the server will automatically shutdown if no map is loaded):

./daemonded -set vm.sgame.type 2 +map plat23

See also generic instructions for server owners on the Server/Running page.

Building client engine with client and server game code libraries for debugging the game

It is possible to build and run native FreeBSD game libraries for both server and client sgame.so and cgame.so), which is convenient for debugging.

Fetching and building the current client release with client and server game code:

# Clone the game and engine sources git clone https://github.com/Unvanquished/Unvanquished.git git checkout unvanquished/0.55.2 git submodule update --init --recursive
# Build the client engine with client and game code executables mkdir build; cd build cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_LTO=OFF -DBUILD_CLIENT=ON -DBUILD_TTY_CLIENT=OFF -DBUILD_SERVER=OFF \     -DBUILD_GAME_NACL=OFF -DBUILD_GAME_NATIVE_DLL=ON -DBUILD_GAME_NATIVE_EXE=OFF -DBUILD_CGAME=ON -DBUILD_SGAME=ON make -j$(sysctl -n hw.ncpu)
# Download and extract the game data wget https://dl.unvanquished.net/release/unvanquished_0.55.2.zip unzip unvanquished_0.55.2.zip ln -s unvanquished_0.55.2/dpk dpk

Running on LLDB debugger the game client (open the main menu):

lldb run -- ./daemon -set vm.sgame.type 1 -set vm.cgame.type 1

Running on LLDB debugger the game client and load a map:

lldb run -- ./daemon -set vm.sgame.type 1 -set vm.cgame.type 1 +devmap plat23

Using library game code, maps can only be loaded with the devmap command.