Answer the question
In order to leave comments, you need to log in
How is character movement control implemented on the server or on the client?
Interested in the following. Let's say we have a coordinate grid. 10 by 10 There is a wall in the middle. What controls whether the character can walk on this place or not. Server or client? If the server. It's a little unclear to me how exactly to implement this. My fantasy is only enough to write down all the coordinates where the character cannot pass. But this will consume a lot of resources. calculation of all movements of the character. Not to mention that if there are a lot of them. And the map will not be 10 by 10. If possible, then indicate the literature that covers this.
Answer the question
In order to leave comments, you need to log in
Movement (change of coordinates), as well as other logic that changes the state of an object - on the server. Rendering on the client, interpolation is used to smooth actions. Read about interpolation, extrapolation, lag smoothing.
Play cs1.6 and notice that your character will not move when disconnected.
https://habrahabr.ru/post/328702/
https://habrahabr.ru/company/mailru/blog/220359/
Control should always be performed only on the server side! Any client can be hacked (although sometimes the server too). Only the server sends the object to the client, its characteristics, its current coordinates, its freedom of movement relative to the reference point. The client only displays what the server sent him.
Client - faster.
Server - protection against cheaters.
It all depends on how stupid / lazy / whether the developers have the resources of time / money.
A good system checks 2 times:
On the client - to quickly redraw.
Then on the server - for control.
Then, having received confirmation from the server, the client redraws in the right place again.
How is character movement control implemented on the server or on the client?
Again, a huge callback. The implementation must consider both the server and the client. But the wall must be implemented on the client. But to store its characteristics - on the server.
If a grid with characteristics (wall) was loaded from the server, then there is no problem on the client not to let it pass
And there and there to do a check and periodically synchronize. In case of a conflict between the server and the client, take the result of the server (since the position can be faked on the client side). If you played WoW, it can be clearly seen with lags - you did something, it seemed to you on the screen, and when the lag disappeared, everything that was done was rolled back as if you had not done it.
According to the literature here you can read anything on the topic of multiplayer online games.
But this will consume a lot of resources. calculation of all movements of the character.The server has more simplified calculations, the figures are less detailed.
Not only that, the server must check the availability of coordinates to move to them. But also the speed with which a person moves. The same WOW on pirates - cheats allowed you to fly all over the map at a speed 100 times higher than normal + much more.
So if you are doing a serious project, then as written above - only the frontend is on the client, all the logic is only on the server
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question