![]() |
R-Type
2
Doom but in better
|
This file is dedicated to the R-Type server binary.
This is a binary that will provide a graphical interface to the program and allow the users to be able to interract with the game.
This document will only focus on the following sections of the server binary:
This section focuses on compiling the server binary without compiling the whole project (this means, without compiling the client).
If you wish to compile the project, please refer to the Getting Stated - Dependency - from source to make sure you have the required dependencies set up on your system.
If you wish to compile the whole project from source, please refer to the Getting Started - Deploy from source
Wether you are on Mac, Windows or Linux, the lines are the same, however, where Linux and Mac will use bash, Windows will use batch cmd.exe
, most of the commands used are similare, however:
ls
becomes dir
cd
is the samerm
becomes del
cp
becomes copy
mv
becomes move
rm -rf
becomes rmdir /s /q
tree
is the same (although it is not natively installed on all linux systems)In Windows, /
become \
and you do not need to prefix files with ./
.
Now that the differences are explained, let us attend to the core of this subject, compiling the program.
To do so, we will:
server
folderbuild
folderWe will now configure our project.
We will thus, run cmake -S . -B ./build
in the server
folder and let it run it's course.
Please make sure you have a stable internet connection or you will need to re-run this command for it to finish completing it's tasks.
This is only the case if you get a cloning error, red text saying something simmilare the following:
Trying to clone , attempt 1 [...] attempt 3 error
However, if it is a missing dependency, try and install it, then re-run the cmake command.
The output of the command should be similare to the following:
The exact output may vary depending on the system but a simple rule to keep in mind is,
no red color
=no error
.
Once this command has run it's course, we can move on to the next section Compiling
. To do so, while remaining in the same directory, you can run the command: cmake --build ./build
.
The following output should appear colorised on your terminal (could not be reproduced here), this output should be simmilare to yours:
Now, when you look into the build folder using ls -ls build
Again, here, your output might be colourised, but due to the limitations of this document, they could ne be represented.
The next step is to copy the binary r-type_server
from the build
folder to the base of the repository rtype
.
Assuming you are still in the server
folder, the following command to execute is: cp ./build/r-type_server ../
You can now copy (assuming you are still located in the server
folder) the server_config.toml
to the base of the repository with the following command: cp server_config.toml ../
.
We are now done with the compilation of the server binary. You can keep this terminal open an run the cd ..
command (assuming you are still located in the server
folder) or reopen a fresh one in the base of the repository.
You can then follow the Running the server section.
To check if the server binary is working, you can, in a terminal located in the same folder as the binary, run the command ./r-type_server --help
This should output the following content:
The configuration file is a toml file that contains the settings for the server. Here is the default configuration:
The field names should not be changed because they are directly referenced by the program, however, feel free to change the field values.
But, be warned, with great power comes great responsability, changing critical ressources can lead to unexpected program behaviours.
>The default file name if
server_config.toml
>The default expected location is
<the same folder as the executable>
All relative paths located in the configuration file are based on the location where the program is located, but more importantly, they will be calculated by the program the moment it is run (thus, if not launched in the same folder, ressources may not be available).
Let's break it down:
Located in the [Connectivity]
section is:
host
: The host on which the server is listening. It can be a local IP addressport
: The port on which the server is listeningLocated in the [client]
section:
max_clients
: The maximum number of clients that can connect to the servermax_clients_per_room
: The maximum number of clients that can be in the same roommax_rooms
: The maximum number of rooms that can be createdmax_connection_time
: The maximum time in seconds a client can stay inactive connected before being disconnectedLocated in the [timeouts]
section:
max_connection_time
: The maximum time in seconds a client can stay inactive connected before being disconnectedThis section addresses common issues and solutions for the R-Type server.
cmake
or cmake --build
process indicating missing tools or libraries.CMake
and G++
are installed and accessible in your system's PATH
.cmake -S . -B ./build
step, such as cloning error
or missing components.cmake --build ./build
command fails with errors about missing files or incorrect configurations.build
folder is created within the server
directory.build
directory, then rerun the configuration and build commands.server_config.toml
file is present in the same directory as the binary../r-type_server --help
to confirm the binary is working as expected.server_config.toml
.[Connectivity]
section of server_config.toml
.max_connection_time
in the [timeouts]
section of server_config.toml
.