Added client smoothing option

This commit is contained in:
Jeremiah Billmann
2013-06-28 23:03:09 -04:00
parent 47767bcc80
commit 96364faf8a
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ options = {
onInterpolation: function(currentState, previousState, targetState, amount)
logging: true,
clientSidePrediction: true,
clientSmoothing: true,
interpolation: true,
pingInterval: 2000
}
@@ -176,7 +177,7 @@ window.GarageServerIO = (function (window, socketio) {
});
_socket.on('ping', function(data) {
var newPingDelay = new Date().getTime() - data;
_stateController.clientSmoothing = _stateController.pingDelay / newPingDelay;
_stateController.clientSmoothing = _options.clientSmoothing ? (_stateController.pingDelay / newPingDelay) : 1;
_stateController.pingDelay = newPingDelay;
if (_options.onPing) {
_options.onPing(_stateController.pingDelay);
+1
View File
@@ -2,6 +2,7 @@ $(function () {
GarageServerIO.connectToGarageServer('http://garageserver_io.jbillmann.c9.io', {
logging: true,
clientSidePrediction: true,
clientSmoothing: true,
interpolation: true,
onUpdatePlayerPhysics: OnProcessGamePhysics,
onInterpolation: function (currentState, previousState, targetState, amount) {