Answer the question
In order to leave comments, you need to log in
(node.js, websockets) Player and server synchronization?
Hello.
Let's say there is a game on websockets and node.js. There is a 2D wall and two players who stand on opposite sides of this same wall. The wall is made up of square sprites.
The player, accordingly, can remove all these sprites of our wall through DOM inspection. How is the synchronization of game objects, the behavior of the player and the server?
Let's say on the server side we store all the data about the game objects and their position. We will pass information about them through the socket to the client and synchronize game objects with server values (or is this done wrong?). But since the client can inject custom JavaScript, it simply removes the sync handler, for example.
How to be? How to implement the correct synchronization? How to protect yourself from changes by the user?
Thanks for the answer.
Answer the question
In order to leave comments, you need to log in
You have some pretty old logic. Usually it is done like this:
the client sends a request to the server: "I'm going here" to which the server answers
"yes, you can go here and you go here" or refuses. That is, all the logic for processing all actions takes place on the server.
if the user does something with the DOM or event handlers, then the flag is in his hands, the main thing is the integrity of the server side is in order.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question