For the complete documentation index, see llms.txt. This page is also available as Markdown.

Interface ksIServerRoom

Namespace: KS.Reactor.Server Assembly: KSReactor.dll

Public interface for a server room. A room can have a simulation. Players can connect to rooms.

public interface ksIServerRoom

Properties

AllowPlayerSpawning

Are players allowed to spawn entities? Changing this value at runtime will not sync to clients, so if you change it to true at runtime, you must also change the spawn rule on the clients to allow them to spawn entities.

bool AllowPlayerSpawning { get; set; }

Property Value

bool

CacheTimer

Perfomance timer that tracks the amount of time it takes to cache a frame for the encoder.

ksIPerformanceTimer CacheTimer { get; }

Property Value

ksIPerformanceTimer

Cluster

Cluster Interface

Property Value

ksICluster

ConnectedPlayerCount

Number of connected (non-virtual) players.

Property Value

int

ControllersTimer

Performance timer that tracks the amount of time it takes to update all player controllers.

Property Value

ksIPerformanceTimer

Coroutines

Access to the coroutine sub system.

Property Value

ksCoroutineManager

DefaultPhysXScene

Get the default PhysX scene. When spawning new entities, they will be added to this scene.

Property Value

pxScene

DefaultPhysXSceneIndex

Get the default PhysX scene index.

Property Value

int

DynamicEntities

List of dynamic (non-permanent) in the room.

Property Value

ksConstList<ksIServerEntity>

EncodeTimer

Perfomance timer that tracks the amount of time it takes to enocde and send data to connected clients.

Property Value

ksIPerformanceTimer

Entities

List of entities in the room.

Property Value

ksMultiList<ksIServerEntity>

Id

Room ID

Property Value

uint

Info

Room info containing data that is part of the response to GetRoomInfo calls, and, for public rooms, is also part of the response when client's call ksReactor.GetServers. Includes data required for connecting to the room.

Property Value

ksRoomInfo

InputBufferDropLimit

Drop inputs if a player's input buffer reaches this size.

Property Value

int

InputBufferWarnLimit

Warn that inputs are overloaded when a player's input buffer size goes over this limit.

Property Value

int

IsPublic

Is the room public

Property Value

bool

IsShuttingDown

Is the room shutting down?

Property Value

bool

OnPlayerSpawnEntity

Contains a Validate event for validating a player request to spawn an entity, and a Complete event that fire when a player spawns an entity.

Property Value

ksServerEvents.PlayerSpawnEntity

OnRPC

Invoked when a player calls an RPC on the room. Indexed by RPC id.

Property Value

ksEventMap<ksServerEvents.RPCHandler>

OnUpdate

Delegates are invoked every update in sorted order of indices.

Property Value

ksOrderedEventMap<ksUpdateEvent<ksServerEvents.UpdateHandler>>

ParallelControllerUpdates

Should player controller updates use multithreading to update in parallel?

Property Value

bool

ParallelOwnedEntityUpdates

Should entity transform and property updates from client-owned entities be applied in parallel on the server using multithreading?

Property Value

bool

PermanentEntities

List of permanent entities in the room.

Property Value

ksConstList<ksIServerEntity>

PhysXScenes

PhysX scenes managed by the room.

Property Value

ksConstList<pxScene>

Physics

Physics API

Property Value

ksBaseServerPhysics

PhysicsTimer

Perfomance timer that tracks the amount of time it takes to perform a physics simulation step.

Property Value

ksIPerformanceTimer

Players

List of players in the room.

Property Value

ksConstList<ksIServerPlayer>

Properties

Room Properties

Property Value

ksPropertyMap

PublicData

Public room data.

Property Value

ksJSON

PublicTags

Public room tags. Tags can be retrieved from ksRoomInfo objects returned in GetRooms calls from the cluster or on the client.

Property Value

ksHashSet<string>

RPCTimer

Performance timer that tracks the amount of time it takes to decode and invoke RPCs.

Property Value

ksIPerformanceTimer

Scene

Scene name

Property Value

string

Scripts

List of scripts attached to the room.

Property Value

ksScriptList<ksIServerRoom, ksServerRoomScript>

ScriptsTimer

Perfomance timer that tracks the amount of time it takes to run all script update methods.

Property Value

ksIPerformanceTimer

SkipFrameUpdates

Check or set whether updates should be run this frame. At the end of each frame this value is set to false. Setting this to true during an update will finish running all update handlers in the current execution group and prevent later execution groups from running.

Property Value

bool

State

Room state

Property Value

ksServerRoomStates

Time

Server time

Property Value

ksServerTime

Type

Room type

Property Value

string

UpdateTimer

Perfomance timer that tracks the amount of time update cycles take.

Property Value

ksIPerformanceTimer

VirtualPlayerCount

Number of virtual players.

Property Value

int

Methods

AddPhysXScene(pxScene, bool)

Add a PhysX scene to the list of scenes managed by the room.

Parameters

scene pxScene

PhysX scene

setAsDefault bool

If true, this scene will be set as the default scene.

CallBatchRPC(uint, IList<ksIServerEntity>, params ksMultiType[])

Calls a function on multiple entities for all players.

Parameters

rpcId uint

RPC ID to invoke

entities IList<ksIServerEntity>

Entities to send the RPC to.

arguments ksMultiType[]

RPC arguments

CallBatchRPC(ksIServerPlayer, uint, IList<ksIServerEntity>, params ksMultiType[])

Calls a function on multiple entities for a single player.

Parameters

player ksIServerPlayer

Player to send the RPC to.

rpcId uint

RPC ID to invoke

entities IList<ksIServerEntity>

Entities to send the RPC to.

arguments ksMultiType[]

RPC arguments

CallBatchRPC(IList<ksIServerPlayer>, uint, IList<ksIServerEntity>, params ksMultiType[])

Calls a function on multiple entities for a group of players.

Parameters

players IList<ksIServerPlayer>

Players to send the RPC to.

rpcId uint

RPC ID to invoke

entities IList<ksIServerEntity>

Entities to send the RPC to.

arguments ksMultiType[]

RPC arguments

CallRPC(uint, params ksMultiType[])

Calls a function on all players.

Parameters

rpcId uint

RPC ID to invoke.

arguments ksMultiType[]

RPC arguments

CallRPC(ksIServerPlayer, uint, params ksMultiType[])

Calls a function on a player.

Parameters

player ksIServerPlayer

Player to send the RPC to.

rpcId uint

RPC ID to invoke

arguments ksMultiType[]

RPC arguments

CallRPC(IList<ksIServerPlayer>, uint, params ksMultiType[])

Calls a function on a group of players.

Parameters

players IList<ksIServerPlayer>

Players to send the RPC to.

rpcId uint

RPC ID to invoke

arguments ksMultiType[]

RPC arguments

CreateVirtualPlayer(params ksMultiType[])

Create a virtual player and pass authentication arguments.

Parameters

authArgs ksMultiType[]

Authentication argurments.

GetEntity(ksEntityId)

Gets the entity in this room with the given id.

Parameters

entityId ksEntityId

Entity ID

Returns

ksIServerEntity

Entity

GetEntity(ksEntityId, uint)

Gets an entity by id. The id may be a temporary spawn id. If it is not a temporary id and the entity has a temporary spawn id, removes it from the player-spawned entity map.

Parameters

entityId ksEntityId

Entity id

playerId uint

Id of player who sent the message with the entity id. This is needed to get the entity if the id a temporary spawn id for an entity the player spawned.

Returns

ksIServerEntity

Entity, or null if none was found.

GetPlayer(uint, bool)

Gets the player with the given id connected to this room.

Parameters

playerId uint

Player ID

includeUnauthenticated bool

If true, a player who has not yet passed authentication may be returned.

Returns

ksIServerPlayer

Player

HasActivity(ActivityFlags)

Check for specific server activities. If a combination of flags is checked then the result will return true if any of the flags are set.

Parameters

flag ksServerRoomScript.ActivityFlags

Activity flags

Returns

bool

True if an activity corresponding to any of the set flags was tracked

RegisterRPC(uint, RPCHandler)

Register an RPC

Parameters

rpcId uint

RPC ID

rpcHandler ksServerEvents.RPCHandler

RPC Handler

RemovePhysXScene(pxScene)

Remove a PhysX scene from the list of scenes managed by the room.

Parameters

scene pxScene

PhysX scene to remove

ShutDown()

Shut down the room.

SpawnCollection(ksSpawnParams)

Spawns an entity collection using spawn parameters.

Parameters

spawnParams ksSpawnParams

Spawn parameters

Returns

List<ksIServerEntity>

Spawned entities

SpawnCollection(string)

Spawns a collection of entities from a prefab.

Parameters

type string

Prefab type.

Returns

List<ksIServerEntity>

Spawned entities.

SpawnCollection(string, ksVector3)

Spawns a collection of entities from a prefab.

Parameters

type string

Prefab type.

position ksVector3

Entity position

Returns

List<ksIServerEntity>

Spawned entities.

SpawnCollection(string, ksVector3, ksQuaternion)

Spawns a collection of entities from a prefab.

Parameters

type string

Prefab type.

position ksVector3

Entity position

rotation ksQuaternion

Entity rotation

Returns

List<ksIServerEntity>

Spawned entities.

SpawnCollection(string, ksVector3, ksQuaternion, ksVector3, ScaleModes)

Spawns a collection of entities from a prefab.

Parameters

type string

Prefab type.

position ksVector3

Entity position

rotation ksQuaternion

Entity rotation

scale ksVector3

Entity scale

scaleMode ksSpawnParams.ScaleModes

Is the scale an absolute or relative scale? Unlike with ksSpawnParams, this method defaults to absolute.

Returns

List<ksIServerEntity>

Spawned entities.

SpawnCollection(string, ksVector2)

Spawns a collection of entities from a prefab.

Parameters

type string

Prefab type.

position ksVector2

Entity position

Returns

List<ksIServerEntity>

Spawned entities.

SpawnCollection(string, ksVector2, float)

Spawns a collection of entities from a prefab.

Parameters

type string

Prefab type.

position ksVector2

Entity position

rotation float

Entity rotation

Returns

List<ksIServerEntity>

Spawned entities.

SpawnCollection(string, ksVector2, float, ksVector2, ScaleModes)

Spawns a collection of entities from a prefab.

Parameters

type string

Prefab type.

position ksVector2

Entity position

rotation float

Entity rotation

scale ksVector2

Entity scale

scaleMode ksSpawnParams.ScaleModes

Is the scale an absolute or relative scale? Unlike with ksSpawnParams, this method defaults to absolute.

Returns

List<ksIServerEntity>

Spawned entities.

SpawnEntity(ksSpawnParams)

Spawns an entity using spawn parameters.

Parameters

spawnParams ksSpawnParams

Spawn parameters

Returns

ksIServerEntity

Spawned entity

SpawnEntity()

Spawns an entity.

Returns

ksIServerEntity

Spawned entity.

SpawnEntity(string)

Spawns an entity from a prefab.

Parameters

type string

Prefab type.

Returns

ksIServerEntity

Spawned entity.

SpawnEntity(string, ksVector3)

Spawns an entity from a prefab.

Parameters

type string

Prefab type.

position ksVector3

Entity position

Returns

ksIServerEntity

Spawned entity.

SpawnEntity(string, ksVector3, ksQuaternion)

Spawns an entity from a prefab.

Parameters

type string

Prefab type.

position ksVector3

Entity position

rotation ksQuaternion

Entity rotation

Returns

ksIServerEntity

Spawned entity.

SpawnEntity(string, ksVector3, ksQuaternion, ksVector3, ScaleModes)

Spawns an entity from a prefab.

Parameters

type string

Prefab type.

position ksVector3

Entity position

rotation ksQuaternion

Entity rotation

scale ksVector3

Entity scale

scaleMode ksSpawnParams.ScaleModes

Is the scale an absolute or relative scale? Unlike with ksSpawnParams, this method defaults to absolute.

Returns

ksIServerEntity

Spawned entity.

SpawnEntity(string, ksVector2)

Spawns an entity from a prefab.

Parameters

type string

Prefab type.

position ksVector2

Entity position

Returns

ksIServerEntity

Spawned entity.

SpawnEntity(string, ksVector2, float)

Spawns an entity from a prefab.

Parameters

type string

Prefab type.

position ksVector2

Entity position

rotation float

Entity rotation

Returns

ksIServerEntity

Spawned entity.

SpawnEntity(string, ksVector2, float, ksVector2, ScaleModes)

Spawns an entity from a prefab.

Parameters

type string

Prefab type.

position ksVector2

Entity position

rotation float

Entity rotation

scale ksVector2

Entity scale

scaleMode ksSpawnParams.ScaleModes

Is the scale an absolute or relative scale? Unlike with ksSpawnParams, this method defaults to absolute.

Returns

ksIServerEntity

Spawned entity.

UnregisterRPC(uint, RPCHandler)

Unregister an RPC

Parameters

rpcId uint

RPC ID

rpcHandler ksServerEvents.RPCHandler

RPC Handler

OnAuthenticate

Authentication event. If any of the handlers return a non-zero result, authentication fails and subsequent handlers are not called. The handlers return a task for asynchronous authentication. The next handler is not called until the task from the previous handler completes. Handlers cannot be modified after room scripts are initialized.

Event Type

ksServerEvents.AuthenticateHandler

OnDestroyEntity

Invoked when an entity is destroyed.

Event Type

ksServerEvents.DestroyEntityHandler

OnPlayerJoin

Invoked when a player joins the room.

Event Type

ksServerEvents.PlayerJoinHandler

OnPlayerLeave

Invoked when a player leaves the room.

Event Type

ksServerEvents.PlayerLeaveHandler

OnShutDown

Invoked when room begins to shut down.

Event Type

ksServerEvents.RoomShutDownEvent

OnSpawnEntity

Invoked when an entity is spawned.

Event Type

ksServerEvents.SpawnEntityHandler

Last updated