Web API and NBlood server launcher service in .NET Core
Go to file
2020-01-25 12:26:09 +00:00
Common use blood working directory 2020-01-24 14:34:10 +01:00
Model Add project files. 2020-01-23 21:03:54 +01:00
Supervisor use blood working directory 2020-01-24 14:34:10 +01:00
WebInterface fix supervisor path 2020-01-25 01:55:46 +01:00
.gitattributes Add .gitignore and .gitattributes. 2020-01-23 21:03:52 +01:00
.gitignore Add .gitignore and .gitattributes. 2020-01-23 21:03:52 +01:00
Dockerfile add Dockerfile 2020-01-25 02:30:26 +01:00
NBloodServerSupervisor.sln Add project files. 2020-01-23 21:03:54 +01:00
README.md Create README.md 2020-01-25 12:26:09 +00:00

NBloodServerSupervisor

Web API and NBlood server launcher service in .NET Core

Debug with Visual Studio

  1. Publish WebInterface to a folder with Debug configuration
  2. Create a new folder in the publish folder and name it blood
  3. Compile NBlood with make nblood NORENDER=1 or with mingw32-make nblood NORENDER=1
  4. Copy nblood.exe into the new blood folder and rename it to nblood_server.exe
  5. Copy the following files of Blood 1.21 into the blood folder:
  • BLOOD.INI
  • BLOOD.RFF
  • GUI.RFF
  • SOUNDS.RFF
  • SURFACE.DAT
  • TILES000.ART-TILES017.ART
  • VOXEL.DAT
  1. Start WebInterface.exe
  2. Attach the debugger to WebInterface.exe and/or Supervisor.exe
  3. You can call the following URLs with your web browser or Postman:

Deploy the server onto GNU/Linux

  1. Install Docker and wget (if you dont have already), for example like this: sudo snap install docker && sudo apt install wget -y
  2. Download the Dockerfile: wget https://github.com/CommonLoon102/NBloodServerSupervisor/blob/master/Dockerfile --directory-prefix=supervisor
  3. Switch to the new supervisor directory: cd supervisor
  4. Build the Docker image: sudo docker build -t nblood-supervisor:latest .
  5. Navigate to your Blood 1.21 directory where you have these files:
  • BLOOD.INI
  • BLOOD.RFF
  • GUI.RFF
  • SOUNDS.RFF
  • SURFACE.DAT
  • TILES000.ART-TILES017.ART
  • VOXEL.DAT
  1. Run a Docker container from there: sudo docker run --volume "$PWD":/supervisor/publish/blood --network=host --detach nblood-supervisor
  2. Optional: You can see the ApiKey here:
  • sudo docker run -it nblood-supervisor /bin/bash
  • cat /supervisor/publish/appsettings.json | grep 'ApiKey'
  • exit

Usage

You can list the currently running public servers via this URL:

http://your.ip.goes.here:23580/nblood/api/listservers

You can start new private servers via this URL:

http://your.ip.goes.here:23580/nblood/api/startserver?players=3&ApiKey=the_actual_apikey_here

The number of players must be at least 3 and maximum 8. The servers started with this URL wont be visible publicly via the listservers URL. You can see the port and the command line command to join in the response.