Server
Servers can easily be started by running the executable in the console. The server will start on 28006 by default.
You can find all available options by running the executable with the --help
flag.
Directory
When starting the server, it will create a directory called packs
in the current working directory. This directory will contain all the packs that are loaded into the server.
There should be a core pack already installed in the directory. This pack contains all the default cards, boards, and dice.
Put your custom packs in this directory to load them into the server.
By default, the server will use an unsecure websocket connection using http. To use a secure connection with https, you need to provide a certificate and key file. This can be done by creating a directory called certs
in the current working directory and putting the certificate (with name server.crt
) and key file (with name server.key
) in there.
The world will be saved in the current working directory in a file called world.stnx
. This file will contain all the data of the world, including the packs that are loaded into the server. This file is compatible with the single player world file.
Library
The server software can also be used as a library. This allows you to create custom server software with your own logic. The server software is written in Dart.
To create a new project with the server software, you can use the following command:
Now go to the pubspec.yaml
file and add the following dependency:
Replace <version>
with the version you want to use (for example v0.1.0
). It’s recommended to use the latest version.
Now go to the bin/main.dart
file and add the following code:
Now you can run the server software with the following command:
You will have the same setup as the server software, but you can now customize it to your needs.
Customization
To further customize the server software, you can pass an onLoad
function to the runServer
function. This function will be called when the server loads. You can use this function to add custom logic to the server software.
See the API documentation for more information about the server software.
There are examples, you can find here.