Class SceneChannelSystem
- Namespace
- FishMMO.Server.Implementation.World.SceneServer
- Assembly
- FishMMO.Server.dll
Scene server subsystem that handles channel selection for open world scenes. Provides channel listing (aggregating scene instances across all scene servers on the same world server via database queries) and same-server channel switching.
[CreateAssetMenu(fileName = "SceneChannelSystem", menuName = "FishMMO/Server/SceneServer/Scene Channel System", order = 2)]
[RequiresDataContainer(typeof(SceneChannelSystemMainThreadQueueData))]
[RequiresDataContainer(typeof(SceneChannelSystemRuntimeData))]
[RequiresDataContainer(typeof(AsyncWorkerData))]
public class SceneChannelSystem : ServerBehaviour, IServerBehaviour<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, IServerComponent<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, ISceneChannelSystem, IServerBehaviour, IServerComponent
- Inheritance
-
ObjectScriptableObjectSceneChannelSystem
- Implements
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Channels are multiple instances of the same scene on the same world server, potentially
hosted across different scene servers. The channel list is fetched from the database
using ISceneService.FetchAvailableAsync and ISceneServerService.FetchAsync
to include instances beyond the local scene server.
DoS protections:
- IngressGuard per-connection, per-operation rate limiting with debounce and in-flight gating.
- Periodic sweep of stale ingress entries to bound memory growth.
- Main-thread queue for marshalling async DB results safely.
- Connection validation on every broadcast handler entry point.
- Per-connection channel switch cooldown enforced server-side.
- Bounded channel switch cooldown dictionary with periodic cleanup.
Methods
InitializeOnce()
Initializes the channel system. Validates all dependencies, registers broadcast handlers, subscribes to character load and connection events, and clamps serialized fields.
public override ServerComponentInitializationStatus InitializeOnce()
Returns
OnDeinitialize()
Deinitializes the channel system. Unregisters broadcast handlers, unsubscribes from events, and drains any remaining main-thread queue actions.
public override void OnDeinitialize()
OnRemoteConnectionStopped(NetworkConnection)
Cleans up cooldown and ingress tracking when a remote connection disconnects.
protected override void OnRemoteConnectionStopped(NetworkConnection conn)
Parameters
connNetworkConnectionThe disconnected network connection.
OnUpdate(float)
Called each frame. Drains the main-thread queue, sweeps ingress entries, and cleans up stale cooldown dictionary entries.
protected override void OnUpdate(float deltaTime)
Parameters
deltaTimefloatTime elapsed since last frame.