mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-08-14 12:00:08 +08:00
Moved interpolation & prediction options to server.
This commit is contained in:
@@ -5,6 +5,10 @@ options = {
|
||||
physicsInterval: 15,
|
||||
stateInterval: 45,
|
||||
logging: true,
|
||||
clientSidePrediction: true,
|
||||
interpolation: true,
|
||||
interpolationDelay: 100,
|
||||
pingInterval: 2000,
|
||||
onPlayerConnect: function (socket),
|
||||
onPlayerInput: function (socket, input),
|
||||
onPlayerDisconnect: function (socket),
|
||||
@@ -27,7 +31,13 @@ GarageServer.prototype.registerSocketEvents = function (options) {
|
||||
if (options.logging) {
|
||||
console.log('garageserver.io:: socket ' + socket.id + ' connection');
|
||||
}
|
||||
socket.emit('state', { physicsDelta: (options.physicsInterval ? options.physicsInterval : 15) / 1000 });
|
||||
socket.emit('state', {
|
||||
physicsDelta: (options.physicsInterval ? options.physicsInterval : 15) / 1000,
|
||||
interpolation: options.interpolation ? options.interpolation : false,
|
||||
interpolationDelay: options.interpolationDelay ? options.interpolationDelay : 100,
|
||||
pingInterval: options.pingInterval ? options.pingInterval : 2000,
|
||||
clientSidePrediction: options.clientSidePrediction ? options.clientSidePrediction : false
|
||||
});
|
||||
self.onPlayerConnect(socket, options);
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
|
||||
Reference in New Issue
Block a user