Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
205 views
in Technique[技术] by (71.8m points)

anti cheat - How to prevent cheating in our (multiplayer) games?

If you are writing a game you should think about cheaters and how to prevent them from cheating.

I don't think only the mmo multiplayer games but also singleplayer or "home-brewed" p2p mp games too.

When the game is based on completely a server-client architechture, the job is almost done I think, but there is also wall hacks or something else.

I made my own p2p game and some time later cheaters appeared. They were only scriptkiddies who used cheat engine and tried speedhacks and memory hacks.

Most speedhacks hooks gettickcount. I sorted out speedhackers by the following simple trick. I just tracking the time()-GetTickCount() value and if the difference changes there is cheating.

Memory corruptions can be sorted out by keeping a hashed copy somewhere and moving it always and always rehashing it by a random value. Mismatching causes crash.

To sort out Cheat Engine at all, just check:

if (OpenFileMapping(FILE_MAP_READ,false,'CEHYPERSCANSETTINGS')!=0)
{
   // Cheat Engine runs.
}

(a friend told me this, I haven't tested it yet.)

These tricks sorted out the most cheaters. But there is of course more cheating techniques. I opened this wiki, to discuss more another cheating techniques and the way to avoid them.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I don't think you should do anything to stop cheating on single player games. Your users bought the game, they should be able to cheat if they want to, as long as they're not playing against others.

Here are a few things that I've done. These were mostly done for anti-cheat systems on tournament games, where money is at stake, and certain levels of intrusion on the user's system is considered acceptable. I would be careful about doing some of this stuff on casual games since if your game is not stable there is the potential for causing problems with their system.

1) Where possible, "Never Trust the Client" is your safest principle to adhere to. Perform all actions on the server, and only give the client as much knowledge as is necessary to render what he should be able to see on the screen at any given time. i.e. if a client doesn't know the position of a player that is hidden behind a wall, a wall hack won't do the user any good. For high-speed action games this can be extremely difficult - especially now that real-time shadows and such are the norm, where the user may need to be able to see a shadow even if the player's body is visible - but it should always be at the top of your options. Also extremely difficult to do on peer-to-peer games, but there are ways to limit knowledge between peers. Only when it becomes performance prohibitive, or outside of your time/money budget, should the following items be considered.

2) 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.

3) 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.

4) 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.

5) Hook into the LoadLibrary functions and monitor any DLLs that are being loaded dynamically, to prevent DLL injection.

6) Use some lightweight polymorphic encoding on your game connections.

7) 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.

8) Use a custom proprietary PE packer to prevent useful disassembly of your game.

9) Hook into your OpenGL or Direct3D functions and methods that deal with transparency and alpha blending.

10) If using shaders, checksum your shaders and the shader constant values.

11) 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...