The decision of "running everything on the client, and just sending the highscore at the end" and "running everything on the server, calculating the highscore there" is not binary; it's a spectrum.Plu wrote:Just keep in mind that if you let the client send data to the server and then store it, it's still not safe. They could just fake a message saying they have a million points. The only way to make highscores actually safe is to run the game itself on the server (which is difficult). You can make it semi-safe by making it harder to cheat the scores, but really it's always possible to cheat unless the whole game runs on trusted hardware.
For example, you can send the score on each level, not just at the end. This simple measure allows you to do lots of validations on the server. If you know that a level takes at least 1:34 to complete (even with cheating), and your server receives a highscore in less than that, then that highscore is fake. Similarly, you can calculate the maximum score possible in a level. If the higscore is greater than that, then it's fake.
Or you could have a client just send its current score every minute. If you know your game's "opimum play grapth", then you can validate highscores easily.