From f45cbb111952cda532a244df50b5dc432c6d45ee Mon Sep 17 00:00:00 2001 From: Jeremiah Billmann Date: Tue, 23 Jul 2013 14:49:03 -0400 Subject: [PATCH] Changed client side update calllback --- README.md | 2 +- client/garageserver.io.js | 6 +++--- example/public/javascripts/game.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d839ca7..518e1e4 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ options = { onEvent(callback(data)), onWorldState(callback(state)), onPing(callback(pingDelay)), - onUpdatePlayerPhysics(callback(state, inputs, deltaTime)), + onUpdatePlayerPrediction(callback(state, inputs, deltaTime)), onInterpolation(callback(previousState, targetState, amount)) : newState, onReady(callback), logging: true diff --git a/client/garageserver.io.js b/client/garageserver.io.js index 8a9d6b5..ba03e54 100644 --- a/client/garageserver.io.js +++ b/client/garageserver.io.js @@ -10,7 +10,7 @@ options = { onEvent(callback(data)), onWorldState(callback(state)), onPing(callback(pingDelay)), - onUpdatePlayerPhysics(callback(state, inputs, deltaTime)), + onUpdatePlayerPrediction(callback(state, inputs, deltaTime)), onInterpolation(callback(previousState, targetState, amount)) : newState, onReady(callback), logging: true @@ -292,9 +292,9 @@ var GarageServerIO = (function (socketio) { addInput = function (clientInput) { _playerController.entities.some(function (player) { if (player.id === _stateController.id) { - if (_stateController.clientSidePrediction && _options.onUpdatePlayerPhysics) { + if (_stateController.clientSidePrediction && _options.onUpdatePlayerPrediction) { player.inputController.add(clientInput); - player.state = _options.onUpdatePlayerPhysics(player.state, [{ input: clientInput }], _stateController.physicsDelta); + player.state = _options.onUpdatePlayerPrediction(player.state, [{ input: clientInput }], _stateController.physicsDelta); } _socket.emit('input', [ clientInput, player.inputController.sequenceNumber, _stateController.renderTime ]); } diff --git a/example/public/javascripts/game.js b/example/public/javascripts/game.js index 58e6ebe..c24d0bc 100644 --- a/example/public/javascripts/game.js +++ b/example/public/javascripts/game.js @@ -8,7 +8,7 @@ $(function () { GarageServerIO.initializeGarageServer('http://garageserver_io.jbillmann.c9.io', { logging: true, onReady: startGame, - onUpdatePlayerPhysics: GamePhysics.getNewPlayerState, + onUpdatePlayerPrediction: GamePhysics.getNewPlayerState, onInterpolation: GamePhysics.getInterpolatedState, onWorldState: function (state) { document.getElementById('gameCanvas').style.width = state.width + 'px';