Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Team Fortress reward model? Avoid cheating of items?

Discussion in 'Multiplayer' started by Zymes, Mar 19, 2017.

  1. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    How does Team Fortress 2 rewards avoid cheating of hats and weapons?

    Does their master server give the player the items? Since the community can host their own servers, what stops someone from hacking the server and making them give out any reward to a player on that server?

    The only logical reason is that it is centrally controlled by Valve and the profile must be stored online. Otherwise you could hack the profile and add any items you want to it.

    This seems to work with a time based system, but what about a game where you unlock things by doing something.

    Like finding X amount of something unlocks Y.

    How would you avoid the server admin cheating and giving out items in this scenario if you have central profile server?
     
  2. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,663
    Usually, online profiles are stored in a database.

    In order to give items to players, you would need a server command that does the work. But if your game does not contain any server command to play with at all, then server admins won't be able to use them - right? ;)
     
  3. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    Something still needs to trigger and tell the master profile server that "user has X and is rewarded Y" and X is given by playing on a server. Like a collectible. The server needs to tell the master server that "user has collected 5 of X and reward is Y"
     
  4. donnysobonny

    donnysobonny

    Joined:
    Jan 24, 2013
    Posts:
    220
    The trick here is to use an authoritative layer that sits between your database and the outside world. A fairly good example to look at is the request to "do X damage to Y".

    So using the "do X damage to Y" example, your concern is that if the player was able to make this request, then the player could effectively make X and Y any value that they want, potentially causing all sorts of problems. The key here is to strip back the request that the player makes to "do damage". At first, this seems crazy... where does X and Y go? Well, ultimately you need to design your authoritative server in a way where it always knows what X (how much damage) and Y (who the target is) is at all times. Then, a "do damage" request is able to check if the player can do damage, how much damage can be done, and who to; all without the player having to specify anything. The same example can be used to solve your problem, by setting things up so that the server knows how much X the player has, and therefore controls whether the player is granted Y. The player could maybe initiate the process, or the server could make this check periodically.


    So ultimately, the only way to be 100% sure that there is no way that players can misuse your system is to limit the player's control to an absolute minimum. Don't expect players to specify arguments (such as X and Y in the above examples), instead, have the ability for the server to be able to know what a player can do, and when, at all times and you'll be 100% cheat proof.
     
  5. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    Yes I know that I need authoritative servers for this. But what if the dedicated server runs a hacked version that can give out rewards freely?

    Maybe I need a way to checksum the client and the server exe so they are the same or something?
     
  6. donnysobonny

    donnysobonny

    Joined:
    Jan 24, 2013
    Posts:
    220
    Although there is no exact definition for "server", by "server" we usually refer to a dedicated computer or computer within a cloud that is managed by you (the provider of the game). This essentially means that accessing your server is restricted, how so depends on what your "server" actually is. Ultimately though, only you (and others that you have granted access to) have access to the server. As long as you can ensure that no one else can access your server, you can be 100% sure that you wont be running a "hacked version" of it. Ensuring that no one else can access it can be tricky, but there are ways to be 100% safe here, such as only accessing your server over SSH using RSA keys.

    If you are planning on shipping out the server-side of your game to players so that players can host their own servers, then you would need to think about separation. The server-side that you ship out to players should only contain the server-side logic for the game, and should not contain any means to manipulate player data. In this case, you would have a separated central server, managed by you (as described in the paragraph above) that implements your authoritative layer. Manipulation of data would only be possible on this separated server and nowhere else. This makes it much harder to determine what X and Y are (from the examples in the previous post), but that is the cost for shipping out the server-side of your game to your players.

    Hopefully this helps. Let me know if you have any further questions.
     
  7. Zymes

    Zymes

    Joined:
    Feb 8, 2017
    Posts:
    118
    The players host the servers. Just like in Team Fortress.

    It seems unfeasable if a central server would be queried all the time for everything.
     
  8. donnysobonny

    donnysobonny

    Joined:
    Jan 24, 2013
    Posts:
    220
    Team fortress is built by valve, so we can safely assume that it uses the steamworks API to access player data associated to your steam account, which is where data related to your items is stored and managed. So team fortress, as an example, does use a centralized server/cloud server for the crucial parts that we are talking about here (ensuring that players cannot misuse the system and gain items unofficially).

    If however your thinking of it being "unfeasible" is because of the work involved, welcome to the common stumbling block that all of us here eventually come to:
    1. ensuring prevention of cheating takes time, costs money, and can be infuriatingly difficult to set up. It is always possible to be 100% cheat proof though, you just have to be clever/savvy about it
    2. because of the above, you have to weigh in the above against how much time you want to realistically spend making your game, and whether cheating is actually something that you are concerned about. For example, if you don't want to spend much time at all, or you are building a game that isn't really very competitive, then not implementing cheat prevention at all can be a viable option.
    If you are simply concerned about traffic going to your centralized server though, there are various ways around that, such as making sure your server is well kitted out and/or using advanced mechanics such as load balancing or relay servers. The chances are though that a single centralized server will last you for a good while, until your game grows into the hundreds of thousands.

    Good luck!