Servidores

Hospede seu próprio servidor

O guia de servidores do próprio jogo. Para a parte da engine, leia o guia de servidores dedicados da Facepunch.

Disponível só em inglês.

There are two ways to play together:

  • Lobby: in the main menu, host game starts the island on your own computer. Friends join from their server browser (play game > lobbies) or through your Steam profile. The world only runs while you play.
  • Dedicated server: a separate program (sbox-server) runs the island without a player, so the world keeps running when nobody is online. Players find it under play game > servers.

This page explains the dedicated server. Facepunch’s own guide covers the engine side in more detail: https://sbox.game/dev/doc/networking/dedicated-servers/.

1. Install the s&box dedicated server

On a machine without s&box, use SteamCMD (app 1892930):

steamcmd +login anonymous +app_update 1892930 validate +quit

The server lands in steamcmd/steamapps/common/sbox dedicated server. Re-run the command when s&box updates. If you already have s&box installed through Steam, sbox-server.exe is also in the s&box folder.

The dedicated server no longer ships the Steam client libraries. Either install the Steam client on the machine, or link them as the Facepunch guide shows (registry keys on Windows, ~/.steam/sdk64/steamclient.so symlink on Linux).

2. Start it

Windows, Run-Server.bat next to sbox-server.exe:

sbox-server.exe +game redfive.rustlegacy +hostname "My Rust Legacy Server"

Linux, run-server.sh:

#!/bin/bash
./sbox-server +game redfive.rustlegacy +hostname "My Rust Legacy Server"

The server loads the island directly (no menu) and logs World loaded: ... then Connected to Steam. Connections go through Steam’s relay by default, so you do not need to open ports and your IP address stays hidden. To use other ports, add +port <port> (game) and +net_query_port <port> (server list queries).

A Steam game server token keeps the same server identity across restarts (history and favourites of your players keep working): create one at https://steamcommunity.com/dev/managegameservers for s&box (app id 590830) and add +net_game_server_token <token>. Facepunch notes that tokens may only work once s&box is fully released.

3. Settings

A lobby hosted from the main menu sets these rules in host lobby → game settings, one set per lobby save. A dedicated server does not use that screen: it keeps its command line, as below. In a lobby, a value typed in the console is kept for that save but brought back within the screen’s slider range at the next save (for example rl_gather_rate 20 at most).

Every setting is a console variable. Put it on the command line (+rl_pvp 0) or type it in the server console (rl_pvp 0). Settings are saved from one start to the next, so removing a setting from the command line does not bring back its default: set it again to the default value. rl_config prints the current values. Defaults are Legacy’s wherever Legacy’s value is known; settings marked not in Legacy are additions of this game mode. Values outside the range are clamped.

Example for a small PvE server:

sbox-server.exe +game redfive.rustlegacy +hostname "Legacy PvE" +rl_max_players 20 +rl_pvp 0 +rl_bot_raid 0 +rl_airdrop_min_players 5

Rules

Variable Default Range Meaning
rl_pvp 1 0 / 1 Players can hurt each other (sleepers included)
rl_sleepers 1 0 / 1 Disconnected players stay asleep in the world and can be killed and looted
rl_decay 1 0 / 1 Buildings and deployables decay when left alone
rl_decay_rate 1 0 to 1000 Decay speed multiplier
rl_metabolism 1 0 / 1 Hunger, cold, bleeding and poison
rl_fall_damage 1 0 / 1 Fall damage and leg injuries
rl_condition_loss 1 0 to 100 Wear of weapons, tools and armor (0 = no wear)
rl_third_person 0 0 / 1 Players can switch to third person with the view key (Legacy: first person only)
rl_tree_felling 0 0 / 1 Trees run out of wood, fall and regrow (Legacy: infinite wood)

Progression

Variable Default Range Meaning
rl_gather_rate 1 0.1 to 100 Gather rate multiplier
rl_craft_speed 1 0.1 to 100 Crafting speed multiplier
rl_craft_queue 0 0 / 1 Allow queuing several crafts (Legacy: one craft at a time)

Time

Variable Default Range Meaning
rl_day_length 45 1 to 600 Day length in real minutes
rl_night_length 15 1 to 600 Night length in real minutes

Loot and events

Variable Default Range Meaning
rl_airdrop_min_players 0 0 to 500 Players needed for airdrops, 0 = always (Legacy: 50)
rl_airdrop_interval 0 0 to 1440 Real minutes between airdrops; 0 = Legacy schedule, one per game day between 10:00 and 14:00
rl_airdrop_crates 3 0 to 10 Crates dropped by each airdrop plane; 0 = Legacy, 1 to 3 at random
rl_crate_lifetime 30 0 to 1440 Minutes before an untouched world crate despawns (0 = never; never while a player is near)

Zombies, mutants, animals and bots

Variable Default Range Meaning
rl_mob_scale 1 0 to 5 Population multiplier of the 16 Legacy mutant spawners, zombies included (1 = the Legacy lists, 0 = none). Rounded up, so a small value still leaves one of each place. Not in Legacy: the zombies
rl_mob_respawn 300 0 to 86400 Seconds before a killed zombie or mutant is replaced
rl_mob_spawn_distance 60 0 to 500 Minimum distance in meters between a mob spawn and any player
rl_bots 30 0 to 64 AI survivors on the island (0 = off). Each is a persistent bot that gathers, crafts, builds and raids; its body exists only near players. Not in Legacy
rl_bot_infighting 1 0 / 1 Bots fight each other and the hostile mobs: a bot shoots back at whoever hits it, and now and then attacks a bot it meets (0 = they never hurt each other)
rl_bot_road_range 300 0 to 5000 Furthest distance in meters from the main road (the Legacy spawn markers) that bots appear and roam; they never go to the edge of the map (0 = no limit)
rl_bot_accuracy 0.5 0 to 1 Aim of the survivors, 0 = wild, 1 = sharp
rl_bot_respawn 180 0 to 86400 Seconds before a killed survivor is replaced elsewhere on the island
rl_bot_offline_rate 0.1 0 to 1 Speed of the survivors’ abstract life (gathering, looting, crafting, respawns) while nobody is connected: 0 = frozen, 1 = as with players online
rl_bot_build 1 0 / 1 Survivors build and keep a wooden base (0 = they never place pieces; existing bases stay in use)
rl_bot_raid 1 0 / 1 Survivors raid bases with explosive charges: bot bases at any time, player bases only while their owner or a guest of their doors is online (0 = never; raids under way stop)
rl_bot_raid_interval 120 0 to 10080 Minimum minutes between two raids of the same survivor
rl_bot_kit_naked 20 0 to 100 Spawn weight of Naked bots (no armor, a rock, a torch and bandages like a new player); 0 = never
rl_bot_kit_gatherer 12 0 to 100 Spawn weight of Gatherers (hatchet, pick axe, some wood and stones)
rl_bot_kit_builder 6 0 to 100 Spawn weight of Builders (hatchet, a lot of wood and planks)
rl_bot_kit_scavenger 28 0 to 100 Spawn weight of Scavenger survivors (cloth, pipe shotgun); 0 = never
rl_bot_kit_gunslinger 24 0 to 100 Spawn weight of Gunslingers (cloth, revolver)
rl_bot_kit_archer 22 0 to 100 Spawn weight of Archers (cloth, hunting bow)
rl_bot_kit_hunter 18 0 to 100 Spawn weight of Hunters (leather, 9mm pistol)
rl_bot_kit_brawler 6 0 to 100 Spawn weight of Brawlers (leather, shotgun)
rl_bot_kit_raider 2 0 to 100 Spawn weight of Raiders (leather, MP5A4)
rl_bot_kit_marksman 1 0 to 100 Spawn weight of Marksmen (leather, bolt action rifle)
rl_bot_kit_soldier 1 0 to 100 Spawn weight of Soldiers (kevlar, M4)
rl_animal_lod 1 0 / 1 Performance: animals far from every player are simulated in coarse steps. Leave it on unless you see animals behaving oddly

The wildlife (chickens, rabbits, boars, stags, wolves, bears) and the ore and wood piles come from the 30 Legacy spawner pockets and have no setting. Raising rl_mob_scale takes effect as mobs respawn; lowering it does not remove the mobs already there, so restart the server to apply it at once.

Access and slots

Variable Default Range Meaning
rl_admin_menu 0 0 / 1 Admin menu for the host of a lobby (a dedicated server gives it with the admin claim instead)
rl_admin_menu_all 0 0 / 1 Admin menu for every player: items, teleports, fly, god mode, and kicking, killing or bringing other players. Only for sandbox servers
rl_max_players 0 0 to 500 Server slots, read at startup (0 = the game’s 64). Pass it on the command line

Startup options

These belong to s&box, not to the game mode:

Option Meaning
+game redfive.rustlegacy The game to run
+hostname "name" Name shown in the server list
+port <port> / +net_query_port <port> Game port and server list query port. Needed when two servers share a machine
+net_game_server_token <token> Keeps the server identity across restarts (see above)
+net_allow_local 1 Lets s&box instances on the same machine join over loopback (development builds)

Console commands for the server console

Command Meaning
rl_config Print the current settings
rl_save Save the world now
rl_time <0-24> Set the time of day, e.g. rl_time 21.5
rl_timescale <n> Clock speed multiplier: 0 = frozen, 1 = Legacy, 60 = timelapse
rl_bot_status List the AI survivors: state, weapon, health, target
rl_bot_clear Remove every AI survivor (rl_bots fills the island again)
rl_perf [seconds] Frame times over the last seconds and the objects the scene holds
rl_admin_help List the admin commands (below)
status s&box: shows the server id players use with connect <id>

The admin commands in section 4 also work from the server console.

4. Admins

Admins are listed in the s&box file config/users.json, inside the server folder. Give the admin claim to the Steam accounts (SteamID64, shown on their Steam profile URL or with https://steamid.io):

[
	{
		"SteamId": "76561198000000000",
		"Name": "Charles",
		"Claims": [ "admin" ]
	}
]

The server reloads the file by itself; connected players get their rights within a few seconds. Admins can open the admin menu (Admin Menu key, / by default, in the s&box key binds) and run the Legacy admin commands from their own console: inv.give, inv.giveplayer, teleport.topos, teleport.toplayer, airdrop.drop, env.time, env.daylength, env.nightlength, airdrop.min_players (rl_admin_help lists their syntax). The server console can run all of them too.

The admin menu has the tabs Items, Animals, Resources, Build, Player, World, Players and Bots. On the Players tab an admin can teleport to a player or bring them, heal, feed, clear radiation, switch god mode, respawn, kill, kick, learn blueprints, give an item or a kit, and send them back to where they last died; some of these also work on sleepers. The Bots tab changes the number and aim of the AI survivors (rl_bots and rl_bot_accuracy) while the server runs. Admin actions are written to the server log with the admin’s name.

5. World save

The world (buildings, deployables, boxes, sleepers, player inventories, time of day) is saved every minute in the server’s data folder: data/redfive/rustlegacy/rustlegacy_world.json. Run rl_save in the server console before stopping the server so nothing from the last minute is lost. Back up that file to keep a world; delete it (server stopped) to start over from nothing. To wipe a running server, use rl_wipe_now full (blueprints too) or rl_wipe_now map in the server console; with rl_wipe_cycle 1 the server also wipes itself every month.

6. Joining

  • Server browser: main menu, play game, servers tab. Click a server, then join server (or click it twice). The star keeps a server at the top of the list; history lists the servers you joined.
  • By id: type status in the server console to read the server id, then players type connect <id> (or net.connect <id>) in their game console.
  • A server can be missing from the list on the computer that runs it, or on the same home network, because the Steam list shows it under the internet address. Players from elsewhere see it; on the same network, join by id.

Testing a development build

The server can run a local copy of the project instead of the published game, and send its code to the clients that join:

sbox-server.exe +game "C:\path\to\rustlegacy\rustlegacy.sbproj" +hostname "RL dev" +net_allow_local 1

+net_allow_local 1 lets s&box instances on the same machine join over loopback (sbox.exe -joinlocal), without the Steam relay. The server then shares the data folder of the s&box install it runs from: the same world save as the editor if both use the same install.