The client engine is the singleton which manages the client-side process, starting the game engine, listening to network messages, starting client steps, and handling world updates which arrive from the server.


new ClientEngine(gameEngine, inputOptions, Renderer)

Create a client engine instance.

Name Type Description
gameEngine GameEngine

a game engine

inputOptions Object

options object

Name Type Description
verbose Boolean

print logs to console

autoConnect Boolean

if true, the client will automatically attempt connect to server.

standaloneMode Boolean

if true, the client will never try to connect to a server

delayInputCount Number

if set, inputs will be delayed by this many steps before they are actually applied on the client.

healthCheckInterval Number

health check message interval (millisec). Default is 1000.

healthCheckRTTSample Number

health check RTT calculation sample size. Default is 10.

syncOptions Object

an object describing the synchronization method. If not set, will be set to extrapolate, with local object bending set to 0.0 and remote object bending set to 0.6. If the query-string parameter "sync" is defined, then that value is passed to this object's sync attribute.

scheduler String

When set to "render-schedule" the game step scheduling is controlled by the renderer and step time is variable. When set to "fixed" the game step is run independently with a fixed step time. Default is "render-schedule".

syncOptions.sync String

chosen sync option, can be interpolate, extrapolate, or frameSync

syncOptions.localObjBending Number

amount (0 to 1.0) of bending towards original client position, after each sync, for local objects

syncOptions.remoteObjBending Number

amount (0 to 1.0) of bending towards original client position, after each sync, for remote objects

serverURL String

Socket server url

Renderer Renderer

the Renderer class constructor



gameEngine :GameEngine

reference to game engine


serializer :Serializer

reference to serializer



connect(optionsopt) → {Promise}

Makes a connection to the game server. Extend this method if you want to add additional logic on every connection. Call the super-class connect first, and return a promise which executes when the super-class promise completes.

Name Type Attributes Description
options Object <optional>

additional options


Resolved when the connection is made to the server



Disconnect from game server


sendInput(input, inputOptions)

This function should be called by the client whenever a user input occurs. This function will emit the input event, forward the input to the client's game engine (with a delay if so configured) and will transmit the input to the server as well.

This function can be called by the extended client engine class, typically at the beginning of client-side step processing (see event client__preStep)

Name Type Description
input String

string representing the input

inputOptions Object

options for the input


start() → {Promise}

Start the client engine, setting up the game loop, rendering loop and renderer.


Resolves once the Renderer has been initialized, and the game is ready to connect