Hiro Posted October 18, 2017 Share Posted October 18, 2017 Hello, I am creating online multiplayer game where I move player to a place where I click, I have solution based on this tutorial: http://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/ This uses sprite which is tweened to a position. However I just found another options, first is to make it using the update() method and move the player based on angle - https://github.com/fbaiodias/phaser-multiplayer-game/blob/master/public/js/game.js -this one is sending move event to socket on every update, isnt it too much overload for server? Does not make sense to me. The last one is using eureca.io - http://ezelia.com/2014/tutorial-creating-basic-multiplayer-game-phaser-eureca-io Have you tried all of these? Which one would you prefer for this game specifics: -online multiplayer -I want to make the player move to place where I click and notify others to do it - just like in the first tutorial -I want to make shooting like in the tanks, the bullet is fired and enemy can be hit -Every player can collide and can not move through another one Which one solution should I inspire to make the game like this? Link to comment Share on other sites More sharing options...
Skeptron Posted October 18, 2017 Share Posted October 18, 2017 Maybe you should provide us with some more details: Is it a 3D game, a 2D isometric game or a 2D game? Will it be competitive : meaning, do you need great accuracy (at the cost of development time) or it is okay for players positions to be 'almost correct' (like for IO games for example) Will you use pathfinding? Sending movements every update is definitely NOT the way to go : way too CPU and bandwidth consuming. A better approach is to send to every player other player's inputs (like, "Player A clicked at coords (10, 20)"). With the game logic code, every one will then make the character/tank move to this position at specified pace. The server will regularly send fixes of these positions to make sure everyone has the same data. Websockets perform OK, but try to avoid sending too many messages and keep them light, otherwise networking will very quickly become your bottleneck. Link to comment Share on other sites More sharing options...
Hiro Posted October 18, 2017 Author Share Posted October 18, 2017 It is 2D, a bit more competitive then IO games. I have pathfinding already, so my question is if to use tween to move or update() method to adjust sprites positions. However I am considering to use http://lance.gg/ framework that keeps the state on server side. Link to comment Share on other sites More sharing options...
Skeptron Posted October 18, 2017 Share Posted October 18, 2017 I would use the update loop with a fixed time step. To my knowledge it's the easiest solution. At least that's what I've used for my game and so far it works great. Link to comment Share on other sites More sharing options...
Aerion Posted October 19, 2017 Share Posted October 19, 2017 Would love to see an 8-direction RPG tweened movement animation demo. Thank You all so much! <3 ~M Link to comment Share on other sites More sharing options...
Recommended Posts