I'm building for android and using global variables for Gems and Energy in my game. There is an application for Android called Lucky Patcher which can be used on running games to patch at runtime and modify variables. Gems are a premium in currency my game and knowing that players can change this Variable easily is literally breaking the value of my game completely. I'm not a programmer so please let me know how can I protect my variables from this?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
This may be more of a general Unity question, and I'm not aware of how "Lucky Patcher" works. Is it able to modify variables at the time an app is running? Or only modify save-game file values?
It's able to modify variables at the time an app is running.
You could consider the use of encryption and have your "Gems" variable be an encrypted string based off an integer value.
There's many techniques to do so, so you'd need to look for one that works for you - but essentially you could try:
With this technique, the encryption steps (#3-#5) would only be necessary to get saving working. Steps #1-2 would need to be done first, however, and would be tricky since you'd only be able to access the Integer value through script - not through AC's Actions.
How is your "Gems" variable currently referenced by your project?
My gems Variable is an integer and I update the value using AC actions. Increasing by either a positive value or a negative value. I'm also using playmaker in my project. But mostly I'm using AC for my Global integer variables of Gems and Global float variable for Energy.
Here's an example script that replaces the need for Integer/Float variables for Gems and Energy with String variables (named "Gems" and "Energy" respectively:
Note that this does not use encryption - just a Base-64 encoding. The Decrypt/Encrypt functions will need to be replaced with a proper encoding algorithm of your choice, but this will serve as a proof-of-concept.
This is a static class, so you can access your Gems and Energy values through custom script with:
Hello, since I lack knowledge in programming with C#, I find myself in a difficult situation.
Is it necessary to use code for this task? Alternatively, could I create a detailed action list to store and restore the values of Gems (integer) and Energy (float) in separate string variables whenever the values need to be updated? I would rename these string variables or hide them somehow in a way that makes it more challenging for hackers to locate them.
I'm mentioning this because I currently lack the necessary resources to integrate my own custom code, unless you are able to assist me. Considering the significant impact on the game economy, I must find a solution and cannot overlook this issue at any cost. Hence, perhaps I can find a workaround that makes it more difficult for the vulnerability to be exposed
If there a finite number of e.g. Gems, you could have a "conversion" ActionList that manually turns 1 => Apple, 2 => Orange etc. Otherwise, code would be necessary.
Encryption and IAPs are not a part of AC, but any skilled Unity programmer for hire should be able to help with this.