Master deployment
Simple test
Simple local test (master, data, multiple)
Build
We recommand to create a new project to build servers. It limits unused/uncompatible libs. To build, use the build profile files in the serverBuilds directory.
Server
Command lines
Servers implements an UDP dialog to execute commands at runtime.
Server code
const int _udpPortReceive = 9568;
const int _udpPortSend = 9570;
ServerCmds _serverCmds;
void Awake() {
...
StartUdpCmds();
...
}
void StartUdpCmds() {
_serverCmds = new ServerCmds(_udpPortReceive, _udpPortSend, TryCmd);
}
string TryCmd(string cmd) {
if (cmd == "stop") {
// application quit
WaitAndQuit().WrapErrors();
return "MasterServer closed";
}
else if (cmd == "ping") {
return "pong";
}
else if (cmd == "wlist") {
return _waitings.Count.ToString();
}
return "Cmd not found";
}
async Task WaitAndQuit() {
await new WaitForSecondsRealtime(1f);
Application.Quit();
}
Commands
You can find a small project in SimpleNet/Deployment~/SimpleNetServerCmds
. This is the basic interface used to call the commands.
net5.0
is required
dotnet --version
Builds
dotnet build SimpleNetServerCommands.csproj -c Master -r linux-x64
dotnet build SimpleNetServerCommands.csproj -c Multiple -r linux-x64
dotnet build SimpleNetServerCommands.csproj -c Data -r linux-x64
Bash file
master.sh
, multiple.sh
and data.sh
include the start command.
#!/bin/bash
mainexe="LinuxMasterServer/Wonderland_Master.exe"
mainscript="ServerCmds/Master/SimpleNetServerCommands"
if test "$1" = "start"; then
exec "$mainexe" > master_logs.txt 2>&1 &
exit 1
fi
exec "$mainscript" "$1" "$2"
Do not forget the chmod +x
command for all executable files.