dist/client/lance-gg.js
/**
      * Create a client engine instance.
      *
      * @param {GameEngine} gameEngine - a game engine
      * @param {Object} inputOptions - options object
      * @param {Boolean} inputOptions.verbose - print logs to console
      * @param {Boolean} inputOptions.autoConnect - if true, the client will automatically attempt connect to server.
      * @param {Boolean} inputOptions.standaloneMode - if true, the client will never try to connect to a server
      * @param {Number} inputOptions.delayInputCount - if set, inputs will be delayed by this many steps before they are actually applied on the client.
      * @param {Number} inputOptions.healthCheckInterval - health check message interval (millisec). Default is 1000.
      * @param {Number} inputOptions.healthCheckRTTSample - health check RTT calculation sample size. Default is 10.
      * @param {String} inputOptions.scheduler - 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".
      * @param {Object} inputOptions.syncOptions - 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.
      * @param {String} inputOptions.syncOptions.sync - chosen sync option, can be "interpolate", "extrapolate", or "frameSync"
      * @param {Number} inputOptions.syncOptions.localObjBending - amount (0 to 1.0) of bending towards original client position, after each sync, for local objects
      * @param {Number} inputOptions.syncOptions.remoteObjBending - amount (0 to 1.0) of bending towards original client position, after each sync, for remote objects
      * @param {String} inputOptions.serverURL - Socket server url
      * @param {Renderer} Renderer - the Renderer class constructor
      */
Create a client engine instance.
@param {GameEngine} gameEngine - a game engine
@param {Object} inputOptions - options object
@param {Boolean} inputOptions.verbose - print logs to console
@param {Boolean} inputOptions.autoConnect - if true, the client will automatically attempt connect to server.
@param {Boolean} inputOptions.standaloneMode - if true, the client will never try to connect to a server
@param {Number} inputOptions.delayInputCount - if set, inputs will be delayed by this many steps before they are actually applied on the client.
@param {Number} inputOptions.healthCheckInterval - health check message interval (millisec). Default is 1000.
@param {Number} inputOptions.healthCheckRTTSample - health check RTT calculation sample size. Default is 10.
@param {String} inputOptions.scheduler - 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".
@param {Object} inputOptions.syncOptions - 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.
Create a client engine instance . @param { GameEngine } gameEngine - a game engine @param { Object } inputOptions - options object @param { Boolean } inputOptions . verbose - print logs to console @param { Boolean } inputOptions . autoConnect - if true the client will automatically attempt connect to server . @param { Boolean } inputOptions . standaloneMode - if true the client will never try to connect to a server @param { Number } inputOptions . delayInputCount - if set inputs will be delayed by this many steps before they are actually applied on the client . @param { Number } inputOptions . healthCheckInterval - health check message interval ( millisec ) . Default is 1000 . @param { Number } inputOptions . healthCheckRTTSample - health check RTT calculation sample size . Default is 10 . @param { String } inputOptions . scheduler - 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 " . @param { Object } inputOptions . syncOptions - 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 .
function ClientEngine(gameEngine, io, inputOptions, Renderer) {
      _classCallCheck(this, ClientEngine);
      this.options = Object.assign({
        autoConnect: true,
        healthCheckInterval: 1000,
        healthCheckRTTSample: 10,
        stepPeriod: 1000 / GAME_UPS,
        scheduler: 'render-schedule',
        serverURL: null,
        showLatency: false
      }, inputOptions);
      this.io = io || ioClient;
      this.serializer = new Serializer();
      this.gameEngine = gameEngine;
      this.gameEngine.registerClasses(this.serializer);
      this.networkMonitor = new NetworkMonitor();
      this.inboundMessages = [];
      this.outboundMessages = []; 
      this.renderer = this.gameEngine.renderer = new Renderer(gameEngine, this); 
      this.scheduler = null;
      this.lastStepTime = 0;
      this.correction = 0;
      if (this.options.standaloneMode !== true) {
        this.configureSynchronization();
      } 
      if (inputOptions && inputOptions.delayInputCount) {
        this.delayedInputs = [];
        for (var i = 0; i < inputOptions.delayInputCount; i++) {
          this.delayedInputs[i] = [];
        }
      }
      this.gameEngine.emit('client__init');
    } 
function ClientEngine ( gameEngine , io , inputOptions , Renderer ) { _classCallCheck ( this , ClientEngine ) ; this . options = Object . assign ( { autoConnect : true , healthCheckInterval : 1000 , healthCheckRTTSample : 10 , stepPeriod : 1000 / GAME_UPS , scheduler : 'render-schedule' , serverURL : null , showLatency : false } , inputOptions ) ; this . io = io || ioClient ; this . serializer = new Serializer ( ) ; this . gameEngine = gameEngine ; this . gameEngine . registerClasses ( this . serializer ) ; this . networkMonitor = new NetworkMonitor ( ) ; this . inboundMessages = [ ] ; this . outboundMessages = [ ] ; this . renderer = this . gameEngine . renderer = new Renderer ( gameEngine , this ) ; this . scheduler = null ; this . lastStepTime = 0 ; this . correction = 0 ; if ( this . options . standaloneMode !== true ) { this . configureSynchronization ( ) ; } if ( inputOptions && inputOptions . delayInputCount ) { this . delayedInputs = [ ] ; for ( var i = 0 ; i < inputOptions . delayInputCount ; i ++ ) { this . delayedInputs [ i ] = [ ] ; } } this . gameEngine . emit ( 'client__init' ) ; }
Create a client engine instance.
Create a client engine instance .
/**
       * reference to serializer
       * @member {Serializer}
       */ /**
       * reference to game engine
       * @member {GameEngine}
       */ // create the renderer // step scheduler // create a buffer of delayed inputs (fifo) // configure the Synchronizer singleton