mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-30 16:40:46 +08:00
29 lines
843 B
JavaScript
29 lines
843 B
JavaScript
var garageServer = require('../lib/server/garageserver.io'),
|
|
gamePhysics = require('./shared/core');
|
|
|
|
exports = module.exports = Game;
|
|
|
|
function Game (sockets) {
|
|
this.physicsInterval = 15;
|
|
this.physicsDelta = this.physicsInterval / 1000;
|
|
this.physicsIntervalId = 0;
|
|
|
|
this.server = garageServer.createGarageServer(sockets,
|
|
{
|
|
logging: true,
|
|
interpolation: true,
|
|
clientSidePrediction: true,
|
|
onUpdatePlayerPhysics: gamePhysics.onUpdatePlayerPhysics,
|
|
onUpdateEntityPhysics: gamePhysics.onUpdateEntityPhysics
|
|
});
|
|
}
|
|
|
|
Game.prototype.start = function () {
|
|
var self = this;
|
|
this.server.start();
|
|
this.physicsIntervalId = setInterval(function () { self.update(); }, this.physicsInterval);
|
|
};
|
|
|
|
Game.prototype.update = function () {
|
|
|
|
}; |