Answer the question
In order to leave comments, you need to log in
Whether it is necessary to duplicate calculations on the client and the server?
We are making a game, now calculations, for example, whether a new level has begun, or whether a quest has been completed, are done on both the client and the server.
Naturally, the temptation is great to hang everything on the client, but then: 1 - _very easy to hack the game, 2 - the data can be processed incorrectly (don't ask how), 3 - a lot of minor problems with synchronization, saving, etc.
Naturally, there is a great temptation to hang everything on the server, but then: 1 - _a lot of calculations on the server, in fact, we don’t need them, 2 - the synchronization waiting time increases, 3 - you still have to duplicate the functionality on the client, without it in any way, 4 - a bunch of minor problems with synchronization with the client.
Naturally, there is a great temptation to say that we will combine both approaches and get something outstanding, but ... reality makes its own adjustments.
In fact, I worked in a company where they adhere to the first option (everything on the client), and the second, but, which is better, I have not yet decided for myself
whether the respected community has any thoughts in favor of the first or second option.
Answer the question
In order to leave comments, you need to log in
Everything is on the server and nothing else. I just can’t imagine what synchronization problems for this option you are talking about, but the synchronization of the server and N interacting clients with each other is HELL.
But in general, again, everything depends on a specific task and the degree of trust in client calculations, which are evaluated personally for each individual purpose of the application - after all, the server can only play the role of a router or communicator - i.e. clients knock on the server, the server connects them together and waits for the result of calculations from both (groups), if the results match, it counts the result, if there is a connection loss, the remaining client switches to the server and waits for its decision.
You need to decide what is more important to you.
Security, or performance.
I'm all for safety. BUT! The most optimal way is to perform calculations on the client side, and check the incoming data on the server.
For example. We know that a user cannot earn/win a certain amount in a certain time. When entering the data server, check this ratio. if it is false (the user changed the data) then do not write anything to the database. A warning to the user.
Same with the rest of the options...
If there are many users, then on the client, if there are few then on the server.
And what's the point of duplicating a single player game on the server? What such a great misfortune will happen from the fact that someone will wind up his level? At worst, you can send information to the server about killed opponents, changing money, ammo, inventory, and sometimes controlling them (when saving, leveling up or changing location, for example).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question