Being relatively new to the Unity networking scene, but having done a fair amount of research, I’m looking for a couple answers I haven’t quite been able to find. My questions are likely opinion-based to some extent, but having the opinions of more experienced network developers would be helpful to people like me who are still trying to get a handle on this.
I’m developing a game with four players per room. Thus far, the popularity of the game and the play-time, bytes sent over the network, etc. are unknown. However, positions, rotations, and actions of the players, AI, and certain objects will need to be synched over the network. Taking a bit of a cue from this question, I would estimate the average message size to be around 150 bytes at 30 messages per second.
(Some other specifics: Using UNET on Unity 5.3.4f1)
Thus far, here’s what I’ve gathered about Peer-to-Peer Client-Server vs Dedicated Server Multiplayer:
Players each share equal authority and networking tasks; no player is a “host”. Generally used in simpler non-synchronous games.
Client-Server with Client as Host:
This is the way the standard Unity Networking system (UNet) operates, though it is also possible to run a Unity standalone player in headless mode on a dedicated server and use UNet.
Note: I confused this with Peer-to-Peer networking for a long time, which led to many cases of confusion.
- No dedicated server required, so significantly cheaper
- Able to play via LAN, without connection to internet
- Harder to prevent hacking/cheating
- Not HTML5 (WebGL) compatible, since a WebGL game cannot be a host
- Must be more meticulous when testing, since host-client operates slightly differently from other clients (e.g. reduced latency for host)
Client-Server with Dedicated Server:
- Expensive to maintain (depending largely on scale; in my specific example, based on Unity’s cost estimate—which is based on expected number of users, average message size, and messages per second—anywhere from $50 - 500 per month)
- Must be connected to internet
- Easier to prevent hacking/cheating (since everything must go through the non-client dedicated server)
- HTML5 (WebGL) compatible, since the host is the non-WebGL dedicated server (though certain other missing WebGL components, like microphone use, may make this a moot point for my specific game)
- Testing is more equivalent for all players since all players interact with the server equally
Moving into more specifics with a dedicated server (unsure whether this warrants a separate question), what are options for running a dedicated server? This is the part where I’m a little more lost. From what I’ve gathered, some of the options include:
Unity Multiplayer (Game Development Software: Build a Multiplayer Game | Unity) : The standard to use with Unity is Client-Server with a player as the Server. While this is relatively new, I’ve gotten it to work, and it’s relatively well-documented. The Unity Matchmaking Service (which is free) is likely the best way to go about finding players to play with. This can also be set up with a dedicated server (as mentioned above, by running a Unity standalone player in headless mode on a dedicated server and using UNet).
Amazon Web Services (https://aws.amazon.com/documentation/sdk-for-unity/) : Unsure of whether this is possible at all.
Photon Networking (PUN) (Photon Unity Networking Classic - FREE | Network | Unity Asset Store) : Seems to be easiest, most expandable, and well-documented. Uses Client-Server model with dedicated server. The Photon Cloud can be used (free version includes 20 CCU), however, code cannot be executed on the server, so hacking a game using this wouldn’t be too difficult. Photon can also be used with your own dedicated server that you could, like with Unity Multiplayer, have Unity playing on, which would prevent issues with hacking.
Which of these sounds most reasonable for the kind of game I’m developing? If a kind of networking is not ideal for my game, what kinds of games should it be used in? Are there other concepts and ideas I’m missing here? Any thoughts and ideas are welcome. Again, I realize this post does not necessarily have a clear “answer”, but is more of a jumping-off point for learning more, and I’m hoping it will also be helpful for future viewers. Often some of the most helpful questions I have encountered have been closed for being non-specific.