IamThatGuy Posted October 17, 2014 Share Posted October 17, 2014 I dont know where to start trying to get this problem fixed. It only allows 2 people per game so I am assuming when a certain player sends there move. The other player is not receiving it. http://runechart.com:3000/newBlock.html On another note, different browsers are executing the code faster then others. IE will drop my blocks faster then Google Chrome. This is unrelated to the problem about synching the players moves, because I been doing the testing with the same browser. Of course when I use 2 different browsers, the boards get totally screwed up since the blocks are falling at different speeds on each browser.var the_date = new Date();var test1 = the_date.getTime();var stamp = the_date.getTime() + 200;function game_loop() { the_date = new Date(); test1 = the_date.getTime(); if(stamp <= test1) { if(player_move[0] != "") { Player1.checkMoveBlock(player_move[0]); player_move[0] = ""; } if(player_move[1] != "") { Player2.checkMoveBlock(player_move[1]); player_move[1] = ""; } the_date = new Date(); stamp = the_date.getTime() + 200; //move/drop/destroy blocks Player1.execu(); Player2.execu(); } Player1.render(); Player2.render(); // request new frame requestAnimFrame(function() { game_loop(); });} Quote Link to comment Share on other sites More sharing options...
IamThatGuy Posted November 8, 2014 Author Share Posted November 8, 2014 I am still seeking help on how to make realtime games with node? I just attached the whole project in hopes someone can tell me something besides the code is pretty ugly =] BlockGame.zip IamThatGuy 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.