Hosting

From Survive the Nights Wiki
Jump to: navigation, search

Setting up a Server and Opening Ports

Hosting a Survive the Nights server does take a bit of setup. You need to open at least one port on your router. This process is the same with nearly all providers for the most part. You'll also want to be sure Survive the Nights is allowed through your firewall and port connections are allowed. As an example opening port 8888 and 8889 to allow connection and listing in public server list.

Allowing Survive the Nights through your Firewall -

1 - Check to ensure that your firewall is allowing Survive the Nights and connections. In the windows search bar type :

Windows Defender Firewall with Advanced Security

Once you're there ensure Survive The Nights is allowed.

Opening and forwarding ports, you'll need to do this to allow connections to your PC. If you're looking to just host locally we suggest using solo play or running a local server using ip: 127.0.0.1.

Port forwarding seems like a big task but shouldn't be that difficult. That being said all routers are different and you'll need to connect to yours to allow traffic through ports.

Router List - Port Checker has a great router list with step by step directions for most.

Host tab settings

In game server hosting is a nice simple solution for those that want to play online with friends. The host option will allow a player to start a public or privately hosted server. It can be placed on our public server list for all to see or you can simply share your IP with a friend and allow them to join discreetly. This option does require quite a bit more knowhow than the solo option. Ports need to be opened and forwarded to allow for outside connections. This is not recommended for players new to networking and multiplayer games. This host option is more of a co-op experience. The server is only running when you're playing so friends wont be able to join without you. This option isn't our dedicated server option. You will see that shortly as we have a bit more to work on. The dedicated servers will run linux and be available via a Steam depot.

  • Progress Time - This option is the same as the solo setting. When true time progresses based on the ‘Day Length’ option. False results in time staying the same as launch time or the ’/time’ the server admin sets the server to.
  • Day Cycle Length - The in game time cycle length based on minutes 15m, 30m, 45m (Default), 1h, 1h 30m, 2h, 3h, 4h, 5h and lastly 24h.
  • Time Persistence - When true time progresses based on the 'Day Cycle Length' option. False results in time staying the same as launch time or the '/time' the server admin sets the server too.
  • Starting Weather - The weather when the server is started. Sunny (Default), Light Rain, Heavy Rain, Storm, Light Snow, Heavy Snow, Snow Storm.
  • Random Weather - Should server have random weather events. If false then server remains in starting weather state.
  • Name Tag Distance - The distance that name tags are visible from. No name tags, Near, Medium (Default), Far.
  • Announce Logins - Should players be notified when other players join the server? (True | False) e.g. “JB has joined the server”
  • Announce Deaths - Should other players be notified when another player dies. (True | False) e.g. “JB has been killed by a Zombie”
  • Player Nutrition - Do players need to consume food and drinks?
  • Stamina Drain - Should the player have stamina drain and how fast should it drain?.
  • Loot Spawn - The rate at which loot spawns. Also controls the quantity of loot. 0 (No loot) - 9 (Overload).
  • Hordes - The horde difficulty in game. Can be used to turn hordes off completely.
  • Zombie Amount - The amount of zombies on the server. Off, Low, Medium (Default), High.
  • Vehicles Amount - The amount and spawn frequency of vehicles on the server. Off, Low, Medium (Default), High.
  • Starting Components - The amount of items machines like fires and generators spawn with. None,Low, Medium (Default), High. e.g. A campfire should have firewood and tinder already in it when server starts.
  • PvP Disabled - If true players cannot hurt each other.
  • Player Starting Items - The item ID numbers to items you want the player to start with. Item ID numbers must be separated with a. comma. The last ID doesn’t need a comma e.g. 1000, 525, 3004 > You can find an Item ID list HERE.
  • Server Name - The server name as displayed in the server list.
  • Server Password - The server password.
  • First Join Message - The message that players receive when they first join your server.
  • Return Join Message - The message players receive when they return to your server.
  • IP Address - The IP of your server. This should be set to the public IP address of your current network.
  • Connection Port - The port that other players should use to connect to your server. Note that this port needs opening and forwarding via your router.
  • Show in Public Servers - When true your server will show in the public list of servers. When false players must join using the direct connect text field and your servers IP and Port.
  • Steam Query Port - The port that Steam uses to query your server. Used for showing in the public server list. Only required if 'Show in Public Servers' is set to true. Note: Should not be the same as connection port.

You will notice a Database tab as well. This tab will allow you to backup your solo match. You can use it to save and restore old server states or delete your current state. This functions exactly the same as the Solo setting does.

Server Configuration Files and More

The in game server host tab gives you a lot of options to get started with. If you feel you'd like to venture a little further there are a few more adjustments that can be made in the serverconfig.txt. You will be able to better tailor your experience if you'd like although we do suggest you check out some presets first to get a good feel for things. There are quite a few additional files that can be edited as well.


Craftables.json

An example of a craftable json file.

{
    "allCraftables": [
        {
            "craftableName": "Air Horn Tripwire",
            "produces": [
                "4023:0"
            ],
            "consumedItems": [
                {
                    "itemName": "Firewood",
                    "item": "2527:0",
                    "resourcesOverride": 0
                },
                {
                    "itemName": "Wire Spool",
                    "item": "2526:0",
                    "resourcesOverride": 0
                }
            ],
            "requiredTools": [],
            "showFirstToolNameInCraftableName": false,
            "showFirstConsumedNameInCraftableName": false,
            "customStringInBrackets": "",
            "workBenchType": 0,
            "timeToCraft": 3.0,
            "keepsFirstConsumablesQuality": false,
            "keepsFirstConsumablesResources": false,
            "craftableIsEnabledIngame": true
        }
    ]
}

Consumables.json

An example of a consumables json file.

{
    "allConsumableJSON": [
        {
            "consumableName": "Drop_Apple",
            "pickupItem": "791:0",
            "consumableType": 0,
            "thisConsumablePortion": 0,
            "cals": 0,
            "hydration": 0,
            "health": 0,
            "stamina": 0,
            "sicknessChance": 0,
            "passiveTaskTokens": 0,
            "requiredToConsume": [],
            "givesBack": ""
        },
        {
            "consumableName": "Drop_Banana",
            "pickupItem": "792:0",
            "consumableType": 0,
            "thisConsumablePortion": 0,
            "cals": 0,
            "hydration": 0,
            "health": 0,
            "stamina": 0,
            "sicknessChance": 0,
            "passiveTaskTokens": 0,
            "requiredToConsume": [],
            "givesBack": ""
        },
        {
            "consumableName": "Drop_Berry_Large_Green",
            "pickupItem": "518:0",
            "consumableType": 0,
            "thisConsumablePortion": 0,
            "cals": 25,
            "hydration": 15,
            "health": 0,
            "stamina": 25,
            "sicknessChance": 1,
            "passiveTaskTokens": 0,
            "requiredToConsume": [],
            "givesBack": ""
        }
    ]  
}

ServerConfigTEMPLATE.txt

 1 //   _____                  _             _______ _            _   _ _       _     _       
 2 //  / ____|                (_)           |__   __| |          | \ | (_)     | |   | |      
 3 // | (___  _   _ _ ____   _____   _____     | |  | |__   ___  |  \| |_  __ _| |__ | |_ ___ 
 4 //  \___ \| | | | '__\ \ / / \ \ / / _ \    | |  | '_ \ / _ \ | . ` | |/ _` | '_ \| __/ __|
 5 //  ____) | |_| | |   \ V /| |\ V /  __/    | |  | | | |  __/ | |\  | | (_| | | | | |_\__ \
 6 // |_____/ \__,_|_|    \_/ |_| \_/ \___|    |_|  |_| |_|\___| |_| \_|_|\__, |_| |_|\__|___/
 7 //  / ____|                                           / _(_)            __/ |              
 8 // | (___   ___ _ ____   _____ _ __    ___ ___  _ __ | |_ _  __ _      |___/               
 9 //  \___ \ / _ \ '__\ \ / / _ \ '__|  / __/ _ \| '_ \|  _| |/ _` |                         
10 //  ____) |  __/ |   \ V /  __/ |    | (_| (_) | | | | | | | (_| |                         
11 // |_____/ \___|_|    \_/ \___|_|     \___\___/|_| |_|_| |_|\__, |                         
12 //                                                           __/ |                         
13 //                                                          |___/     
14 //                                                                                            
15 // Configuration Options
16 //
17 // Usage
18 //
19 // Options
20 //   ServerOwner:             {String}      Optional     //This is only required for first start in order to write to the ServerUsers.txt this must be your steamID64, find ID at - https://steamid.io/
21 //   ServerName:              {String}      Required     //Default "New Private Server". Quotations required but will not show in server list.
22 //   ServerPassword:          {String}      Optional     //String server password. Must not contain spaces. Quotations required but will not be included in password.
23 //   FirstJoinWelcomeMessage: {String}      Optional     //Message displayed to player when player joins the server for the first time.
24 //   RecurringWelcomeMessage: {String}      Optional     //Message displayed to player when player rejoins the server.
25 //   ProgressTime:            {true, false} Optional     //Enable day night cycle.
26 //   DayCycleInMinutes:       {int}          Optional     //Length of a day night cycle in minutes.
27 //   TimePersistence:         {true, false} Optional     //Continue from time, day and month after server restart. False means the server starts at mid day in spring on server start.
28 //   StartingWeather:         {0,1,2,3}     Optional     //Default 0. Sunny=0 LightRain=1 HeavyRain=2 Storm=3 LightSnow=4 HeavySnow=5 SnowStorm=6.
29 //   RandomWeather:           {true, false} Optional     //True by default. Weather switches at random to match season.
30 //   NameTagDistance:         {0,1,2,3}     Optional     //The distance at which nametags no longer show. 0 = off, 1 = near, 2 medium(default) and 3 = far.
31 //   ShowLoginMessages:       {true, false} Optional     //Should login messages show when new player enters or leaves the server.
32 //   ShowDeathMessages:       {true, false} Optional     //Should the server announce when a player dies.
33 //   PlayerNutrition:         {true, false} Optional     //Does the players nutrition and hydration go down.
34 //   StaminaDrainRate:        {true, false} Optional     //Does stamina drain.
35 //   LootSpawnRate:           {0-9}         Optional     //Global loot spawn rate. 0=NoLoot 1=Rare 2=Medium 3=High
36 //   GrowRate:                {0,1,2,3}     Optional     //Global grow rate. 0=NoGrowing 1=Slow 2=Medium 3=Fast
37 //   HordeDifficulty:         {0,1,2,3}     Optional     //Horde difficulty. 0=NoHorde 1=Easy 2=Medium 3=Hard
38 //   ZombieAmount:            {0,1,2,3}     Optional     //The overall density of zombies in the world between 0 and 5. 0 = off
39 //   PassiveAiAmount:         {0,1,2,3}     Optional     //The overall density of passive AI in the world between 0 and 5. 0 = off
40 //   VehicleSpawnRate:        {0 - 9}       Optional     //Global spawn rate for vehicles. This number is a multiplier against LootSpawnRate
41 //   StartingComponentsAmount:{0,1,2,3}     Optional     //The global amount of starting components inside of machines like generators and electricity panels. 
42 //   ForcedSpawnPoint         {0 > max}     Optional     //the spawn point that is chosen by default. Based on the spawnPoints array. Comment or remove if not needed. Alternatively mark as -1 to disable.
43 //   ServerLoadType           {0>}          Optional     //Determines the amount of sectors loaded when running in the editor. 0 = soft load and likely wants to be on when testing.
44 //   RestartRate              {int}         Optional     //The amount of hours between server restarts. Note if set to 12 then the servers will restart at 3am and 3pm local time. If set to 24h then server will restart at 3am
45 //   SoloDifficulty           {int}         Optional     //Presets for game difficulty on solo server. 0=easy, 1= med, 2 hard and 3 = hardcore.
46 //
47 // Format
48 //  string Example: ServerOwner=76561198004636696
49 //  int    Example: DayCycleInMinutes=45 
50 //
51 ServerIP="127.0.0.1"
52 ServerPort=0
53 ServerOwner=                     
54 ServerName="New Private Server"  
55 ServerPassword=                  
56 WelcomeMessage="Welcome to the server."
57 RecurringWelcomeMessage="Welcome to the server."
58 ProgressTime=true      
59 DayCycleInMinutes=45               
60 TimePersistence=true              
61 StartingWeather=0                 
62 RandomWeather=true         
63 NameTagDistance=2           
64 ShowLoginMessages=true           
65 ShowDeathMessages=true         
66 PlayerNutrition=true     
67 StaminaDrainRate=true               
68 LootSpawnRate=3             
69 HordeDifficulty=2                 
70 ZombieAmount=2              
71 PassiveAiAmount=2            
72 VehicleSpawnRate=2                   
73 StartingComponentsAmount=2       
74 ShowInPublicLobby=true
75 PvpDisabled=false
76 PlayerStartingItems=2574
77 SoloDifficulty=2

ServerUsers_README.txt

The ServerUsers.txt file stores all the players that have ever been on a server. Altering this file directly should not generally be required.

The main reason to edit this file would be to increase a players user group. The number directly after the long Steam ID. When in game players can promote other player to any rank that is lower than their own. To set a rank in-game.

  • /setrank userName indexOfRank

Or

  • /setrank userName rankName

Example user:  76561198004636696,3,false,false,Jayty

ServerUsers.txt

As the ReadMe indicates the serveruser file contains a list of all players who have entered your server.

  • 76561198038502026,2,false,false,JB (SteamID, Rank, - , - , Steam Name)
  • 76561198004636696,3,false,false,Jayty

TpPresets_README.txt

The TpPresets.json holds a series of teleportation locations. To edit, add or remove these presets the following commands can be used in game.

  • /tppreset add nameOfPreset //This adds a tp location a the place where your player is currently located.
  • /tppreset update nameOfPreset //This will edit an existing preset to the location the player is currently located.
  • /tppreset remove nameOfPreset //Deletes preset of name.
  • /tppreset clear //Clears all tp presets.
  • To use preset locations enter the commands.
  • /tp me nameOfPreset //Tp's yourself to location.
  • /tp userName nameOfPreset //Tp's another player to location.

NOTE: Requires teleportation permissions to edit/use.

TpPresets.json

An example of a TpPreset.json.

 1 {
 2     "presets": [
 3         {
 4             "name": "oldtown",
 5             "preset": {
 6                 "x": -1394.1190185546875,
 7                 "y": -31.57574462890625,
 8                 "z": -2496.749755859375
 9             }
10         },
11         {
12             "name": "addersfield",
13             "preset": {
14                 "x": 3287.663330078125,
15                 "y": -43.600486755371097,
16                 "z": -894.3609008789063
17             }
18         },
19         {
20             "name": "blackrock",
21             "preset": {
22                 "x": 2680.36181640625,
23                 "y": -56.40800476074219,
24                 "z": -2946.27197265625
25             }
26         },
27         {
28             "name": "sagecreek",
29             "preset": {
30                 "x": 2040.5694580078125,
31                 "y": 51.473960876464847,
32                 "z": 1239.3262939453125
33             }
34         },
35         {
36             "name": "unionpoint",
37             "preset": {
38                 "x": -939.76123046875,
39                 "y": 54.973411560058597,
40                 "z": 813.2296142578125
41             }
42         },
43         {
44             "name": "mountbaron",
45             "preset": {
46                 "x": -1528.0,
47                 "y": 320.0,
48                 "z": -752.0
49             }
50         },
51     ]
52 }

UserPermissions_README.txt

The UserPermissions.json file contains the base set of user groups and permissions. The UserPermissions.json can be changed while the server is offline in order to setup ranks and their perms.

By default base user groups such as 'User' (All general users) right through to 'Owner' status is setup. Any user group that has the permission '*' has access to ALL in game commands and this should be used sparingly.

Editing: The most important thing when editing is to ensure that the json architecture is maintained.  Otherwise the server will fail to read the file and not run.

List of all perms. Note that some may not work as expect or work at all.

  •     BasicUser,
  •     DropAllSelf,
  •     DropAllOthers,
  •     DeleteAllSelf,
  •     DeleteAllOthers,
  •     SpawnAI,
  •     KillAI,
  •     SetTime,
  •     SetMonth,
  •     SetWeather,
  •     WeatherOnOff,
  •     TpToLocation,
  •     TpToPlayer,
  •     TpPlayerToMe,
  •     TpPlayerToPlayer,
  •     TpPresets,
  •     GodSelf,
  •     SuperSprint,
  •     ServerInfo,
  •     Give,
  •     Mute,
  •     Kick,
  •     Ban,
  •     UnBan,
  •     SetStatsSelf,
  •     SetStatsOthers,
  •     KillPlayer,
  •     SetRank,
  •     CleanUp,
  •     Up,
  •     AlwaysSafeLogOff,
  •     StuckOthers,
  •     ChatOff,
  •     Video,
  •     Restart


UserPermissions.json

{
  
	"SystemRanks":[
    {
	  "Index_DontChange":-2,
      "Name_DontChange":"Console",
      "ChatPrefix":"[Console]",
      "PrefixColour":"white"
    },
	{
	  "Index_DontChange":-1,
      "Name_DontChange":"Whisper",
      "ChatPrefix":"[Whisper]",
      "PrefixColour":"darkgrey"
    }
	],
	"UserRanks":[
    {
      "Index":0,
      "Rank":"User",
      "ChatPrefix":"[User]",
      "PrefixColour":"white",
      "Permissions":["Tell", "Reply", "ServerInfo"]
    },
    {
      "Index":1,
      "Rank":"Mod",
      "ChatPrefix":"[Mod]",
      "PrefixColour":"yellow",
      "Permissions":["Tell", "Reply", "Mute", "UnMute", "Kick", "GodSelf", "SuperSprint", "cmdGroup.TP", "DropAllSelf", "DropAllOthers",  "Up" ,"ServerInfo"]
    },
    {
      "Index":2,
      "Rank":"Admin",
      "ChatPrefix":"[Admin]",
      "PrefixColour":"darkred",
      "Permissions":["*"]
    },
    {
      "Index":3,
      "Rank":"Owner",
      "ChatPrefix":"[Owner]",
      "PrefixColour":"purple",
      "Permissions":["Tell", "Reply", "Mute", "UnMute", "Kick", "SetTime", "Ban", "UnBan", "ServerInfo"]
    }        
  ], 
  "CommandGroups":[
    {
      "GroupName":"TP",
      "Permissions":["TpToLocation","TpToLocation", "TpToPlayer", "TpPlayerToMe", "TpPlayerToPlayer"]
    },
    {
      "GroupName":"Weather",
      "Permissions":["SetTime", "SetMonth", "SetWeather", "WeatherOnOff"]
    },
    {
      "GroupName":"ExampleGroupNinjaMod",
      "Permissions":["Kick", "Mute", "GodSelf"]
    }
    ]
}