🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Quick question - 4 player online, server required?

Started by
12 comments, last by frob 4 years, 5 months ago

You know those games like Left 4 Dead, Vermintide, where you team up with 4 people co-op, do those need a server? Or do they use what people are calling "P2P networking"?

Is a server usually only required when you want lots of players, like a 32 player Quake deathmatch?

Reason I ask is I want to make a 4 player online co-op game, and I want to know if Unity is a good choice. I hear that online multiplayer in Unity is not as well supported as it is for UE4, but does that only apply for large numbers of players? Is it all the same if I just want 4 players?

For local multiplayer retro themed games, visit Domarius Games.

Advertisement

No, p2p is fine.

There are two meanings of the word "server." One is "a box of hardware running some service on a network." The other is "a game process that is a central spoke in a wheel of connected players."

When it comes to "services on a network," here are at least three kinds of "servers":

  • The actual game server -- player clients connect to this, and use the server to exchange state about the game, and perhaps to apply rules to reduce cheating. May also deal with chat, especially within game sessions.
  • The "player progress" kind of server. This stores high scores, player progression, unlockables, friend lists, microtransaction results, and so forth. May also deal with chat, especially for non-game-session things (guilds, groups, friends, etc.)
  • The "matchmaking" kind of server. This keeps track of what players are looking for games, and what games are available or, perhaps, arranges for games to become available to match what players are looking for. This lets players find active game instances across the internet.

The latter two of these are very hard to run as P2P services, because the whole point is that they are shared and central. Yes, you can store unlocks on local disk, and you can use matchmaking on the local LAN, or have players type in IP addresses like it's 1995, if you don't want to run a central server.

For the "game process that is a central spoke," it is usually easier to structure a networked game in that way, because it allows you to make clear determinations about things like "who first picked up the health pack" or "who died before shooting the other person" or such. However, that process doesn't have to be hosted by you, or a machine you control. Someone running your game, can have that game run in "server" mode, and have other players connect to that. This is sometimes also know as "hosting" mode for the game client. Many popular games use client based hosting for game instances, but use central servers for player progression and matchmaking.

A true "P2P" system doesn't use a player-hosted server, even, but instead just sends the actions of player X to other players in the same game instance, and each other player in the instance send their state back to you. This situation may work OK on a local LAN, where you can use broadcast packets to find other players. It will, however, have real problems with any kind of tie breaking -- who reached the goal line first, and so forth? For some games, that may be good enough. If you want to play these games over the Internet, yet still have them be P2P, you'll have to have some kind of interface where players can punch in the IP address / port of some existing player, and then bootstrap connectivity to the other players through this initial connection. NAT punch-through and full connectivity in such a system is a major pain in the butt, and often needs special configuration of firewalls and routers. I don't recommend it for internet play.

enum Bool { True, False, FileNotFound };

Thanks guys!

hplus0603 said:
NAT punch-through and full connectivity in such a system is a major pain in the butt, and often needs special configuration of firewalls and routers. I don't recommend it for internet play.

I'm set on using Steam, like Left 4 Dead or Vermintide 2; you can host a game and invite your friends via Steam. I assume this would mean I don't have to get involved with that stuff...

I can't quote the bulleted list part of your post properly, but sounds like if I want to have matchmaking, I have to actually set up an independent server of some sort...

For local multiplayer retro themed games, visit Domarius Games.

Domarius said:
sounds like if I want to have matchmaking, I have to actually set up an independent server of some sort...

Somebody must do it. It doesn't have to be you.

Steam provides many of those services. It can provide login and authentication servers, and matchmaking servers. While the servers can be provided by Steam or other publishers, they can be provided by companies like Amazon with Lumberyard, they can be provided in game consoles by Sony or Microsoft or Nintendo, you also can implement them yourself.

Steam's tools provide a basic framework with matchmaking and some building blocks about players joining/leaving, achievements, and similar. They handle a long list of connectivity issues, including nat punchthrough. Major games often implement their own functionality, and even those that use portions of Steam's system will still implement their own for many services. Steam's tools work and are used by plenty of games.



frob said:
Somebody must do it. It doesn't have to be you.

Thank you for your explanation. I think between these 2 big posts, I finally have a good overview of this.

So far it looks like I can use the matchmaking functionality provided by the platform (Steam, Sony, etc.) and use the P2P functions of Unity or UE4. I'm aware UE4's is more complete whereas Unity you need to do more groundwork, and I have the option of using Steam's P2P functionality but that would bind the game's P2P code to Steam which would be an issue if I want to support other platforms. (Feel free to correct any of this).

For local multiplayer retro themed games, visit Domarius Games.

Note that most of the Steam-using games (including Left for Dead) are not actually peer-to-peer.

Some player “hosts” the game. That player's client is the “server” for the game. The topology is “star,” where the “hosting” player is the “server.” The fact that the server happens to have a graphics card, keyboard, and mouse attached, and a human piloting some simulated entity on it, doesn't change the fact that it is, topologically, a server.

I say this because the P2P topology is full of booby traps and undecidable problems that make almost any game feel glitchy in practice. If you can get away with player-hosted games, using the server topology like 99% of player-hosted games do, then that's much better.

enum Bool { True, False, FileNotFound };

Would it be possible to have optional Peer2Peer. Like when I play SuperTuxKart with my kids in our local LAN, I still like to support the developer with our data (start topology), but want player inputs be shared peer to peer. I started looking into Wifi again and there is this peer to peer mode. Somehow I cannot see how I use infrastructure mode (for updates and statisitics) and true peer to peer (each notebook radios (broadcasts) player input and every notebook listens to the radio at the same time. There is a new direct Wifi standard. Does that help? I know on ethernet coax cable there is chance of collision. So I would guess that – when everything is running fine – a token ring should be placed over that, so that in a time slice manner every notebook can send its updates. I do not like to use different radio channels for each notebook because that takes me farther away from the event driven nature: Key is hit, event propagates.

arnero said:

Would it be possible to have optional Peer2Peer. Like when I play SuperTuxKart with my kids in our local LAN, I still like to support the developer with our data (start topology), but want player inputs be shared peer to peer. I started looking into Wifi again and there is this peer to peer mode. Somehow I cannot see how I use infrastructure mode (for updates and statisitics) and true peer to peer (each notebook radios (broadcasts) player input and every notebook listens to the radio at the same time. There is a new direct Wifi standard. Does that help? I know on ethernet coax cable there is chance of collision. So I would guess that – when everything is running fine – a token ring should be placed over that, so that in a time slice manner every notebook can send its updates. I do not like to use different radio channels for each notebook because that takes me farther away from the event driven nature: Key is hit, event propagates.

All game networking is higher up the OSI layer https://en.wikipedia.org/wiki/OSI_model . Wifi peer to peer (wifi direct) is completely different to peer to peer in the general sense. Peer to peer is pretty ambiguous and covers a lot of ground but games shouldn't be trying to invent some new kind of topology like they're academic research labs.

I was going to say more but this says it all https://en.wikipedia.org/wiki/Peer-to-peer

Domarius said:

I want to know if Unity is a good choice. I hear that online multiplayer in Unity is not as well supported as it is for UE4

Multiplayer in Unity is currently unsupported - as in, there is no multiplayer functionality currently shipped with the Unity engine that is not either deprecated or in an alpha/unstable state.

Before adopting Unity for any multiplayer game, you'll need to identify how you intend to handle the multiplayer part of it. Typically this will mean one of:

  • using the deprecated APIs and working around the bugs and limitations
  • using community-fixed versions of deprecated APIs and working around the limitations
  • using the alpha version of the new code and working around the limitations and the changing API
  • picking a 3rd party provider (e.g. Photon) and paying for it
  • paying someone to write custom multiplayer code for you

This topic is closed to new replies.

Advertisement