Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Trying to setup an anti-cheat system for a game friend and I are creating (http://www.programmingforums.org/showthread.php?t=7884)

Dr.Backtick` Jan 8th, 2006 8:36 PM

Trying to setup an anti-cheat system for a game friend and I are creating
 
Hi,

My friend and I are creating a game in the language of C++. We have not come up with a official title of the game as of yet but have an idea of what we wanna make and what systems to create for it. We already layed somewhat of a design. One of the things that were needed for the game is a way to have the game reject modified game content files. A system such as CRC (Cyclical Redundancy Checking) popped in my head. I have seen such systems in action and thought why not try implement this sort of system into my code. So, I started to google and found plenty of things on it. I think from reading the tutorials I know the procedure of how it works. CRC32 is confusing to an extent for me since I am weak with Polynomial math theories and such. Some of the tutorials say I do not need to know things like that. Also, I noticed that the code provided on them just give me a way to retrieve the current CRC value for the file. I wasnt even able to compile the code since there were things like DWORD and HANDLE which were confusing. All I wanted was a good way to ensure that the game will not run on a modified game content file. Anyone have any suggestions as to how I can implement it?

--George

Arevos Jan 9th, 2006 1:37 AM

You could sign the content with an RSA public key, and that would ensure the file isn't trivially modified.

Realistically, however, if you store your game data locally, then all you can do is make it difficult for people to cheat. You cannot make it impossible.

nnxion Jan 9th, 2006 3:11 AM

It depends on what kind of game it is. In first-person shooters (FPS) things are dealt with differently than with role-playing games (RPG).
You could take a look at how other games do it, for FPS look at Counter-strike, ask how VAC and Cheating Death works.
For RPG take a look at World of Warcraft that hass Warden.
VAC, Cheating Death and Warden are all pretty thoroughly tested.
There are a lot of other games, which may have similar or even better methods. Ask a gaming forum.

One last bit of advice, on FPS don't take the response time that it takes to kill a person, this was tried in Counter-strike, and random swings and clicks on the button resulted in innocent bannings.

Polyphemus_ Jan 9th, 2006 8:40 AM

Personally, I don't see the point of making an anti-cheat system. If users of the game want to cheat, it is their problem, isn't it?

badbasser98 Jan 9th, 2006 8:47 AM

Quote:

Originally Posted by Polyphemus_
Personally, I don't see the point of making an anti-cheat system. If users of the game want to cheat, it is their problem, isn't it?

But it ruins the game for everyone that is honestly trying to play it. So then to be competitive, more and more people begin to cheat. Then what do you have? A wothless game that no one enjoys playing. I see the point perfectly to create anti-cheat software.

Dr.Backtick` Jan 9th, 2006 9:46 AM

Well, I can tell you now that it is going to be a 2d game and not 3d. We think we may or make it a platform based game I suppose like Mario but we havent decided. So, you think CRC is a bad idea? I might consider the RSA one.

Thanks for your replies

--George

jayme Jan 9th, 2006 9:59 AM

you might not want to make an anti-cheat system for your first game you make... im not saying that it wont happen, but since it will only be your first i highly doubt someone will even bother to take the time to create a hack or cheat for it.. especially since it's going to be 2d. It's good practice though for later on i guess.

Dr.Backtick` Jan 9th, 2006 11:14 AM

its not really my first program or game attempt i've made. Its just that i'd like to implement a system of that sort into the program. CRC seemed like the way to go. Since it seems that each program pretty much has a different polynomial value. It changes whenever the file is modified. I think modern games use CRC32 also. Mainly from what I understand is that the first thing with CRC you must do is generate the lookup table. Then you must read the file in and retrieve the unique value. But maybe I could just generate the CRC value for the game content file and have it stored hard coded and just to check the value in the code that I have stored against the current value.


Another part we think the game should have is a high score system. I had originally considered mysql as a method of storing the scores. I didnt want to have the scores stored in a flat text file on the local system. Then when I looked more into it I thought nah, I shouldnt use mysql because I would have to lower the security settings on it and make it more open. That would not be good.

nnxion Jan 9th, 2006 11:14 AM

I should have said that anti-cheat software only works (and makes sense) when playing online games. If you are making an interactive platform game like Mario then you would have to look on what to prevent. You will want to prevent teleporting, getting more guns/ammo/lives or any other 'equipment' and flying for example. CRC is checking whether data came to the other side without missing (too much) data. You might want to do some encryption indeed.

Dameon Jan 9th, 2006 6:37 PM

1. If the user downloads/purchases the game, then don't be a content nazi. They cannot use the content without your permission, but modifying game content is not only common but a good way to increase user involvement and playability. You don't have to release any file formats or specs...they will figure it out if they want to. Or you could be like Valve/Epic Games/Bioware/etc and release the developer tools for free with the game and have insane amounts of user content...

2. Redundancy checking on files is useless. What? My file doesn't match the CRC? Oh noes!one1 That means I have to change the locally stored expected CRC. Gasp. The server is requesting the military grade SHA-1 hash of the map? OMG, I have to replay the known good hash to the server.

3. Clientside anti-cheat detectors are borderline useful, but only a stopgap solution. Where to begin. First off, how do you plan to detect them? Enumerate the processes attached as debuggers you say? That's right, they have no right to touch my precious memory! Check for known "bad guy" processes? Right. Slows ya down, sure, but our friends at Sony have kindly provided a rootkit that hides processes with image files beginning with $sys$ World of Warcraft had a slight inconvenience with that little tidbit. Or you could use a real rootkit. That brings me to #4

4. Kernel mode. There's that sad fact that there is some code with higher priveleges than you that can stomp on your memory, bounce your api calls off satellites, and steal candy from defenseless orphans. Rootkits fall into this category. But this broadens your view of the fact that you do not control the computer.

Move server side. I advise that you download the source code for an open source game known as BZFlag. Nice 3D tank shooter. However, the server is mostly a relay while the client can do whatever it feels like. An example. A classic BZFlag cheat is to notify the server that a shot has exploded...except that it isn't one that you fired. Being a good relay, it kindly notifies the other clients that the shot has exploded. I took some liberties with the idea. Whenever notification of a shot arrives, my client ends the shot. Mapped that to a key to toggle that. Suddenly, everyone was wondering why their bullets disappeared at the end of their barrels. Commenting out the line that notified the server that you died was entertaining as well. So was turning off gravity.

Moral of the story? Everything that the client sends is a risk. Online login form? SQL injection. Multiplayer game? Send something that shouldn't work that does (or conversely don't send something when you should). The server is authoritave. The only way to change the experience of the other players is if the server notifies them. The only way to change your own data, be it health mana ammo or otherwise, is if the server thinks so. You accomplish this by maintaining state on the server (why BZFlag is an example of bad practice) and by doing insanely large amounts of sanity checking. More sanity checking than makes sense. If somewhere down the line you realize that you disallowed something that needs through (such as a future modification), that's when you change it. Whitelist versus blacklist. Methods on objects along the lines of canFire or canCastSpell can help make this more maintainable. What you do with sanity checking depends on several things. Can the problem be attributed to lag (ex trying to fire shortly after being killed)? Ignore it, but make sure the client stays in sync. Is it something that should never, ever happen (attempting to learn a skill that is blatantly disallowed by the rules, such as a level 1 wizard taking Epic Spell Focus in D&D)? Disconnect or ban.

You'd be surprised how much you can learn just by observing the behavior of games and game servers, be it learning about defense from cheating or good practice in general. THe Neverwinter Nights server was smart enough to reject my attempt to break D&D 3rd edition rules while levelling up, even though that is the client's job. World of Warcraft scales player updates based on distance, apparent by the jitter of party members on the world map that are on the other side of the zone (update every few seconds) versus those near you (smooth, at least once a second). The Source engine used in CS:S and HL2:DM at one point allowed a command to be executed by the client that allowed them to spawn effects. Picture strobe lights and skulls appearing from nowhere.

I could prattle on about the ins and outs of multiplayer game design. All in all, be careful on the server, but the client is uncontrollable. Who cares if they piss in their own sandbox when nobody else is around?


All times are GMT -5. The time now is 2:38 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC