Zones, Scenes and Multi-Zone
Build scene index
Unity's EditorBuildSettings scene list maps build indices to scene files:
| Index | Scene name | Notes |
|---|---|---|
| 0 | LoginScene | Authentication and server connection |
| 1 | CharacterSelect | Class selection |
| 2 | HUB | Central hub area |
| 3 | Darkwood | Darkwood zone |
| 4 | Ashen Wastelands | Ashen Wastelands zone |
| 5 | Toujam Basin | Toujam Basin zone |
| 6 | GM Island | GM-only test area |
| 7 | VoidDungeon | Placeholder — future dungeon build |
| 8 | _Container | Multi-zone container scene |
Source: EditorBuildSettings.asset. Indices do not change when scenes are added to the array.
SceneNames constants
SceneNames (static class) centralizes all scene name strings and asset paths:
| Constant | Value | Notes |
|---|---|---|
LoginScene | "LoginScene" | |
CharacterSelect | "CharacterSelect" | |
Hub | "HUB" | |
Darkwood | "Darkwood" | |
AshenWastelands | "Ashen Wastelands" | |
ToujamBasin | "Toujam Basin" | |
Boneyard | "Boneyard" | |
GMIsland | "GM Island" | |
VoidDungeon | "VoidDungeon" | |
GatheringZone | "Gathering Zone" | AFK gathering and crafting |
PvpZone | "PVPZONE" | Open-combat PVP zone |
ArenaCopper | "ArenaCopper" |
Full asset paths follow the pattern Assets/Game/Scenes/<SceneName>.unity and are exposed as *Path constants (e.g. PvpZonePath = "Assets/Game/Scenes/PVPZONE.unity").
Zone array
SceneNames.Zones is the authoritative list of scenes a character can be standing in when they log out. Zones are used for logout-position persistence and scene availability checks:
Hub, Darkwood, ToujamBasin, Boneyard, AshenWastelands, GMIsland, VoidDungeon,
GatheringZone, ArenaCopper, PvpZone
SceneNames.IsZone(sceneName) checks membership in this array (case-insensitive).
Login spawn zone
When a character connects, the server restores the zone they last logged out of. SceneNames.NormalizeZone(map) collapses unknown or legacy zone values to HUB. If the resolved zone is unavailable at login time, PrepareZone falls back to HUB.
The server uses the restored zone and saved position only when all of the following are true:
auth.hasSavedPositionistrue— positions matching 0/0/0 or the legacy DB default 0/2/0 are markedfalseand treated as fresh characters with no saved location.- The Y coordinate is above −20 (guards against positions saved while the character was falling through the map).
- X, Y, and Z are finite (not NaN or Infinity).
- A ground surface exists within 10 units below the saved position (zone-physics raycast; excludes the player's own colliders).
- The zone resolved by
PrepareZonematches the stored zone name — if a fallback to HUB occurred, coordinates from the original zone are discarded.
When any condition fails, the character spawns at the zone's configured spawn point. Fresh characters always use the HUB spawn point on first login.
Sources: RodNetworkManager.cs, RodNetworkAuthenticator.cs.
Arrival position placement
When a character has a valid saved position, RodNetworkManager calls ZoneManager.PlaceAtSafePosition() to resolve the final arrival position before the character is placed in the scene.
ZonePhysics.OverlapCapsule() tests the saved position for occupancy by other players using the player's own capsule dimensions. If the position is clear, it is used as-is. If another player occupies it, ResolveArrivalPosition() searches outward on expanding rings — up to six rings, with ring × 8 candidate slots per ring — for a grounded, capsule-clear position.
A candidate position must satisfy:
- A ground surface exists within 2.5 units (Y) of the saved coordinate, found by raycasting downward from
ArrivalGroundSearchHeight(3 units above). - The ground slope is below 50 degrees.
- No overlapping non-player geometry when tested with a capsule cast at the player's dimensions.
If no completely unoccupied slot is found within the six-ring search radius, the least-crowded grounded slot is used. Player-versus-player occupancy is scored separately from world geometry so a grounded fallback is always available even when all nearby slots are occupied.
The resolved position is applied to both the Rigidbody and CharacterController. Physics.SyncTransforms() is called before and after placement, and NetworkTransform.ServerTeleport() is called to prevent the network transform from interpolating the character across the map.
Source: ZoneManager.cs, ZonePhysics.cs, RodNetworkManager.cs.
PVP Zone
Scene name: "PVPZONE". Asset path: Assets/Game/Scenes/PVPZONE.unity.
The PVP zone is an open-combat area where players can fight one another. All players inside the PVPZONE scene can deal damage to each other using existing offensive abilities; no per-ability changes are required. Player-on-player damage is blocked by PvpCombatRules.ShouldBlockPlayerDamage in every other scene.
Arrival and respawn spawn points are randomized when the scene contains more than one HubReturnSpawnPoint — one is chosen at random on each arrival. Non-PVP scenes always use the first matching spawn point.
The GM chat command /arrive pvp (aliases: pvpzone) teleports a GM to the PVP zone. The zone is also reachable via the waypoint map (node "pvp", connected to Boneyard with a dashed line). See Waypoints, Portals and Travel and GM Console and Tools.
ZoneManager events
ZoneManager exposes three events and a query method for systems that track per-zone state:
| Event / method | Signature | Description |
|---|---|---|
ZoneLoaded | event Action<Scene> | Fired after a zone finishes loading and its NetworkIdentity objects are spawned. |
ZoneOccupancyChanged | event Action<Scene, int> | Fired when a player arrives in or departs from a zone; the int argument is the updated occupant count. |
ZoneUnloading | event Action<Scene> | Fired immediately before an empty zone begins unloading. |
OccupantCount(Scene) | int | Returns the current number of connections assigned to the scene, or 0 if the scene is not tracked. |
Source: ZoneManager.cs.
Dynamic ore spawning
ZoneOreSpawner is a server-side DontDestroyOnLoad singleton bootstrapped at runtime by RuntimeInitializeOnLoadMethod(AfterSceneLoad). It subscribes to ZoneManager events and maintains an occupancy-scaled population of DynamicMineralVein ore nodes in each eligible zone.
Eligibility: Any zone where SceneNames.IsZone(scene.name) is true, excluding HUB (which uses static gathering stations) and VoidDungeon (placeholder with no playable ground).
Target node count: Nodes scale with zone occupancy using:
target = Clamp(minimumNodes + Max(0, occupants − 1) × nodesPerAdditionalPlayer, minimumNodes, maximumNodes)
Default values: minimumNodes = 10, nodesPerAdditionalPlayer = 2, maximumNodes = 30.
Reconcile: A background coroutine reconciles all occupied zones every reconcileSeconds (default 15 s). Reconciliation also fires immediately on ZoneLoaded and ZoneOccupancyChanged.
Placement: Each zone scene contains one or more OreSpawnVolume components placed by DynamicOreSpawnerBuilder. For each new node needed, the spawner makes up to placementAttemptsPerNode (default 40) raycast attempts through the volumes. A placement is accepted when:
- A ground surface is found within the volume (downward raycast).
- Ground slope ≤
maximumGroundSlope(default 42°). - Distance from any existing node ≥
minimumNodeSpacing(default 5 m). - Distance from any connected player ≥
minimumPlayerSpacing(default 8 m).
Despawn: Nodes above the current target are retired only when depleted — a node is never removed while actively being mined.
Network prefab: DynamicMineralVein at Gathering/NetworkPrefabs/. Registered in RodNetworkManager.OnStartClient alongside class and enemy loot prefabs.
Persistent node ID: Each spawned node receives a persistentNodeId of the form dynamic:<sceneName>:<sceneHandle>:<index>, used by GatheringPersistenceService to identify the node in award requests.
Sources: ZoneOreSpawner.cs, ZoneManager.cs, RodNetworkManager.cs.
OreSpawnVolume
OreSpawnVolume (MonoBehaviour, DisallowMultipleComponent) marks an author-defined area within a zone scene where dynamic ore nodes may be placed.
| Field | Type | Notes |
|---|---|---|
size | Vector3 | World-space extents of the spawn box; each axis is clamped to ≥ 1 m. |
groundSearchHeight | float | Height above the box top from which ground raycasts originate (≥ 0.1). |
Volumes are placed and sized by DynamicOreSpawnerBuilder (BCE ▶ Setup ▶ 12 ▶ Dynamic Ore Spawns — Build). The builder derives bounds from scene terrain or collider geometry; scenes without detectable geometry are flagged for manual volume placement.
Loading screen artwork
LoadingScreen displays zone-specific artwork while a scene transition is in progress. The destination label passed to LoadingScreen.Show is normalized (non-alphanumeric characters stripped, lowercased) and looked up in an internal dictionary to select a texture from Resources/LoadingScreens/.
| Normalized destination key(s) | Resource file |
|---|---|
hub | LoadingScreens/hub |
darkwood | LoadingScreens/darkwood |
toujambasin | LoadingScreens/toujam-basin |
boneyard | LoadingScreens/boneyard |
ashenwasteland, ashenwastelands | LoadingScreens/ashen-wastelands |
gatheringzone | LoadingScreens/gathering-zone |
arenacopper, copperarena | LoadingScreens/arena-copper |
pvpzone | LoadingScreens/pvp-zone |
gmisland | LoadingScreens/gm-island |
voiddungeon | LoadingScreens/void-dungeon |
When no matching texture is found, the background falls back to a near-black color (0.05, 0.05, 0.08). A semi-transparent dark veil (alpha 0.26) is drawn over the artwork to keep the scene label readable. The artwork is displayed with AspectRatioFitter in EnvelopeParent mode at the sprite's native aspect ratio.
Source: LoadingScreen.cs.
Multi-zone (container scene)
_Container (build index 8) is the additive container scene for multi-zone setups. MultiZoneSetupBuilder configures how zone scenes are additively loaded into the container at runtime. See the Editor Tooling documentation for build steps.
Related: Waypoints, Portals and Travel · GM Console and Tools · Combat Core and Loop