Today, thanks to the existence of the Ghost artifact, many single-host game developers are suffering from a pain point. Today, Viagra has achieved a solution ....
The general idea is:
1. Implement a function similar to the hashfunc function that generates a unique value from one value (similar to C ++'s STD: Hash <STD: String> ).
2. Save two member variables locally (this-> coin, this-> hash_coin)
3. Each assignment to coin always assigns a value to hash_coin using hashfunc.
4. Check whether the values of hash_coin and hashfunc (this-> coin) are the same during reading. If the values are the same, they are normal values. Otherwise, they are tampered values.
5. When a value is found to have been tampered with, we should also implement a method to reverse obtain the correct value according to this-> hash_coin...
How can a single-host game prevent tampering with memory modifiers such as Ghost artifacts?