In this thread I thought we could share some ways of preventing cheating in online java games (for example of many human players are trying to kill each others, how can you prevent one of them from seeing through walls/invisible objects or having zero reload time etc).
I’m new at this so I don’t really have any tips to give, other than the “keep all logic on the server” (like the server receives a click event from a player and then generates a fire event which is sent to all connected clients). This puts a lot of work on the server’s shoulders however and will still not protect from cheats that changes visibility of things (if a player is supposed to have 10% visibility the cheat could make it display at 100% regardless of what the server is saying since it’s client-wise).
I saw a good anti-cheat checklist which I will now quote:
[quote]1) Open all other processes, and hook their WriteProcessMemory functions so that they can’t write to the memory in your game’s process. Done right this one step will block 90% of all cheats and cheat engines.
-
Do the same thing, hooking the various mouse and keyboard emulation functions. This will prevent a lot of aimbots and other types of automation bots.
-
Hook into the VirtualProtectEx/VirtualAllocEx/etc functions in your game’s own process and monitor which modules are changing protection levels or allocating new memory chunks. You have to be crafty with this in order to prevent it from being too CPU intensive when your game does a lot of allocations, but it can be done.
-
Hook into the LoadLibrary functions and monitor any DLLs that are being loaded dynamically, to prevent DLL injection.
-
Use some lightweight polymorphic encoding on your game connections.
-
Use some anti-debugging techniques to prevent debuggers from attaching to your processes. Google anti-debugging and you should be able to find lots of stuff.
-
Use a custom proprietary PE packer to prevent useful disassembly of your game.
-
Hook into your OpenGL or Direct3D functions and methods that deal with transparency and alpha blending.
-
If using shaders, checksum your shaders and the shader constant values.
-
Use additional occlusion culling techniques on player characters to prevent them from being rendered at all when the line of sight to them is blocked by other geometry. It may or may not help with your performance also, but it will prevent many wallhacks.
[/quote]
Source: http://stackoverflow.com/questions/960499/how-to-prevent-cheating-in-our-multiplayer-games
This is a good list IF you are skilled enough to implement it by yourself, which I am not. Also, this list is more for languages like C and not Java. Maybe one can use a Java Native Interface to implement the anti-cheat part of the game, however I’m again not good enough of a programmer to be able to do that.
Java Native Interface is from what I understand making a EXE in for example C and then have C call Java mehods. More information about it can be found here for those interested: http://en.wikipedia.org/wiki/Java_Native_Interface (A side track of this thread I suppose, but maybe one of you can use it to prevent cheating in Java games?)
So, anybody with experience willing to share their knowledge? I bet this is something a lot of people on this section of the forum would like to know better. I know some may think they should post “you can’t prevent all cheating” and think they’re being smart, but if we could at least make it impossible to use the most common cheat engines we would get rid of a lot script kiddies (I’d guess 99.9% of all cheaters are just using a general-purpose tool someone else made).
For good measure I will make what I wrote above into a question:
How do I prevent cheating in multiplayer Java games?