I've been developing single player games for a while now and I have decided to start working on a online PC(and maybe mobile) TCG. The design is almost complete and I can cover most of the code as far as single player goes.

My question is:

Do I have to implement some sort of server-client model in order to make it possible for two player to get in a match together?


Every network application requires some system to act as a server. There are two ways to implement a multiplayer game:

  1. peer-to-peer - in every match, the machine of one player acts as a server, the others as clients.
  2. client-to-server - there is a dedicated server application all players connect to but which doesn't play itself. It is either hosted by you or by ambitioned community members.

Note that even in a peer-to-peer model it can be very useful to have a central server for matchmaking purposes. Without a central matchmaking server it is very difficult for players to find opponents. They would need to use some other communication plattform to manually exchange IP addresses.

The advantage of a peer-to-peer architecture is that it is a lot more convenient for you as a game publisher, because you don't have to buy, host and maintain a gameserver (or even many all around the world when your game becomes very successful). But unfortunately there is a problem which might be extremely important especially in the context of a trading-card game: Peer-to-peer allows the players to cheat.

When you have a central server which manages the game-state, you can make cheating really difficult. When a player tries to make an illegal move, the server can reject it and not forward it to the other players. The server can also withhold any information from the clients the player isn't supposed to know, like what cards the opponent has on their hand or which card they will draw next. When the client knows about these things or even decides them, a determined hacker can find a way to manipulate the game.

Also, a trading card game implies that each player owns an inventory of individual cards and can obtain more cards through trading, playing or other means (like micro-transactions). When that's the case, you definitely want to keep track of the inventory of each player on a central server. When the clients manage their inventory themself, it won't take long until players figure out which file to edit to get any card they want. This would pretty much ruin multiplayer for any players who want to play honestly and would ruin your business model when it's based on micro-transactions.

And no, there is nothing you can do about that. You can obfuscate your inventory files through encryption or store hashes and checksums of the state of the file to detect manipulation, but you need to store these somewhere where the players can access them. The only way to get the players hands off of their game state is to save it out of reach on a server. A pure peer-to-peer model should only be considered for games which do not require any form of persistence between matches.

| improve this answer | |
  • \$\begingroup\$ Thank you for this! It will help me find more info on what I need. Have a nice day! \$\endgroup\$ – cyane.spark Apr 30 '14 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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