Passer au contenu principal
Version: bleeding-edge 🩸

Configuration du serveur

Tout ce que vous devez savoir pour configurer votre serveur !

Fichier de configuration du serveur

Le fichier de configuration du serveur Config.toml Ce fichier sera toujours remplacé par le bon modèle après le chargement du serveur.

tip

Les fichiers de configuration de nanos world utilisent TOML (Tom’s Obvious, Minimal Language), se référer à https://github.com/toml-lang/toml](https://github.com/toml-lang/toml pour la syntaxe ou plus d'informations.

Config.toml
loading...

Paramètres détaillés

ParamètreDescription
nameNom du Serveur
descriptionDescription du serveur
max_playersNombre maximum de joueurs autorisés à rejoindre
passwordMot de passe pour se connecter
ipIP du serveur. Nous recommandons de laisser vide
portPort principal du serveur et port HTTP (UDP/TCP)
query_portServer query Port (UDP)
announceAfficher ou non dans la liste des serveurs
max_tick_rateFréquence de ticks en ms. Combien de fois le serveur va émettre de ticks par seconde. Nous recommandons de laisser à 30
max_sync_rateMax actors sync rate in Hz. How much actors location/rotation/velocity will synchronize per second, limited by max_tick_rate
max_send_rateTaux d'envoi du réseau du serveur par client en KB/s. Limite la bande passante pour chaque joueur connecté. Réglage de la valeur la plus basse nécessaire car des taux plus élevés peuvent avoir un impact négatif sur les performances du serveur lorsque des joueurs avec de mauvaises connexions
max_file_transfer_rateModifie le taux de transfert de fichier maximum par client
distance_optimizationDéfinit le niveau d'optimisation de distance pour améliorer l'utilisation du réseau en réduisant la synchronisation des acteurs distants
log_levelQuel niveau de log afficher
game_modeLe mode de jeux (gamemode) à charger - vous pouvez charger un mode de jeux à la fois.
loading_screenloading-screen paquet à charger - vous ne pouvez charger qu'un seul écran de chargement à la fois.
packagesscript paquets à charger
mapscript paquets à charger
assetsAssets additionnels à charger
Server Token used for authorize downloads through CLI
banned_idsList of banned nanos account IDs

Logo Image

It is possible to have a custom image to be displayed in the server list. For that, add a file called Server.jpg besides the server executable with the logo you wish. The recommended size is 300x150.

tip

You can pass a JPG image URL to --logo parameter to download and use a image from the web instead of placing it physically in the folder.

note

Server Logo feature is only available for for Dedicated Servers.

Map & Level

The Map (or Level) is defined in the Server's config file, this map will be loaded when the player joins the server in the client side.

To configure a map, please refer to Packages Guide to create a Map Package pointing to the correct Asset.

nanos world counts on (for now) 4 built-in maps: default-blank-map, default-empty-map, default-ocean-map and default-testing-map which can be used in your server without needing to download any Package/Asset Pack.

Server Console

Built-in Commands

CommandDescription
chat <message>Sends a chat message
kick <player_id> <reason>Kicks a player by it's ID
map <map_path>Reloads all Packages and reconnect the Players in new Map
restartRestarts the server, reloading all Packages and reconnecting the Players
stopStops the server
playersLists all Players connected
password <new_password>Changes the server password
profiling <0-1>Enables/Disables Performance Profiling Logs for debugging
log_level <1-3>Changes the log level
max_send_rate <128-16384>Changes the max send rate per client
max_file_transfer_rate <128-max_send_rate>Modifie le taux de transfert de fichier maximum par client
distance_optimization <0-9>Sets the distance optimization level
package run <package_name> <lua_code>Runs a code in a Package
package reload allReloads all Packages and restarts the Lua Virtual Machine
package reload <package_names...>Reloads Packages
package unload <package_names...>Unloads Packages
package load <package_names...>Loads Packages
package hotreload <package_names...>Reloads all files but keeps the memory as is

Custom Commands

It is possible to define custom commands as well, for that please refer to Console.RegisterCommand().

Command Line Parameters

It is possible to override the Server Configuration with Command Line Parameters.

ParamètreValue TypeDescription
--namestringServer name
--descriptionstringServer description
--logostringServer Logo (downloads the image in-memory)
--passwordstringMot de passe du serveur
--ipstringServer IP
--mapstringMap to load
--portnumberServer port
--query_portnumberServer Query port
--announce0 or 1If announce in master list
--game_modestringServer game-mode
--loading_screenstringServer loading-screen
--packagesstring listServer packages
--assetsstring listServer assets
--tokenstringServer authorization token
--max_playersnumberMax allowed players
--dedicated_server0 or 1If to start as a Dedicated Server or P2P
--async_log0 or 1If to use async or sync logs (async provides better performance) - default is 1
--log_level1, 2 or 3If to use Normal, Debug or Verbose logs
--custom_settingstoml stringA list of Custom Settings to be passed to scripting in toml format
--compression0-9Sets the compression level to use in some networking operations - 0 disables it, 1 is the fastest and 9 is the slower but highest compression ratio
--saveflagIf to save the passed parameters in Config.toml
--profilingflagEnables Performance Profiling Logs for debugging
--auto_downloadflagAutomatically downloads Packages and Assets from Vault if needed
--use_vault_assets_leanflagOnly downloads the Asset Pack's .toml configuration files from Vault
--log_show_threadflagShows the current running thread of each outputted log
--max_tick_rate15-120Sets the server max tick rate in Hz (ticks per second)
--max_sync_rate1-30Sets the max actors sync rate in Hz (syncs per second), naturally limited by max_tick_rate
--max_send_rate128-16384Sets the server max send rate per client in KB/s
--max_file_transfer_rate128-16384Sets the server max file transfer rate per client in KB/s - this must be smaller than max_send_rate
--distance_optimization0-9Sets the distance optimization level to improve network usage by reducing sync from distant actors - 0 disables it, 4 is a good middle term, 9 is the most aggressive
--thread_pool_countnumberSets the number of threads initialized to execute async operations (e.g. from HTTP, Database, File) - default is 8 (or the number of CPU cores)
--enable_unsafe_libsflagEnables executing the methods os.execute, os.rename, os.remove, os.exit, os.getenv, os.tmpname, os.setlocale, dofile, loadfile and all io.* on server side (Caution: those methods may allow malicious operations to run on your server, make sure you know what you are doing)
tip

Flag Value Types don't require any argument, just pass the parameter like --parameter.

One-liner Server Configuration

With Command Line Parameters and Command Line Interface (CLI), it is also possible to automate the full server installation, here's an example:

Installs all needed Packages (this will install needed Assets as well), then starts the server with all configs set:

./NanosWorldServer.exe --cli install package sandbox battlefield-kill-ui ts-fireworks-tools
./NanosWorldServer.exe --name "nanos world Amazing Sandbox" --description "Awesome Sandbox Server" --map "nanos-world::TestingMap" --game_mode "sandbox" --packages "battlefield-kill-ui,ts-fireworks-tools" --port 7777 --query_port 7778 --max_players 32 --logo "https://i.imgur.com/vnB8CB5.jpg"

Or, just start the server passing with all configs set and auto downloads the packages and assets if needed:

./NanosWorldServer.exe --name "nanos world Amazing Sandbox" --description "Awesome Sandbox Server" --map "nanos-world::TestingMap" --game_mode "sandbox" --packages "battlefield-kill-ui,ts-fireworks-tools" --port 7777 --query_port 7778 --max_players 32 --auto_download 1 --logo "https://i.imgur.com/vnB8CB5.jpg"

Common Console Messages and Errors

Server Tick too/extreme high! Verify the server performance! Server got stuck for Xms...

It means the server got stuck for X milliseconds. The warning (yellow) is not something to worry about, but too many messages in red could mean your server infrastructure is not that good or your scripting code is not that optimized.

Usually the server runs at 33 ticks per second (or the value configured at Config.toml), the server runs in an infinite loop in that frequency, and inside that loop all server operations are executed, such as receiving and sending network packets, triggering lua events, executing functions or callbacks, and so on.

If a single tick takes more than 33 milliseconds, this warning will appear up.

tip

In some shared VPS, this warning may appear up more frequently due how the VPS handles the scaling of it's machines, sometimes the provider may think your VPS is "idle" (due nanos world server using extremely low CPU) and may decrease your processing power, causing this warning show up as well.

Lua Stack Error: Should be X, is Y...

This is an internal error and should not supposed to happen. Those are guards set around our Lua Scripting implementation to prevent bad things from happening. If this error appears it means a implementation bug happened. Please communicate immediately with the devs, and if possible how to reproduce that!

...Was it supposed to happen?

Those FATAL errors usually shouldn't happen, if you experience any, please let us know.