How to Setup Dedicated Server Hosting and Matchmaking for Unity

Uploaded by samyam
Share: Twitter Facebook
?Get the Source Code?
https://www.patreon.com/posts/82134830

If you liked this video please like and subscribe as it helps me a lot, and consider joining my Patreon or becoming a YouTube Member :)

►Check out the Previous Video
The Ultimate Multiplayer Tutorial for Unity - Netcode for GameObjects
https://youtu.be/swIM2z6Foxk

⚙️ Set Up ⚙️
►Multiplay
ᐅcom.unity.services.multiplay
►Matchmaker
ᐅcom.unity.multiplayer.tools
►Multiplay Launch Parameters
ᐅ-ip $$ip$$ -port $$port$$ -queryport $$query_port$$ -logFile $$log_dir$$/Engine.log -dedicatedServer -batchmode -nographics

If the client ticket times out, make sure you are connected to Unity Services in the Editor (Project Settings ᐅ Services). Sometimes it disconnects you and you need to click "Retry Connection".

?Video Links ?
►Unity Multiplay Documentation
ᐅhttps://docs.unity.com/game-server-hosting/en/manual/welcome
►Unity Matchmaker Documentation
ᐅhttps://docs.unity.com/matchmaker/en/manual/matchmaker-overview
►Game Engine Best Practices (Contains the TargetFPS Script)
ᐅhttps://docs.unity.com/game-server-hosting/en/manual/guides/game-engine-best-practices
►Your Unity Dashboard
ᐅhttps://dashboard.unity3d.com/
►Multiplay Launch Parameters
ᐅhttps://docs.unity.com/game-server-hosting/en/manual/concepts/launch-parameters
►Unity Command Line Arguments
ᐅhttps://docs.unity3d.com/Manual/EditorCommandLineArguments.html
►Matchplay: A Matchmaker and Multiplay sample
ᐅhttps://github.com/Unity-Technologies/com.unity.services.samples.matchplay

In this video I cover how to upload your multiplayer game build to Unity Gaming Services (UGS) Multiplay, which will act as a scalable dedicated hosting platform with minimal setup needed. Then we will go over Matchmaker, a way to easily connect players together and host a match.

Before uploading to UGS Matchplay, we need to create a Dedicated Linux Server build of our game in Unity. For this we create a script to read the command line arguments passed to the game and determine if the build is the server. It is also recommended to set the target frame rate and disable v-sync.

In UGS, we will then create a build, a build config with our launch parameters, a fleet which will determine where our server will run, and then test it with a test allocation. We also enable Matchmaker within our project. Then back to Unity, we write some boilerplate code to connect our game to UnityGamingServices using the ip and passed in port, then find a matchmaker allocation which spins up a server. We also enable backfill to support players joining the match after it has started. On the client side we write a separate script where the client is signed in anonymously, enables UnityGamingServices, then tries to fill their matchmaking ticket to be assigned to the match. At the end of the video we also fix some bugs that become apparent when hosting the game on the UGS dedicated server platform.

? Support Me ?
Patreon: https://www.patreon.com/samyg
Donate: https://ko-fi.com/samyam

►⏱️ Timestamps ⏱️
0:00 Intro
1:12 Game Showcase
2:47 Multiplay Terms
6:14 Set Up Build for Multiplay
31:30 Set Up Matchmaker
45:29 Matchmaker Server Script
1:24:56 Matchmaker Client Script
1:46:19 Replace UGS Build
1:48:57 Bug Fixing
1:55:42 Outro

??THANK YOU TO ALL MY PATRONS ??

❯❯❯ My Links ❮❮❮
? Patreon ?
https://www.patreon.com/samyg
? Discord Server ?
https://discord.gg/SwCKB3Q
? Twitter ?
https://twitter.com/samyam_youtube
? Facebook ?
https://www.facebook.com/samyam.youtube/
? Like and Subscribe! ?

?️ Computer Setup ?️
*As an Amazon Associate I earn from qualifying purchases.
https://www.amazon.com/shop/samyam

►Gameplay Videos Shown:
ᐅ10 Brand NEW Multiplayer Games Trying Something NEW
https://www.youtube.com/watch?v=mfcOf3Bc108
ᐅ15 Great Couch Co-Op Games to Play w/ Your Friends
https://www.youtube.com/watch?v=3OSY0iWV53s&t=1s
ᐅMario Kart 8 Deluxe - All New DLC Courses (DLC Booster Pack 1) (4K)
https://www.youtube.com/watch?v=J0xw8S5PpCg

#unity3d
#gamedev
#multiplayer