Prerequisites
4Netplayers is a very flexible platform. Today, more than 300 games are available in our library. However, while our operations team can add most server software, there are some no-gos that prevent servers to be added.
In this documentation we guide you through those requirements and give some hints how to achieve that in favorite game engines.
Must haves
Your dedicated server software must meet these requirements:
- Windows or Linux binary
- Must run headless (i.e. no GUI or any form of human input required)
- Command line option to set the port and IP address of the game server.
- Server queries to retrieve status information
The requirements in detail:
Windows or Linux binary
The binary should run on Window Server or on Linux (Ubuntu). It can be a x86 or x64 binary. However, as of today, we do not support ARM builds.
If you are building a server using Mirror Networking or Photon or MLAPI, you can export a headless dedicated server via the Build Settings in Unity. If possible, always choose Linux binary, as we prefer Linux binaries.
In Unity 2021.1 and later, the Build Settings look a bit different and you can choose Dedicated Server
as a build
target on the left side. In earlier versions, you need to choose Linux or Windows build and then activate the
checkbox “Headless” in the options on the right side to activate a headless server build.
In Unreal you need to package your dedicated server in the Menu File > Package Project > Build Target. Follow this guide on how to build a dedicated server for your game.
Headless
It’s important that your binary does not require opens any form of GUI. If you follow the official guides for Unity and Unreal on how to build a dedicated server that is not an issue. But in the past we noticed some developers that added crazy things on their dedicated servers.
Always remember, that server starting and stopping is a fully automated process. If your dedicated server requires mouse or key input, we will not be able to add it. Also remember, that the game servers are running in data centers on server hardware that does not have a graphics card installed. Your dedicated server may not need any form of graphical output!
IP and Port settings
Most dedicated servers are binding 0.0.0.0
or INADDR_ANY
. That means, that the software will pick the first IP
available on a machine. In our platform, gameservers might be running on the same physical hardware which
might have many different IP addresses linked. We need to make sure, that the gameserver is binding on the IP address
and port that we need. As the gameserver is linked to a customer account, and our customers may choose to have a
dedicated IP address we need to be able to set that IP address when launching the server. We also need to make sure that
there are no port collisions and therefore need to be able to set port and ip address via command line.
Please provide these command line options (or something similar):
Option | Example | Description |
---|---|---|
-port P | -port 27015 | The option to set the port of the server |
-ip IP | -port 162.162.162.162 | An option to assign the ip address the server is binding |
-numslots S | -numslots 16 | The maximum number of users that may connect to the server |
Your server should bind on the port and the IP address given via command line parameter. If no IP is given, bind on
0.0.0.0
or INADDR_ANY
.
Server queries
Sometimes, gameservers crash. Or more users connect to the server as allowed. To prevent these cases, the server must deliver at least a heart beat query that we can use to figure out, if the server is running and everything is fine. If the query does not ping back, the server is restarted automatically.
You can use Steam to build server queries that are used by many games and make it very easy for us to implement these games into our library: Steam Server Queries.
There should be at least one server query returning these info on request:
- Number of players currently connected
- Number of maximum players that may connect
- Name of the server
General Guidelines
These are general guidelines that we have compiled over the years.
Configuration Files
Remember that dedicated servers should run without any input from users. Therefore, many dedicated servers allow customization of the gaming experience with one or more config files.
4Netplayers customers can customize and setup their server with a simple to use web interface. There, we offer two modes: Basic Mode and Advanced Mode.
Basic Mode
In this mode, customers get a nice list of options and easy to understand controls like a “switch” to enable or disable features.
Our operations team reverse builds a structure from the config file and our parsers and generators automatically generate a config file when the server is about to be started.
Advanced Mode
In advanced mode, customers are allowed to edit the config files directly in an editor provided in the web interface. Therefore it’s important that the config files are easy to understand. Use variables that make sense and allow external users to easily understand what this setting does. Add comments to the template (that we also add to the config files) so that it’s even easier to understand.
Config file formats
The config files that you use for your dedicated server should follow these simple rules. Then it’s easy for our operation team to create great basic config options, and the community can create great gameservers in advanced mode without requiring external documentation.
- Must be text format (binary formats are a no-go, because they are nearly impossible to parse by other services)
- Use XML, JSON, plain text or INI files.
- YAML files should not be used as the syntax is not easy to understand and very error-prone.
- Use good naming of variables
- Provide a config file with all default values
- Add comments for each option and provide information about minimum and maximum values and what they do
Admins
Provide a config file (i.e. admins.ini
) where customers can setup admins for the server that have the authority to
kick users. That is an important part for owners of a server. Owning a server also means they can control every
aspect of the server - especially who is playing on the server.
Databases
Use file based databases like SQLLite instead of server based databases like MySQL or MariaDB. SQLLite does not require any config or setup, which makes it easy for your users and our operations team to handle them.
If you want multiple servers to connect to one database then you may offer both options (SQLLite and a server based) and let users decide in a config option which one to use. Default should be file based database as most customers only rent one server.
Next steps
Ready to go? Does your server meet the requirements?