+ 3

How to keep essential Data and Values safe in program and prevent them from cheating?

Hello guys. Thx 4 your time. For example consider we have an offline Game that has one essential value, named "Gold". Generally, we can use Gold to buy some items in our game and if user wants, he/she can buy some Golds from shop to make game process faster. As you know it's not hard to change program values (specially offline ones) with some cheat tools by accessing to variables memory address and some privileges or etc. Now, the questions are: How to keep safe our Gold parameter? (And other essential data.) Does Data encapsulation and defining some Access Controls with Accessors help us and enough to restrict & prevent them from unwanted changes? Or encapsulation is just for slicing code and makes it easier to write code & prevents us from confusing variable names & etc? Is there any Technique to take care of it? Can we bring 100% security? (I don't think so) What about online games? Thank you guys. I'll be appreciated. If you'd Like Share your ideas, Experience and Solutions.

2nd Jun 2018, 1:27 AM
xXx
xXx - avatar
1 ответ
+ 6
1. don't name the variable containes the number of gold as Gold. Name it r2d2_007, fg45_dgf9 etc... 2. don't put in this variable real quantity of game Gold, only result of the some function f(x) there x is quantity of the gold. You must define also the function g(y) so x=g(f(x)) 3. all operation of increamenting/decreamenting of the gold variable(r2d2_007 in my example) must be defined in unreadable named function, there in one line returns some like this: f(1+g(r2d2_007)) for increamenting gold by 1. 4. if you select more ununderstanded functions f(x) and g(y), your code will be more obfuscated. 5. but you must understand, that all that was hided, someone will find. Actually, in reverse ingenering all this and other methods of obfuscation will be reversed. All obfuscations of the code just make the time of understanding more longer, but ohtervise limited
2nd Jun 2018, 2:04 AM
Dmitriy
Dmitriy - avatar