Vinny Guerrero Posted June 7, 2018 Share Posted June 7, 2018 (edited) Hi everyone! I recently started using Phaser v3 and I’m enjoying it a lot. However, when it comes to using socket.IO I’m getting a little bit lost on updating multiple players at once. ( update loop I guess? ) I’m using this tutorial to set up a Pathfinding system http://www.dynetisgames.com/2018/03/06/pathfinding-easystar-phaser-3/ And this one for multiplayer settings http://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-84 However, I ran myself into 2 big problems. I can’t update players positions to other socket connections, just the active one (current browser). I can’t move players on AWSD keys properly, just by clicking. Can you guys please give some tips or ideas on how to fix this? I’m feelin’ a lil’ bit lost in this, kinda ran out of ideas on how to fix it =( This is my game repo https://bitbucket.org/vini-guerrero/phasergame/admin I would really appreciate some help to understand this better… Thanks in advance! Best regards from Brazil! Edited June 7, 2018 by samme links Link to comment Share on other sites More sharing options...
Flowan Posted June 9, 2018 Share Posted June 9, 2018 The repo you shared is private, so i am not able to look at your code. Take a look at this multiplayer demo, it might solve your problem. squilibob 1 Link to comment Share on other sites More sharing options...
Vinny Guerrero Posted June 11, 2018 Author Share Posted June 11, 2018 Thanks for the reply @Flowan... After a few researches I've found out that my problem is called "game interpolation" which is adjusting entities to update loop using socket events. That example is really good ( and complex ) I'm trying to break in parts to get just the idea I need to fix my game. I've removed the permission on the repo ( https://bitbucket.org/vini-guerrero/phasergame/ ) What I'm trying to understand is... if the other players movements should be handled in the game.load function / game.init function or game.update function. I've created the players Array, I was able to socket emit the list for all players connected, but I can't move synchronizing all of em inside the array. Why is it so simple to do on click events, but when it comes to keyboard strokes, it gets so complex? Link to comment Share on other sites More sharing options...
aylictal Posted June 11, 2018 Share Posted June 11, 2018 click events you know where the destination is, therefore you can easily send the destination of where you're moving to the server, then the server just broadcasts to everyone else as a dumb middleman, and all the clients then render that character moving to that spot. movement with keys however, you don't really know where the person is traveling to. thats what makes it really hard. Link to comment Share on other sites More sharing options...
aylictal Posted June 11, 2018 Share Posted June 11, 2018 I'd be interested in hearing more responses to this thread on an efficient way to do this. Another really good article addressing this is this: http://buildnewgames.com/real-time-multiplayer/ Link to comment Share on other sites More sharing options...
Recommended Posts