Anti-Cheating Techniques
Cheating Through Memory Modification
Duplicate and Verify Data
Example Code
private int score = 0;
private int scoreCheck = 0;
// Make sure score and scoreCheck start at the same number
void Awake()
{
scoreCheck = score;
}
// Any code that alters the score should also alter the scoreCheck
private void AddScore(int increase)
{
score += increase;
scoreCheck += increase;
}
// Accessors just need to return the real score
private int GetScore ()
{
return score;
}
// Assume this is your in-game function triggered upon
// finishing the game (eg: time runs out, no more moves)
private void GameOver()
{
if (ConfirmScoreValidity())
{
// The score matches the copy, so report it
MiniTonCrossPlatform.ReportFinalScore(score);
}
else
{
// Abort the match because suspicious behavior was detected
MiniTonCrossPlatform.AbortMatch();
}
}
// Confirms that the score is valid.
private bool ConfirmScoreValidity()
{
return score == scoreCheck;
}Obfuscate Data
Example Code
Advanced Data Protection
Example Code
Last updated