Skip to content

Commit 1ac9adb

Browse files
dgibbs64gitbook-bot
authored andcommitted
GITBOOK-29: change request with no subject merged in GitBook
1 parent c2b5b18 commit 1ac9adb

4 files changed

Lines changed: 94 additions & 78 deletions

File tree

SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [Test Environment](getting-started/test-environment.md)
1010
* [Developer Commands](getting-started/developer-commands.md)
1111
* [Developing LinuxGSM](getting-started/developing-linuxgsm.md)
12+
* [Adding a new Game Server](getting-started/adding-a-new-game-server.md)
1213

1314
## Workflow <a href="#workflow-1" id="workflow-1"></a>
1415

@@ -23,6 +24,7 @@
2324
* [Style Guide](code-standards/style-guide.md)
2425
* [Functions](code-standards/functions.md)
2526
* [Modules](code-standards/modules.md)
27+
* [Commands](code-standards/commands.md)
2628
* [Exit Codes](code-standards/exit-codes.md)
2729
* [Shellcheck Linter](code-standards/shellcheck-linter.md)
2830
* [Conventional Commits](code-standards/conventional-commits.md)

code-standards/commands.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Commands
2+
3+
Within LInuxGSM there are many commands that a user will run to complete tasks such as start, stop, monitor, and details. Command scripts are stored will all other modules and are always named something like `command_install.sh`.
4+
5+
Here are the command functions you might need to alter when adding a new server:
6+
7+
* command\_install.sh - Server installation must work properly
8+
* command\_update.sh - if the given game supports updates (might required to add a file for that matter, for now, we use to add a single file for install and update, like for TeamSpeak 3).
9+
* command\_details.sh - Server details need to be displayed properly
10+
* command\_monitor.sh & monitor\_gsquery.sh, query\_gsquery.py & query\_gsquery.py - You'll need to read carefully and understand this code before altering it.
11+
* core\_getopt.sh - You will define available commands in this one, displayed when the user runs `./gameserver` without an argument. Either use an existing opt or make a new one if needed.
12+
* command\_start.sh & command\_stop.sh - Of course, your server needs to be able to start and stop properly.
13+
* command\_debug.sh & command\_console.sh - Those commands usually work out of the box, but might require some more work. If not using tmux, then console should be disabled for this server in core\_getopt.sh.
14+
* info\_config.sh - You might need to read variables out of configuration files such as Rcon information in the case of Squad.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Adding a new Game Server
2+
3+
Adding a new game server is one of the most common things developers do. This guide will help you add a new game server to LinuxGSM.
4+
5+
{% hint style="info" %}
6+
replace gameserver with the name of the new server e.g rustserver
7+
{% endhint %}
8+
9+
### Create new \_default.cfg config file
10+
11+
Firstly create a new `_default.cfg` file in `lgsm/config-default/config-lgsm/gameserver` . An existing \_default.cfg file can be used as a template.
12+
13+
Update all the variables in the new `_default.cfg` file to fit the new server.
14+
15+
Some common variables that will need updating:
16+
17+
* Add `## SteamCMD Login` section only if required.
18+
* `startparameters` are any parameters the executable requires to run the game server.
19+
* `appid` used to download a game server from Steam. Remove if not using steam.
20+
* `steammaster` used if the game servers are listed on the Steam master servers.
21+
* `stopmode` defines how a server can safely exit.
22+
* `querymode` defines the type of query monitor that can be used to check the server is responding.
23+
* console type highlights to users if the console outputs and is interactive.
24+
* Game Server Details `gamename` , `engine`, `glibc`.
25+
* Various directory and config variables.
26+
27+
### Add the new server to serverlist.csv
28+
29+
Add the new server details to `serverlist.csv` as well as add any dependency requirements to all the distro csv files found in `lgsm/data` directory.
30+
31+
### Add any fixes to a fix file
32+
33+
Some game servers require alterations before they can start common examples include:
34+
35+
* copying library files to serverfiles
36+
* symlinking files
37+
* creating directories
38+
* adding a directory to `LD_LIBRARY_PATH`
39+
40+
If this is required a fix module will need to be created.
41+
42+
1. Create a new module called `fix_[shortname].sh` (use an existing example as guidance)
43+
2. Add the required fixes to the module
44+
3. Add the module to `fix.sh`
45+
4. Add the fix to `core_modules.sh` list
46+
47+
### Server Querying
48+
49+
Game servers can often be queried to check the server is running and return useful info. LinuxGSM uses gsquery.py to complete simple pings and [gamedig](https://github.com/gamedig/node-gamedig) to get detailed info returned in json format.&#x20;
50+
51+
Most game servers use the valve protocol for allowing queries, however, others are available. Look for any developer documentation to try and find out if querying is supported.&#x20;
52+
53+
Use the `query-raw` command to assist in testing the querying of the new game server.&#x20;
54+
55+
### Stop Mode
56+
57+
Game servers will be able to gracefully exit using various methods. Figure out the method the new game server uses. See [stop mode](https://docs.linuxgsm.com/features/stop-mode).
58+
59+
### Glibc Version
60+
61+
Most game servers require a minimum glibc version. Use the `detect-glibc` command to find out the minimum glibc version required.
62+
63+
### Details
64+
65+
Various game server info will need to be parsed from game server configs or variables. Use the info\_\*.sh modules to add this info.&#x20;
66+
67+
### Custom Updater
68+
69+
Not all game servers use SteamCMD. If this is the case a custom update module will need to be created. There are a number of examples in the code that can be used as a baseline.
70+
71+
Custom Commands
72+
73+
Some game servers may require bespoke commands to complete tasks. Examples of this include Teamspeak 3 and Unreal Tournament 2004. Take a look at the `core_getopts.sh` module for examples of how to add commands.
74+

getting-started/developing-linuxgsm.md

Lines changed: 4 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -18,89 +18,15 @@ To install a specific server `linuxgsm.sh` first downloads a complete list of al
1818

1919
A user can also run the install again if they want multiple instances of the same server. This will give an output of `gameserver-2`,`gameserver-3` etc as the file name.
2020

21-
## Adding a new Game Server
21+
## Modules
2222

23-
Adding a new game server is one of the most common things developers do. This guide will help you add a new game server to LinuxGSM.
23+
Modules are individual bash scripts containing code and functions that complete specific tasks. See the [modules](../code-standards/modules.md) page for more info.
2424

25-
{% hint style="info" %}
26-
replace gameserver with the name of the new server e.g rustserver
27-
{% endhint %}
25+
## Commands
2826

29-
### Create new \_default.cfg config file
27+
Within LInuxGSM there are many commands that a user will run to complete tasks such as start, stop, monitor, and details. Command scripts are stored will all other modules and are always named something like `command_install.sh`. See the [commands](../code-standards/commands.md) page for more info.
3028

31-
Firstly create a new `_default.cfg` file in `lgsm/config-default/config-lgsm/gameserver` . An existing \_default.cfg file can be used as a template.
3229

33-
Update all the variables in the new `_default.cfg` file to fit the new server.
34-
35-
Some common variables that will need updating:
36-
37-
* Add `## SteamCMD Login` section only if required.
38-
* `startparameters` are any parameters the executable requires to run the game server.
39-
* `appid` used to download a game server from Steam. Remove if not using steam.
40-
* \`steammaster\` used if the game servers are listed on the Steam master servers.
41-
* `stopmode` defines how a server can safely exit.
42-
* `querymode` defines the type of query monitor that can be used to check the server is responding.
43-
* console type highlights to users if the console outputs and is interactive.
44-
* Game Server Details `gamename` , `engine`, `glibc`.
45-
* Various directory and config variables.
46-
47-
### Add the new server to serverlist.csv
48-
49-
Add the new server details to `serverlist.csv` as well as add any dependency requirements to all the distro csv files found in `lgsm/data` directory.
50-
51-
### Add any fixes to a fix file
52-
53-
Some game servers require alterations before they can start common examples include:
54-
55-
* copying library files to serverfiles
56-
* symlinking files
57-
* creating directories
58-
* adding a directory to `LD_LIBRARY_PATH`
59-
60-
If this is required a fix module will need to be created.
61-
62-
1. Create a new module called `fix_[shortname].sh` (use an existing example as guidance)
63-
2. Add the required fixes to the module
64-
3. Add the module to `fix.sh`
65-
4. Add the fix to `core_modules.sh` list
66-
67-
### Server Querying
68-
69-
Game servers can often be queried to check the server is running and return useful info. LinuxGSM uses gsquery.py to complete simple pings and [gamedig](https://github.com/gamedig/node-gamedig) to get detailed info returned in json format.&#x20;
70-
71-
Most game servers use the valve protocol for allowing queries, however, others are available. Look for any developer documentation to try and find out if querying is supported.&#x20;
72-
73-
Use the `query-raw` command to assist in testing the querying of the new game server.&#x20;
74-
75-
### Stop Mode
76-
77-
Game servers will be able to gracfully exit using various methods. Figure out the method the new game server uses. See [stop mode](https://docs.linuxgsm.com/features/stop-mode).
78-
79-
### Glibc Version
80-
81-
Most game servers require a minimum glibc version. Use the `detect-glibc` command to find out the minimum glibc version required
82-
83-
#### Functions, commands and script files
84-
85-
Script files are located in ${functionsdir}, which is ${rootdir}/lgsm/functions
86-
87-
* Every single script file must be declared in core\_functions.sh
88-
* Commands are declared in core\_getopt.sh, depending on the game or engine
89-
90-
Note: You need to update those files with update-functions command after adding a new one.
91-
92-
#### Commands
93-
94-
Here are the command functions you might need to alter when adding a new server:
95-
96-
* command\_install.sh - Server installation must work properly
97-
* command\_update.sh - if the given game supports updates (might required to add a file for that matter, for now, we use to add a single file for install and update, like for TeamSpeak 3).
98-
* command\_details.sh - Server details need to be displayed properly
99-
* command\_monitor.sh & monitor\_gsquery.sh, query\_gsquery.py & query\_gsquery.py - You'll need to read carefully and understand this code before altering it.
100-
* core\_getopt.sh - You will define available commands in this one, displayed when the user runs `./gameserver` without an argument. Either use an existing opt or make a new one if needed.
101-
* command\_start.sh & command\_stop.sh - Of course, your server needs to be able to start and stop properly.
102-
* command\_debug.sh & command\_console.sh - Those commands usually work out of the box, but might require some more work. If not using tmux, then console should be disabled for this server in core\_getopt.sh.
103-
* info\_config.sh - You might need to read variables out of configuration files such as Rcon information in the case of Squad.
10430

10531
#### Fixes
10632

0 commit comments

Comments
 (0)