How to Setup Dedicated Server Hosting and Matchmaking for Unity

preview_player
Показать описание
Lean how to use Unity's UGS tools to host a dedicated game server and implement matchmaking.

ᐅGet the full Source Code Bundle to my Unity Tutorials 🤓

📥Get the Source Code📥

Wishlist my new game BUMBI on Steam!

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

⚙️ Set Up ⚙️
►Multiplay
►Matchmaker
►Multiplay Launch Parameters

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
►Unity Matchmaker Documentation
►Game Engine Best Practices (Contains the TargetFPS Script)
►Your Unity Dashboard
►Multiplay Launch Parameters
►Unity Command Line Arguments
►Matchplay: A Matchmaker and Multiplay sample

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 🤝

►⏱️ 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 💗
💬 Discord Server 💬
🐦 Twitter 🐦
📚 Facebook 📚
👍 Like and Subscribe! 👍

🖥️ Computer Setup 🖥️
*As an Amazon Associate I earn from qualifying purchases.

►Gameplay Videos Shown:
ᐅ10 Brand NEW Multiplayer Games Trying Something NEW
ᐅ15 Great Couch Co-Op Games to Play w/ Your Friends
ᐅMario Kart 8 Deluxe - All New DLC Courses (DLC Booster Pack 1) (4K)

#unity3d
#gamedev
#multiplayer
Рекомендации по теме
Комментарии
Автор

like and subscribe because i spent way too long on this

samyam
Автор

This is the first tutorial I’ve watched in my six years of game development that I implemented in my own project without encountering any errors. I’ve never experienced that before! I loved that she explained each function of the code in detail. Thanks for the great tutorial!

piotrgora
Автор

Not all angels have wings, thanks for the effort, I have been stuck for a few days due to not having a clear tutorial on how to set up the GSH in your code, thanks again

tranhoangmih
Автор

"so you're making a multiplayer game and you actually want to have people join your game?"

andrey
Автор

I followed this today and got my multiplay working first try (except for a line with args string array declaration) Thank you so much!

mingoms
Автор

Thank you!!! You are the best Unity teacher!😁
samyam's videos are always trustworthy. She provides systematic explanations based on her deep knowledge
Thank you so~ much!
It really helps. You are my lifesaver🤗

최영수-rm
Автор

thank you so much for this and the other tutorial. I really like the midsection explanations of concepts and the walk through of the code. this definitely is helping me understand and prepare for my final project.

erickpeculiar
Автор

Amazing video, thanks so much for putting this together! I just joined the UGS team and used this as my onboarding, lol. I know it was long so I appreciate the effort you put into it :D Great stuff!

JadenGoter
Автор

amazing video thanks for all the help! Wish a video like this could recieve 1m views but its a niche.

nightnamer
Автор

components:
servermanagerobj: 20:20
clientBttn obj : 1:24:00

erickpeculiar
Автор

Awesome tutorial ❤, was wondering how to deallocate the server upon all players exiting the server.

omarbenjdidia
Автор

Just in case anyone else is having issues with backfill when testing with multiple parrelsync clients in 2024 after following the tutorial step by step - build and run your game as standalone and then test while running one client as standalone and one in the Unity editor. I found for me backfill would not work with multiple parrelsync clients. Instead it just started new servers for each parrelsync client

rexbefall
Автор

Love your voice mam .. i am familiar with English but your voice is easy to understand

theparashari
Автор

thx you have the best tutorials form all :D

JFx
Автор

This tutorial is amazing.
Really appreciate the effort 👏.
Are you planning to make a video on cloud content delivery?

PawanRamnani-rb
Автор

thank for this knoledge, i feeel that will be very helpful

wicgamesdev
Автор

Thanks for the amazing tutorial.

Are you using Netcode? Or you made your own custom server-clinet networking solution? I wanna make my own using websocket-sharp, by I dont know anything about hosting, scaling and pretty much anything else about hosting a backend server tbh.

sadiqabbaszade
Автор

I'm trying to understand/estimate the billing on UGS. I remember once doing a tutorial on Amazon Web Services and was charged over $600 for one month because I wanted to take a course. I don't want a similar experience on UGS.

SolarSoftMedia
Автор

hey thanks worked so well!! how do you open your game in two diffirent editor windows ? thanks!

dxlorean
Автор

could you may make an tutorial how to combine this with an main menu and an waiting for players scene? this wuld be extremle helpfull :)

JFx