How to host your game: peer-to-peer or client-server?

There are two main methods for hosting your game – either use the player’s computer or a separate server. But which is right for your game?

How do you set up a multiplayer game? Where do you actually host it? Well, broadly speaking, you’ve got two choices: you either leave it up to the players’ machine (peer-to-peer) or you have a separate server (client-server).

But which should you choose for your game? It’s a tough question, because the answer really depends on your genre, how integral to your game the multiplayer is, and whether you need a fair match. So let’s look at the difference between those two choices, so you can decide for yourself.

What’s the difference?

There are two popular choices for hosting your game:

In our examples, you’ll notice there’s a very obvious difference between those types of games: turn-based versus real-time. As a rule of thumb, yes. If your game is real-time, you probably need a separate server. But not always. Sadly, it’s not that simple.

There are instances where, even with turn-based games, you might want to use a client-server. Take chess. It needs hardly any compute power, so the player’s machine can clearly handle the processing. But it’s so asynchronous that you might play a game over weeks – each player sending their next move when it’s convenient to them. You can’t expect one of the players to leave their machine on constantly. In which case, you need a separate server. (Though, you wouldn’t need an orchestrator like us – latency isn’t exactly a problem there.)

Client-server is essential for competitive matches

If your game is demanding and fast-paced, you’re definitely going to need a client-server. With competitive games – like Call of Duty, Starcraft, Rocket League, or League of Legends – need instant feedback. You can’t rely on a player’s computer to handle the load.

It helps protect your game from cheaters

If you host your game peer to peer, you open your game up to cheaters. They can – and will – reverse engineer how things work, spawn in items, make themselves immortal, zoom around the map and otherwise wreak havoc. They have access to the code and they’ll use it. Even with cooperative games, this can be a problem. Earlier Diablo games had problems with players spawning items in, which can demoralise hard-working players.

On the other hand, using a client-server makes it much more difficult for cheaters. It acts more like a referee, an impartial arbiter of truth. The server knows the rules and it enforces them. And it can store the key information about your players, which is particularly necessary when you start considering item ownership. That said, it’s not impossible for cheaters with client-servers. So make sure to look into anti-cheat software if you’re concerned about it for your game.

It makes your game more reliable

When you’re in control of the servers, you can judge how much compute power it needs and make sure it can handle the load. If you leave it up to the players, they could be running it on a potato for all you know.

This is also essential for persistent worlds. Take Minecraft, for example. Sure, one of the players could host the server on their machine. But they have to leave that machine on. That’s why Mojang now offers Realms – a way to host those worlds separate from the player.

Handle loads of players at once

Peer-to-peer isn’t really suitable for massive games. Even if a player’s machine doesn’t conk out, their broadband connection will likely only cope with four to six players. A game like Chivalry 2 with 64 players in a single match? No way. For that, you’re going to need a separate server.

Peer-to-peer is simple, but vulnerable

Not every game needs you to host on a client-server. If your game is a story game or most matches are between friends, peer-to-peer can work well. Take Divinity 2 – a role-playing game. Players are working through the story together. It doesn’t really matter if they cheat – it’s only their own experience they’re spoiling. And they can’t buy items or cosmetics from you – the developer – so it doesn’t matter if they decide to spawn them in.

But once you get over four players, you start selling in-game purchases, or people want to start playing with randos, it’s just not sustainable. You run into problems like whether the host’s internet connection is good enough, how to migrate a session if the host drops out, and cheaters. And as soon as you hit eight players in a match, it’s almost impossible to make it work well.

Sure, it’s cheaper. You’re not paying for servers. But a better alternative is to use a client-server model and then outsource your server hosting to the community, letting them set up their own servers. You’ll still have cheating problems, but hopefully your community will regulate itself. (In fact, this is a good end-of-life approach for most games.)

Use our checklist to see which you need

Ask yourself:

If you answer “yes” to any of these questions, you probably need a client-server. If you have a game where people only play with their friends, with only around four people in the match at once, peer-to-peer might work for you.

Choose the right approach for your game

If you’re still unsure which route to choose, we’re happy to help. We’ll help you decide which approach is best for your game. Maybe it should have a mix of the two – with certain game modes using client-server and others peer-to-peer. We can also help you decide whether you need an orchestrator or just a server. Either way, we can get you set up and ready to start hosting multiplayer games.