Although I made the first comment questioning the point of degrading the experience of a portion of your audience for no apparent gain, I still find it an interesting question from a technical point of view.
I just had this idea: What cheaters do is find values that change and freeze them. The search would then happen only between deaths or events that changed the player's health. Moreover, the cheater could be refining the search by filtering out what changed when he was "not dying".
What if the "health" counter is changing the whole time? Make it a pointer and reallocate it every frame or every N frames if the performance hit is too big. Or XOR it with a random value that changes every frame (XORing again against the same value for decrypting before encrypting with a new random value).
If you have other in-game data also changing the whole time (including x and y positions of the player character, or the time counter), that might make it harder to find out which of all the changing data is the health. And freezing the whole game state is a no-go for the cheater.
Para engañar aún más, en realidad puede almacenar la salud en una variable de solo escritura que se entiende como un tarro de miel.
Editar :
Aún así, el tramposo podría tratar de encontrar cuál de las variables que está cambiando todo el tiempo es la que se congela a través de prueba y error. Una posible solución sería acoplar las variables juntas.
Un ejemplo:
En lugar de almacenar la salud (h) y la posición (x), las almacena en dos variables a y b, desde donde puede recuperar los valores más adelante:
a = x+h; b = x-h
x = (a+b)/2; h = (a-b)/2
De esta manera, si el tramposo congela solo uno de ellos y luego mueve al personaje, la posición se ve afectada y, dependiendo de cuál se haya congelado, h se vuelve negativo (muerte instantánea). Puede cambiar entre las fórmulas anteriores y:
a = x-h; b = x+h
x = (a+b)/2; h = (b-a)/2
In consecutive frames, and you guarantee that in at most 2 frames after either one of the variables have been frozen health will turn 0 the moment x changes. Remember that you are storing only a and b. Combine this with the continuous XOR as mentioned above. The result is a collection of variables that are changing every frame to seemingly random values, and freezing any single one or a subset of them only produces undesired side effects in the game, instant death being one of them.
Why would you prevent players from cheating themselves (which cheating in a single player game amounts to)? In a multiplayer environment, it's the server's task to detect unnatural changes and counter them (typically by either ignoring the input or blocking the culprit out from the server completely), but in a single player environment there's nothing happening except the cheater is doing himself a disservice.
IOW, unless you're creating a multiplayer game it's a waste of money, and if you are you're thinking of hardening the wrong place.
fuente
Research the known cheating tools - and frequently check whether any of the most common ones are detected running (check process names?)
If any are detected, let the player cheat (if offline, it's harmless), but make sure no scores/acheivements will be posted to any online leaderboard/acheivement system - just make it silently fail?
Won't stop more determined hackers, but will reduce the chance of more casual cheats messing up your leaderboards.
(Might annoy coders that have dev tools open and minimized for legit purposes and are taking a gaming break, though...)
fuente
I think the simplest solution to this is to implement a cheat option. Disable scoring while in cheat option.
Another good idea, that I have no idea how you would implement. Is to shut off the game when there is a frozen memory variable or something like that :)
Good luck (Y)
fuente