How to prevent cheating with Gamecih?

删除回忆录丶 提交于 2019-12-02 17:43:36
bjedrzejewski

You can store life in X number of variables and the real value will be the sum of them (always calculated dynamically). You randomly choose which one to update. On top of that You can add some consistency check and it becomes extremely hard for cheater to realise what and how to change it.

The consistency check could be a simple rule that 1st, 2nd and 3rd variables are in growing order for example and the 4th is the smallest. It will take someone good while to figure this out with this tool.

Yoy can also get more creative and mix in some encryption etc (the way you mentioned) on top of that. Then it becomes second to impossible unless someone has your code.

EDIT: Add 100 random variables that change all the time with random names (or positions in the array, to make it easier) and then good luck for cheaters looking for the right ones. And make it all dynamic so every time they have to crack it again.

You can check periodically if your value has changed when it was not supposed to.

For example, you can store in a separate hidden flag the fact that the health value has changed. If your check method does detect a change in the value, and the flag is not set, then you can tell that the change was illegal.

For example :

void incrementHealth(int amount) {
    health = health + amout;
    hiddenCheck.hasChanged = true;
    }

and in a separate method which must be invoked periodically :

void checkHealth() {
    if (hiddenCheck.hasChanged) {
        // change is valid
        hiddenCheck.hasChanged = false;
        hiddenCheck.lastKnownValue = health;
        } else {
            if (hiddenCheck.lastKnownValue != health) {
                // An illegal change has occured ! Punish the hacker !
                }
            }
        }
   }
try{
    ApplicationInfo info = getPackageManager().
            getApplicationInfo("com.cih.gamecih", 0 );
    return true;
} catch( PackageManager.NameNotFoundException e ){
    return false;
}

If this function returns true, don't even let the hacker enter Multiplayer mode, and prompt him to uninstall it.

Calculate your stats dynamically from a stored value.

private double getSaltedSqrt(int i){
    return Math.sqrt(i)+1337;
}

private int getTrueValue(double i){
    return (i-1337)*(i-1337);
}

This way, no regular-brained human will be able to find your values from RAM ever. Somebody with 100 health will have a health value of 1347.0

If somebody deals 10 damage to that player, you just have to call:

currentHealth = getSaltedSqrt(getTrueValue(currentHealth)-damage);

However, the most secure way to do this, is to implement all those changes via server.

I have a thought on this, since I sometimes use GameCIH myself. You could have a rolling 10-entry transaction log that self-checks on every new transaction.

What you would do (since GameCIH can only deal with one variable at a time) is have two variables that are checked against each other.

  • Original (or 11-ago) value
  • Array of values of changes 1 through 10
  • Summation value, negated. (This totally changes the decimal value you can see, and it'll change differently than the original value when the oldest log entry is rolled into it.)

If the negative of the summation value doesn't match the original plus the 10 logged transactions, return an error.

You would just have to change how your stat mods are handled - if even one of them still tries to modify the original value directly, your game would return that it's been incorrectly changed.

The people who are good at cheating games read these forums too, and they know all your little secrets.

There is no solid way to prevent people from cheating a game that stores important variables locally. A game must keep these variables on the server. If these variables are not kept on the server, there will always be someone that can hack your game.

To prevent memory cheating you can do one of the following:

You should store a hash (eg crc32 or md5) of the health etc. everytime you update the value, do a hash check on the currently set value. In this case, the cheaters would have to write a seperate app that handles the hashes. Possible, but this will stop the script-kiddy cheaters soon enough.

Joe

In the Pokemon games, they used DMA. You could get a similar effect by having a timer go off and trigger an update of all values while the game is paused for very short time. The update would add some random amount to all variables (including the one that you subtract from to get individual values). You can also try having values stored in a large array and change the starting position. Instead of an absolute pointer like GameState[121], you'd have something like GameState[121+StartingPosition] and just combine the value-incrementor with a location randomizer. Modular arithmetic is your friend, in both cases. Be wary of overflowing the array and off-by-one bugs. A buffer overrun would not be good. ;)

If this was a Flash or Java app: Sadly, using memory management to quickly remap the position in RAM of values is not as convenient as in a native binary like the Gameboy Advance uses. Copying all variables to a second set, in a random order, then deleting and garbage-collecting the original values would probably make your game run slow as heck.

Could you just check for root access on game launch? Then deny opening app or deny multiplayer mode on rooted devices? Provide a small check at the opening load screen only when app is initialized, maybe have app request super user then if user grants it try to do a harmless function not allowed without superuser then a code to check if said function was successfully then undo change and pop a message box indicating user should leave root mode try again.

Alternately this check could be applied upon entering multiplayer mode.

Also you could just run multiplayer mode from a server and single player from device and let single players hex edit freely.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!