fbaiodias / phaser-multiplayer-game

:video_game: Simple real-time multiplayer phaser game example which uses node and websockets.
https://phaser-multiplayer-game.herokuapp.com/
304 stars 81 forks source link

How does multiplayer phaser work? #14

Open matthewvcortese opened 7 years ago

matthewvcortese commented 7 years ago

So I haven't looked at the code at all, but I'm just wondering how you got Phaser to work securely for multiplayer.

Since Phaser controls physics/location on the client-side, isn't it possible for someone to hack their client to run fast or teleport in the game?

Substractive commented 7 years ago

Yes it is possible if the logic is on client side. You should have logic implemented on server side and client only sends and receives data. Example of looting: Player (Client) killed creature and opens up loot window. Client sends data to server which creature was killed, where and it's level or any other data. Then server checks if that is true , is that creature really at that position and that level or any other data needed and then server sends loot data and maybe experience to client and that's how you can know for sure that player killed that creature on right spot and give him right loot not one he hacked.