Jump to content

How to correctly move player?


Hiro
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...