So I was playing Clash of Clans, and just wondered on how they authenticate the result of the battle.
This isn't exactly specific to Clash of Clans though. In my observation, while CoC is an online game. Their battle is just a singleplayer, but still I feel like the battle is verified somewhere in their server?
This would apply to games that are :
- Singleplayer (no 2nd player to sync to).
- Doesn't need constant communication to server during battle.
- But the result still important and must be authenticated/verified.
My current guess is during/after a battle, the client app will send the inputs/actions of the player to the server. Then in server, the battle will be re-simulated again using the input/actions at a much faster time/pace.
For this to work, the battle has to be deterministic (unsure if that's the right word) so that same inputs/actions will produce the same result.
But if this is the "proper" way, then it would be really heavy on the server CPU's side isn't? even with scaling, I think.
I am leaning on this solution, but something doesn't feel right... there might be a better way...
That's why I came here today to consult for ideas/suggestions..
I'm thinking if there is a safe way to do the simulation/result on the client side? like encrypt the sensitive stuffs? is this even possible?
Thank you!