How to prevent cheating with Gamecih?

前端 未结 10 1709
孤独总比滥情好
孤独总比滥情好 2021-01-31 12:07

Background

I\'ve had problems for quite a while now with players cheating in my android game. For a strict single-player game this wouldn\'t be a big is

10条回答
  •  渐次进展
    2021-01-31 12:42

    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.

提交回复
热议问题