Options
All
  • Public
  • Public/Protected
  • All
Menu

The main class for game clients. Brings together all the client-side systems in the engine.

Hierarchy

  • ClientEngine

Implements

Index

Constructors

constructor

Properties

Private Optional animationFrameReqeuestHandle

animationFrameReqeuestHandle: number

Private classRegistry

classRegistry: ClassRegistry<Serializable> = ...

Readonly clientSimulation

clientSimulation: ClientSimulation

Private Optional currentInputFrame

currentInputFrame: InputFrame

Private Optional fallbackClientSimulationHandle

fallbackClientSimulationHandle: PeriodicCallbackHandle

Private networkClient

networkClient: NetworkClient

Private nextOutboundSequenceNumber

nextOutboundSequenceNumber: SequenceNumber = ...

onConnectedToServer

onConnectedToServer: SyncEvent<PlayerId> = ...

options

Optional playerId

playerId: PlayerId = ...

Private Optional renderingSystem

renderingSystem: RenderingSystem

Private serverTimeEstimator

serverTimeEstimator: ServerTimeEstimator

Private Readonly simulationEngine

simulationEngine: SimulationEngine = ...

Private Optional updateInputHandle

updateInputHandle: PeriodicCallbackHandle

Private Optional updateServerTimeEstimatorHandle

updateServerTimeEstimatorHandle: PeriodicCallbackHandle

Static defaultOptions

defaultOptions: ClientEngineOptions = ...

Methods

addSystem

  • addSystem(system: System): void

connectToServer

  • connectToServer(serverWsUrl: string): Promise<void>
  • TODO, given we have determined it's unreasonable to expect ClientEngine to handle both server + serverless modes, we should consider passing the server info in to the constructor.

    Parameters

    • serverWsUrl: string

    Returns Promise<void>

Private fallbackClientSimulation

  • fallbackClientSimulation(): void
  • The purpose of this is to provide some ticking of the simulation system even when the renderer isn't, to guard against too much simulation work building up. If the renderer is using the simulation there should be almost no work to do here. Most browsers appear to stop servicing requestAnimationFrame when there is no focus and so by doing this we avoid the simulation pausing. Browsers also limit the fastest setTimeout to about 1s so there's no point having this in a loop tighter than 1s. Literature reports 1 second my testing in latest Chrome shows 2 seconds even.

    Returns void

getCurrentContinuousInput

  • getCurrentContinuousInput<T>(inputType: new () => T): undefined | T

Private getNextOutboundSequenceNumber

registerComponentType

  • registerComponentType<T>(componentType: new () => T, componentTypeName: string): void

registerContinuousInputType

  • registerContinuousInputType<T>(inputType: new () => T, inputTypeName: string): void

removeSystem

  • removeSystem(system: System): void

Private renderLoop

  • renderLoop(domHighResTimestampMS: number): void

setRenderingSystem

start

  • start(): void

stop

  • stop(): void

Private updateInput

  • updateInput(): void

Generated using TypeDoc