/web/input.js~
/server/health.js~
/server/robot.js~
+/server/TODO.org~
--- /dev/null
+list of things i should still do:
+- death screens
+- waiting message
+- fix collisions
+- fix oob
+- splash page
+- fiddle with variables to optimize fun
-var mspf = 100;
var c = {
// matchmaker
WS_PORT: 6789,
NUM_PLAYERS: 4,
- MS_PER_FRAME: mspf,
- FPS: 1000/mspf,
+ FPS: 30,
WAIT_TIME: 60000, // 1 minute
- MAX_GAMES: 5, // the most games allowed to go on at once, to be tweaked as needed for purposes
- ROBO_TIME: 120, // time in seconds before filling out with robots
+ MAX_GAMES: 2, // the most games allowed to go on at once, to be tweaked as needed for purposes
+ ROBO_TIME: 30, // time in seconds before filling out with robots
// gamestate
DYING_TIME_IN_FRAMES: 100,
BOARD_RADIUS: 10,
if(players.length >= c.NUM_PLAYERS) {
game = new Game(players.slice(0, c.NUM_PLAYERS));
health.inc();
- game.start(c.MS_PER_FRAME);
+ game.start(1000/c.FPS);
players = players.slice(c.NUM_PLAYERS); // just security in case >n connections at once
// i think js lack-of-threading makes it impossible for that to happen though
clearTimeout(timeout);
timeout = null;
}
else if(timeout == null) {
- setTimeout(robot_adder, c.ROBO_TIME);
+ setTimeout(robot_adder, c.ROBO_TIME*1000);
}
}
}
game = new Game(players.slice()); // array copy
health.inc();
- game.start(c.MS_PER_FRAME);
+ game.start(1000/c.FPS);
players = [];
}
//
ctx.lineWidth = ctx.lineWidth/5;
+ // this is just to have everything go easily for testing
+ var othersockets = [];
+ for(var i=0; i<c.NUM_PLAYERS -1; i++) {
+ othersockets.push(new WebSocket(prefixurl));
+ }
+
theSocket = new WebSocket(prefixurl);
theSocket.onmessage = function(e) {