Skip to content

Setup Headless Server

Chris Yeninas edited this page Sep 28, 2024 · 10 revisions

Headless Server

Nebula can run on a server without a GPU device.
The following are the steps to run it.

Preparation

Steam

If you purchased the game on Steam, you're required to be logged into Steam in order to run the game on your server.
If you only have one Steam account, you can set up Steam Offline Mode.

Create a steam_appid.txt file in the root of the game directory (next to DSPGame.exe) with the text 1366540. Now you can run the game from the exe.

Mod Manager

If you're using the mod manager, you can go to Settings -> Debugging -> Set launch parameters to set the following command line.
For example, -batchmode -nographics -server -load save1
The config file can be found in Config editor -> find BepInEx\config\nebula.cfg

If you are using the mod manager and you wish to load the server from the command line, go to Settings -> Set launch parameters and copy the arguments from the Modded: section and include them in the arguments below.

image

BepInEx Console

By default, the BepInEx package on Thunderstore comes with the console window disabled. This means that when you run Nebula in headless server mode you will have no indication of the status of the server other than the fact that DSPGame.exe will appear in Task Manager. It is recommended to enable the BepInEx console either by accessing the BepInEx config from the Mod Manager's config editor or by opening BepInEx/config/BepInEx.cfg and changing Enabled = false under the Logging.Console section to Enabled = true
Hitting Ctrl + C will save the game to _lastexit_.dsv and exit.

Windows Server Core

  1. Mount your Windows Installation Media
  2. Enable .NET Framework v4 and v3.5
DISM /Online /Enable-Feature /FeatureName:NetFx4 /All /Source:D:\Sources\sxs /LimitAccess
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /Source:D:\Sources\sxs /LimitAccess
  1. Add the App Compatibility layer, this can take a while.

Add-WindowsCapability -Online -Name ServerCore.AppCompatibility~~~~0.0.1.0 -Source "D:\sources\sxs\"

  1. Reboot.
  2. DSP in headless should now run correctly and allow connections.

Command Line

The dedicated server can be started from the command line with:
./DSPGAME.exe -batchmode -nographics -server -load save1
Where save1 is the name of the savefile.

Command Details
-batchmode Run the application in “headless” mode. In this mode, the application doesn’t display anything or accept user input.
-nographics When you use this argument in batch mode, Unity doesn’t initialize a graphics device.
-logFile <pathname> Specify where Unity writes the Editor or Windows/Linux/OSX standalone log file.

Nebula CLI arguments

Command Details
-server Start DSP in dedicated headless server mode.
-load <savename> Specify the save to load. App quits when the save doesn't exist.
-load-latest Load _lastexit_.dsv which is the autosave from the last game existing.
-newgame <seed> <starCount> <resourceMultiplier> Start a new game in peace mode with 3 parameters.
-newgame-cfg Start a new game with the config file BepInEx\config\nebulaGameDescSettings.cfg
-ups <integer value> Set UPS to value using FPSController.SetFixUPS(value). Range: 5-240.

Config Options

The config file is BepInEx\config\nebula.cfg

Config Options Default Details
AutoPauseEnabled true Auto pause the game when there are no connected players.
RemoteAccessEnabled false Let authenticated clients access remote server commands
RemoteAccessPassword If provided, this will set a password used for clients to authenticate for access to remote server commands
ServerPassword If provided, this will set a password for the hosted server.

Chat commands

When the server has RemoteAccessEnabled set to true, clients can use following commands:

Command Example Details
/server login [RemoteAccessPassword] /server login hunter2 Enables access to the following commands
/server list [saveNum] /server list 5 Show the recent [saveNum] savefiles by time and savename on the server.
/server save [saveName] /server save save1 Save current game as [saveName]. If saveName is not specified, it will save to _lastexit_.
/server load <saveName> /server load save1 Load game from saveName. Current game will be saved to _lastexit_ before restart.
/server info /server info Show /info command response on the server.

Save Files Transfer

  • Nebula stores the players data in a separate file [SaveName].server beside the save. When transferring save, make sure it is transferred too.
  • Make sure player.key file is not the same in original owner and the server. The default path of the file is in the upper layer of the save folder (%userprofile%\Documents\Dyson Sphere Program\player.key). Delete the file can generate a new one and join as a new player.
  • There is chat command /playerdata to list, delete or load player data. So you can load the data from the last login session back if you host a save that was transferred from other players.

Demo

Headless server and a client, test chat commands
Check How to run 2 game instances on the same computer to run multiple instances of DSP.

nebulaGameDescSettings.cfg

When the file is absent, it will create a file and use the default values.

[Basic]

## Cluster Seed. Negative value: Random or remain the same.
# Setting type: Int32
# Default value: -1
galaxySeed = -1

## Number of Stars. Negative value: Default(64) or remain the same.
# Setting type: Int32
# Default value: -1
starCount = -1

## Resource Multiplier. Infinte = 100. Negative value: Default(1.0f) or remain the same.
# Setting type: Single
# Default value: -1
resourceMultiplier = -1

[Combat]

## Aggressiveness (Dummy = -1, Rampage = 3)
# Setting type: Single
# Default value: 1
# Acceptable values: -1, 0, 0.5, 1, 2, 3
aggressiveness = 1

## Initial Level (Original range: 0 to 10)
# Setting type: Int32
# Default value: 0
# Acceptable value range: From 0 to 30
initialLevel = 0

## Initial Growth (Original range: 0 to 200%)
# Setting type: Single
# Default value: 1
initialGrowth = 1

## Initial Occupation (Original range: 1% to 200%
# Setting type: Single
# Default value: 1
initialColonize = 1

## Max Density (Original range: 1 to 3)
# Setting type: Single
# Default value: 1
maxDensity = 1

## Growth Speed (Original range: 25% to 300%)
# Setting type: Single
# Default value: 1
growthSpeedFactor = 1

## Power Threat Factor (Original range: 1% to 1000%)
# Setting type: Single
# Default value: 1
powerThreatFactor = 1

## Combat Threat Factor (Original range: 1% to 1000%)
# Setting type: Single
# Default value: 1
battleThreatFactor = 1

## Combat XP Factor (Original range: 1% to 1000%)
# Setting type: Single
# Default value: 1
battleExpFactor = 1

[General]

## False: Enable enemy force (combat mode)
# Setting type: Boolean
# Default value: false
isPeaceMode = false

## True: Enable creative mode
# Setting type: Boolean
# Default value: false
isSandboxMode = false