Unity - Multiplayer is a complex beast, there are a number of different options available to both indie and AAA developers.
<! – more –>
Introduction
If you’re making a turn-based, or MMOFPS game, you will need some sort of backend. This article will go over some of the options available.
Networking Options
- Unet
- Unity built-in - Dont use
- Unity’s New Networking Solution…
- When ever that is ready
- Mirror
- Used in uMMORPG
- Stream
- For chat only
- Photon Fusion
- New PUN, also better than Photon Bolt - Good for fast-paced FPS
- Netcode
- New Unity solution
- https://blog.unity.com/games/enter-the-boss-room-in-2022-netcode-for-gameobjects-relay-and-lobby
- https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop
- Fish-Net
- https://fish-networking.gitbook.io/docs/
- https://github.com/FirstGearGames/FishNet/tree/main/Assets/FishNet/Runtime
- https://assetstore.unity.com/packages/tools/network/fish-net-networking-evolved-207815
- Dark-rift 2
- SmartFox Server
- Custom Server using Sockets.
Prerequisites
This article assumes that you have some basic knowledge of the following topics:
Backend-as-a-Service
Photon
Photon has a number of offerings:
https://www.photonengine.com/en-US/Photon
Photon Realtime
https://www.photonengine.com/en-US/Realtime
Photon PUN
https://www.photonengine.com/en-US/PUN
Photon BOLT
https://www.photonengine.com/en-US/BOLT
Photon Quantum
https://www.photonengine.com/en-US/Quantum
UDP on all platforms and Websockets on WebGL
relay service
https://doc.photonengine.com/en-us/server/current/reference/authoritative-server
https://doc.photonengine.com/en-us/server/current/getting-started/photon-server-intro
Photon Bolt
https://www.photonengine.com/en-US/BOLT/pricing
https://assetstore.unity.com/packages/tools/network/photon-bolt-free-127156
https://www.photonengine.com/en/Bolt
https://doc.photonengine.com/en-us/bolt/current/getting-started/overview
Cons:
Still, require you to handle Load Balancing
Server
Photon Server
https://www.photonengine.com/en-US/Server
https://doc.photonengine.com/en-US/Server/current/operations/requirements
PUN vs Bolt vs Server vs Quantum
Playfab
Doom Eternal is also using Playfab
Playfab folder
https://api.playfab.com/blog/a-free-playfab-custom-game-server
https://github.com/PlayFab/PlayFabGameServer
https://api.playfab.com/docs/tutorials/landing-tournaments/custom-game-servers
https://github.com/PlayFab/PlayFabGameServer
https://strangeioc.wordpress.com/
https://github.com/PlayFab/PlayFabGameServer
Multiplayer Servers
https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/
https://www.quora.com/Who-are-the-competitors-to-PlayFab-Inc-the-BaaS-for-games
Gamesparks
Pros
NodeJS
Cons
Price?
https://www.gamesparks.com/product/real-time-multiplayer/
Realtime Services
BrainCloud
https://portal.braincloudservers.com/admin/dashboard#/support/company
https://braincloud.statuspage.io/
http://18.220.113.13/apidocs/tutorials/unity-tutorials/braincloud-bombers-example-game/
https://getbraincloud.com/apidocs/tutorials/unity-tutorials/building-the-braincloud-bombers-project/
Realtime Multiplayer: They use PUN.
Google Play Game Services (Android Only)
https://developers.google.com/games/services/cpp/realtimeMultiplayer
Nakama
https://heroiclabs.com/docs/nakama-download/
https://forum.defold.com/t/infos-about-a-multiplayer-game-service-server-provider/12888
SpatialOS
Google-partnered
https://forums.improbable.io/t/unity-webgl-support/3561
No WebGL support
Lack of decent tutorials/documentation
Chilli connect
Website: https://www.chilliconnect.com/
Documentation: https://docs.chilliconnect.com/guide/
Multiplay
Parse
Back4App
App42
http://api.shephertz.com/app42-dev.php
http://www.shephertz.com/
Firebase
https://firebase.google.com/games
Player.io
Platform-as-a-Service (PaaS)
See the Cloud Deployment Section below
Custom Server
Going with your own server, requires a number of components:
Backend Platform
Database
Caching
Deployment
Communication Protocol
Load Balancing
Backend Platform
The Backend platform or language you use will mostly depend on your skills, experience, business needs, cost, etc..
Unity
uNet - Unity Multiplayer High Level Scripting API (HLAPI)
Note: UNet is deprecated, and will be removed from Unity in the future
https://docs.unity3d.com/2020.1/Documentation/Manual/UNet.html
Mirror
uMMORPG
https://assetstore.unity.com/packages/templates/systems/ummorpg-51212
https://noobtuts.com/unity/unet-server-hosting
https://noobtuts.com/unity/detect-headless-mode
ForgeNetworkingRemastered
Read More About Forge Networking
NodeJS
NodeJS Multiplayer Packages
Socket.io
https://stackoverflow.com/questions/43702043/aws-application-load-balancer-and-socket-io
https://stackoverflow.com/questions/23924718/socket-io-with-aws-elastic-load-balancer
https://www.reddit.com/r/gamedev/comments/6gjgnx/backend_scaling_for_multiplayer_html5_games/
WS
https://www.npmjs.com/package/ws
Lance GG
Colyseus
https://github.com/colyseus/colyseus
Actionhero
https://github.com/actionhero/actionhero
Ably.io
ASP.Net
PHP
Java
Databases
MongoDB
Postgres
Firebase Realtime Database
Firebase Cloud Firestore
Cassandra (NoSQL Database)
Developed by Facebook
Apache project
Distributed Hashtable
Scales horizontally
Redundant
Limited queries (CQL)
Caching
Redis
Network Communication Protocol
HTTP
RESTful
Long Polling
WebSockets
Pros
Supports WebGL
MQTT
Cloud Deployment
AWS
Amazon GameLift
https://aws.amazon.com/gamelift/getting-started/
Lumberyard: GSG 001 - Introduction - First Time Launch
https://www.youtube.com/watch?v=NNqTDoPszxM&list=PLuGWzrvNze7KbG2x6ccIw8eMhL5e4Iwpe
Sign up for an AWS Free Tier and Test Amazon GameLift
https://www.youtube.com/watch?v=OboeAg3_v8Q&list=PLuGWzrvNze7KQO5mREeae2eIR8rJws0At
Getting Started: Downloading and installing Lumberyard 1.7
https://www.youtube.com/watch?v=-VH_7AVI4vE&list=PLuGWzrvNze7LUPx6acEXNhIL3S7jW3MC8
{\n “FleetId”: “fleet-7c041305-fb5b-45b8-900a-cd31b3ecfc74”,\n “GameSessionId”: “arn:aws:gamelift:us-east-1::gamesession/fleet-7c041305-fb5b-45b8-900a-cd31b3ecfc74/gsess-c04edca3-9857-44f8-bc1f-32a1e52f0d8b”,\n “IpAddress”: “35.174.4.81”,\n “PlayerId”: “Player 1”,\n “PlayerSessionId”: “psess-e2fe7226-52ad-42f0-82bc-1efa4b4423a1”\n}
{\n “FleetId”: “fleet-7c041305-fb5b-45b8-900a-cd31b3ecfc74”,\n “GameSessionId”: “arn:aws:gamelift:us-east-1::gamesession/fleet-7c041305-fb5b-45b8-900a-cd31b3ecfc74/gsess-c04edca3-9857-44f8-bc1f-32a1e52f0d8b”,\n “IpAddress”: “35.174.4.81”,\n “PlayerId”: “Player 2”,\n “PlayerSessionId”: “psess-be6b9a35-ca74-4d58-9972-956a6a730e28”\n}
yum install unzip
Heroku
Agones
Dedicated Game Server Hosting and Scaling for Multiplayer Games on Kubernetes https://agones.dev
https://github.com/GoogleCloudPlatform/agones
Linode
https://manager.linode.com/linodes/add
Digital Ocean
Azure
https://azure.microsoft.com/en-us/solutions/gaming/#related-products
GCP
Google App Engine
https://cloud.google.com/appengine/
https://cloud.google.com/docs/games
GCP - Agones
https://www.youtube.com/watch?v=jEd3nfjKlCs
https://www.youtube.com/watch?v=XD1nuASFY3k
https://www.youtube.com/watch?v=CLNpkjolxYA
https://www.youtube.com/watch?v=Fro1IEbiqAY&list=PLIivdWyY5sqKICqivS8r25vm_tskHanqu
https://github.com/googleforgames/agones
Payment Systems
https://xsolla.com/products/paystation
Courses
Paid Courses
Fundamentals of Multiplayer Development in Unity
References
General Networking
Firebase vs Playfab vs Gamesparks
https://forum.unity.com/threads/firebase-vs-playfab-vs-gamesparks.451840/
Unity Networking uNet
https://docs.unity3d.com/2020.1/Documentation/Manual/UNet.html
https://docs.unity3d.com/Manual/UNetLobby.html
https://docs.unity3d.com/Manual/MobileNetworking.html
https://docs.unity3d.com/Manual/UNetClientServer.html
Unity Connected Games
Connected Games: Building real-time multiplayer games with Unity and Google - Unite LA
Multiplayer In Unity3D - The REAL Options? NEW unity networking & more?
Games
PUN
http://undertheweathersoftware.com/multiplayer-network-solutions-for-unity-photon-and-playfab/
https://unity3d.com/unity/features/multiplayer
https://answers.unity.com/questions/690123/where-to-start-with-real-time-multiplayer.html
https://www.theseus.fi/bitstream/handle/10024/136944/Ahde_Jani.pdf?sequence=1&isAllowed=y
Google Play
https://www.youtube.com/watch?v=fM87eDzhalc
Building a Scalable Multiplayer Backend in 5 Minutes
https://www.youtube.com/watch?v=3uqMdsrpzEU
Unite Europe 2016 - Building a PvP focused MMO
https://www.youtube.com/watch?v=x_4Y2-B-THo
Unite Europe 2017 - Photon vs UNet: multiplayer architecture explained
https://www.youtube.com/watch?v=Y1my5bKhKJY
Photon Auth Server
https://doc.photonengine.com/en-us/server/current/reference/authoritative-server
https://en.wikipedia.org/wiki/Game_server#Dedicated_server
Firebase
https://firebase.google.com/games
Improbable (SpatialOS)
https://improbable.io/multiplayer-networking
Chronicles of Elyria is dropping virtual world platform SpatialOS
https://massivelyop.com/2018/01/12/chronicles-of-elyria-is-dropping-virtual-world-platform-spatialos/
Chronicles of Elyria
https://www.chroniclesofelyria.com/
“I want the industry to believe in online games again,”
Socket.io
https://socket.io/docs/using-multiple-nodes/
https://redis.io/topics/pubsub
https://stackoverflow.com/questions/38701647/scalable-architecture-for-socket-io
https://www.quora.com/How-do-I-scale-socket-io-servers-2
https://blog.jayway.com/2015/04/13/600k-concurrent-websocket-connections-on-aws-using-node-js/
http://buildnewgames.com/real-time-multiplayer/
http://buildnewgames.com/websockets/
http://buildnewgames.com/optimizing-websockets-bandwidth/
https://github.com/socketio/socket.io
https://stackoverflow.com/questions/14754431/multiple-dynos-on-heroku-socket-io-broadcasts
https://stackoverflow.com/questions/11064826/using-socket-io-and-redis-on-heroku-with-node-js
https://socket.io/docs/using-multiple-nodes/
https://devcenter.heroku.com/articles/session-affinity
https://elements.heroku.com/buttons/heroku-examples/node-socket.io-chat-redis
https://elements.heroku.com/buttons/heroku-examples/socket.io-whiteboard
https://blog.heroku.com/session-affinity-ga
Unet vs Photon Engine - A comparison
https://www.reddit.com/r/Unity3D/comments/9hzkk7/no_good_way_to_do_authoritative_server/
Testing
https://www.artillery.io/docs/guides/guides/socketio-reference