add simple fuzz test

This commit is contained in:
Asraelite 2016-03-27 20:26:53 +01:00
parent 0a90b6b77a
commit 27520842e3
59 changed files with 191 additions and 34 deletions

View file

@ -0,0 +1,47 @@
'use strict';
window.addEventListener('load', init);
var game;
function init() {
game = new Game();
game.tick();
//game.net.connect();
}
class Game {
constructor() {
this.assets = this.loadAssets();
this.connected = false;
this.state = 'connecting';
this.pingMode = 'fast';
this.input = new Input();
this.net = new Net();
this.world = new World();
this.renderer = new Renderer();
this.player = new Player();
}
tick() {
this.renderer.render(this.state);
var ship = this.world ? this.world.playerShip : false;
if(this.player.ship) {
let delta = this.player.packDelta();
if (delta)
game.net.sendUpdate(delta);
}
this.input.clear();
this.world.tick();
requestAnimationFrame(this.tick.bind(this));
}
}