From 5e421f7902de15f88c0ee4afdcd8f6037a07c9b6 Mon Sep 17 00:00:00 2001 From: Elijah Cohen Date: Sun, 12 May 2019 23:39:32 -0500 Subject: [PATCH] added todo list, other stuff --- .gitignore | 1 + server/TODO.org | 7 +++++++ server/constants.js | 8 +++----- server/matchmaker.js | 6 +++--- web/main.js | 6 ++++++ 5 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 server/TODO.org diff --git a/.gitignore b/.gitignore index b5ad404..2409f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ server/node_modules/* /web/input.js~ /server/health.js~ /server/robot.js~ +/server/TODO.org~ diff --git a/server/TODO.org b/server/TODO.org new file mode 100644 index 0000000..a4db889 --- /dev/null +++ b/server/TODO.org @@ -0,0 +1,7 @@ +list of things i should still do: +- death screens +- waiting message +- fix collisions +- fix oob +- splash page +- fiddle with variables to optimize fun diff --git a/server/constants.js b/server/constants.js index 390d7f8..72619d7 100644 --- a/server/constants.js +++ b/server/constants.js @@ -1,15 +1,13 @@ -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, diff --git a/server/matchmaker.js b/server/matchmaker.js index ce8134b..f8c99c2 100644 --- a/server/matchmaker.js +++ b/server/matchmaker.js @@ -32,14 +32,14 @@ var manage_incoming = function(ws) { 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); } } @@ -50,7 +50,7 @@ var robot_adder = function() { } game = new Game(players.slice()); // array copy health.inc(); - game.start(c.MS_PER_FRAME); + game.start(1000/c.FPS); players = []; } // diff --git a/web/main.js b/web/main.js index b1fc33e..e9de705 100644 --- a/web/main.js +++ b/web/main.js @@ -21,6 +21,12 @@ var main = function() { // starts everything, gets us going, setup ish ctx.lineWidth = ctx.lineWidth/5; + // this is just to have everything go easily for testing + var othersockets = []; + for(var i=0; i