Are there any anti-cheating frameworks for Java games in order to make it a bit harder to cheat? (eg. something that protects from things like Cheat-Engine) Obviously if the cheater were to develop his own tools this wouldn't help much, but I'm looking to protect the game from the average cheating 13 yr. old child.


None ready that I know of.

Commercial (expensive) systems like PunkBuster exist, which constantly scan memory locations for changes, asserting that they haven't changed by impossible amounts or at impossible moments in time.

You could implement something like this yourself, by occasionally asserting that the changes to the contents of your variables make sense.

If it's a singleplayer game you're working on, I have a very personal request: Please don't do it! Back when I was 13, I learnt a lot about how games work by CheatEngineering or Poking them. It's like taking apart toasters and RC cars. I want my kids to live in a world where they can choose to break their things regardless of the opinion of a grown-up who "knows better".

  • 5
    \$\begingroup\$ I want my kids to live in a world where they can choose to break their things regardless of the opinion of a grown-up who "knows better". +1 \$\endgroup\$ – Grimshaw Jun 16 '12 at 21:55
  • \$\begingroup\$ Thanks for the help, its a multiplayer game (although it does have a single player mode) So I think I might just implement it in the multiplayer areas when cheating wouldn't be fair for others, as I too learned my initial bit of programming from poking around in games like Civilization and Roller Coaster Tycoon \$\endgroup\$ – JosephG Jun 16 '12 at 22:04
  • 2
    \$\begingroup\$ @user185812 if the game is multiplayer, you should protect it server-side, not client-side. I'm sorry but if you don't know this, you don't know anything about security, and you'd better learn. \$\endgroup\$ – o0'. Feb 3 '13 at 12:42
  • \$\begingroup\$ Totally agree with Anko, if you aren't interfering with the fun of others, and can find any fun in cheating (it can be fun), you should be able to do so. That said, even if the game is single player but will have feature like leaderboards, you can have a bit more control by having your own cheating menu and disqualifying the player for using it. \$\endgroup\$ – petervaz Jun 13 '13 at 12:35

When it's a single player game, there is really no reason to prevent cheating. Cheaters can only hurt their own game experience, not that of others. The cheaters themself, however, perceive the ability to cheat as a vast improvement of their game experience. So why bother?

When it's a multiplayer game, you can prevent cheating by designing the network protocol in a way that trust in the client application is not required. This is much better than any 3rd party AC-tool.

  • Handle each message from a client on the server as a request which can be denied, not as an order.
  • Have the whole game state and game mechanics on the server. Do not allow clients to alter the game state directly.
  • Do not give the clients any information they are not supposed to show to the player

This is a simple way to do it:

public class SecureInt {
    private static int KEY = (int)System.nanoTime();
    private int secureValue;

    public void setValue(int value){
        secureValue = value ^ KEY;

    public int getValue(){
        return secureValue ^ KEY;

You just use the above class for ints, floats, etc.

  • 1
    \$\begingroup\$ Doesn't do anything to stop cheat engine. Find health by scanning for "changed value" enough and then freeze the value -> immortality. What you need is to create an object that stores each of its bits in separate objects, and allocates these in random order, every time the value changes. \$\endgroup\$ – Jari Komppa Jun 13 '13 at 12:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.