Major refactor for #17 - prompted by #3

This commit is contained in:
Jeremiah Billmann
2013-07-09 19:28:40 -04:00
parent bed0f6c6ab
commit cc2563f8f6
+29
View File
@@ -0,0 +1,29 @@
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 () {
};