❤ Watch my FREE Complete Multiplayer Course kzbin.info/www/bejne/bZjPdKZ8bsupadU 💬 This was one of the most requested UGS tutorials, I hope you find it useful! Best of luck with your Multiplayer games! ✅ Learn more about Lobby and UGS on.unity.com/3XdKEd7 🌍 Get the Project Files unitycodemonkey.com/video.php?v=-KDlEBfCBiU 📝 Lobby Docs on.unity.com/3OtC0Du 🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses 👍 Learn to make awesome games step-by-step from start to finish. 🎮 Wishlist my Next Steam game! cmonkey.co/totalworldliberation 🔴 RELATED VIDEOS 🔴 COMPLETE Unity Multiplayer Tutorial (Netcode for Game Objects) kzbin.info/www/bejne/aarYc4J4aLulec0 Multiplayer through FIREWALL with Relay! (Unity Gaming Services) kzbin.info/www/bejne/o6Szf31omN2KnNk What is Unity Gaming Services? kzbin.info/www/bejne/gKimnXaZZ8SteZo EASY Console! Run any Command! (Add Cheats, Set Gravity, Spawn Enemies Quantum Console Asset Review) kzbin.info/www/bejne/mIDJZ3agpdqGfNU Simple Text Input Field Window in Unity (Submit Score, Name) kzbin.info/www/bejne/ap-Zg4duZZqlecU
@coryscustominstalls7168 Жыл бұрын
I found myself returning to this video often to refresh my memory when building my lobby I wrote down all the time stamps to the sections maybe some one can also use these... 1:54 install packages 2:06 setup services 3:08 script creation / service initialization 5:46 create lobby 8:18 search for lobbies 11:17 implement lobby heartbeat 13:22 add filters to search for lobby 16:55 join lobby by id 18:48 creating lobby options 20:12 join lobby by code 21:16 quick join lobby 23:48 print players 28:06 player creation refactoring 32:33 update game mode 37:30 handle update polling 39:56 updating player names 41:34 leaving lobbies 42:40 kicking players 44:40 transfer host 46:02 deleting lobbies
@JohnGamble10 ай бұрын
Thank you! I have referenced this video countless times while implementing Lobbies in my game. It would be great if these were added as chapters to the video.
@NedjmouBlaxword738 ай бұрын
Thanks
@eze-cs2 жыл бұрын
As someone who's been working with Unity professionally, you never cease to give really great reference to new services and quick implementation, keep up the hard work!
@CodeMonkeyUnity2 жыл бұрын
Thanks for the kind words! I'm glad you found the videos helpful!
@arvydazo420311 ай бұрын
when lobby host left the lobby, for example wifi disapears or game crashes, lobby disapears after 30s from the list, but players in lobby stays endefinetely with no warning that lobby no more exist. is there a way to change lobby owner when original owner is offline?
@RicardoSanchez-es5wlАй бұрын
@@arvydazo4203I think host migration is in unity 6
@TheAsbj0rn Жыл бұрын
I have returned to this video approximately 20 times over the last three weeks. It is amazing, giving only what we need and no confusion. I'm actually using what I learn to develop a unity package that incorporates everything here with steam, automatically setting player icons and names and such. Thank you very much for this tutorial, it would have taken me months without
@CodeMonkeyUnity Жыл бұрын
I'm glad the video has helped you! Best of luck with your game, thanks!
@ezrahuffman Жыл бұрын
Just a note in case some is facing the same issue. If you are using the editor to test (I am using parrellels sync package), the heartbeat might stop when you unfocus the editor window. You can change it in Edit -> Project Settings -> Player -> Resolution and Presentation -> Run In Background. Also the anonymous login will create the same id for both players when logging in by default. You can either clear the session tokens or use different profiles to get around it.
@SzaboB332 жыл бұрын
I just started game developing and it seems like all my ideas that I am excited about are all multiplayer, seems like I timed my start right, thank you for these valuable videos!
@CodeMonkeyUnity2 жыл бұрын
Heh nowadays making multiplayer games is easier than ever so that's great timing! I remember when I added Multiplayer to my first Steam game, I had to build the entire Lobby Master Server infrastructure from scratch myself, it was very painful and very easily broken. Really awesome that nowadays there are all these tools you can easily use!
@ergicela4420 Жыл бұрын
@@CodeMonkeyUnity does a multiplayer game cost , or how much you need to spend to create a multiplayer game by your self?
@phlips8254 Жыл бұрын
@@ergicela4420 The lobby system in this tutorial is done with the base Unity system and is free as long as you don't use too much data (unless you have a lot of players this won't happen), then the hosting of the server is done by the player that is the host of the lobby. Because of this you don't need to run your own servers and the entire system is free to use. So no you don't have to pay to add multiplayer
@sir.niklas2090 Жыл бұрын
Honestly Multiplayer is still difficult get some practice in, not years but just understanding.
@zanuka97656 ай бұрын
If like me you're a newbie and get the error : "player is already a member of the lobby" while trying to join a lobby from different instances of the game, you have to find a way to differentiate the two players (host and client). One way is to change your authentication method like this : private async void Start() { var options = new InitializationOptions(); options.SetProfile("Player" + Random.Range(0, 1000)); await UnityServices.InitializeAsync(options); //
@Wonder_Verse_Tech2 жыл бұрын
Was going to sleep, code monkey's notification came, so I am here ... Postponed sleep for next 52 minutes 😁
@CodeMonkeyUnity2 жыл бұрын
Heh don't worry, the video will still be here in the morning!
@Wonder_Verse_Tech2 жыл бұрын
@@CodeMonkeyUnity 😅Yeah , But you can understand the passion for game Devs .
@padamgupta69412 жыл бұрын
@@CodeMonkeyUnity अरे कुछ नहीं मंकी भाई यह सो गया था तुरंत ही मेरा रूममेट है ये
@Wonder_Verse_Tech Жыл бұрын
@@padamgupta6941 abe 🤣 ... Accha screenshot lagane ki wjh se dhundh liye tum... Bhkk...
@magnushlund Жыл бұрын
Legend says that he still hasn’t slept. Been watching codemonkey nonstop ever since.
@durvesh0072 жыл бұрын
Really appreciate this detailed explanation 👍
@captainnoyaux2 жыл бұрын
I'm working on the multiplayer version of my game, nearly finish this is coming at the right time :D Thanks a lot
@Neo-Meo-X2 жыл бұрын
This is more than an amazing tutorial. thanks for sharing this. Looking forward to watching more multiplayer tutorials!
@roubatov2 жыл бұрын
Yes Code Monkey, YES! I'm working on a VR artwork which uses multiplayer, but I had no idea how to setup the lobby, but with this everything is working just fine! Thank you for everything and good luck with the rest!
@racistpixel101711 ай бұрын
how dud you made so all the players would be spawned to gameplay scene ?
@Nounsi_Dev7 ай бұрын
@@racistpixel1017 have to make it work with netcode for gameobject
@alexdev447 Жыл бұрын
Love your content. This is the best way to learn new concepts as opposed to reading documentation and thousands of lines of code in example projects. Your videos are extremely helpful and you saved my ass countless times. Thanks!!
@evanstaylordigital8232 Жыл бұрын
Awesome video. I have come back to this several times while prototyping my own lobbies implementation. Would be super helpful if you included chapters!
@arvydazo420311 ай бұрын
when lobby host left the lobby, for example wifi disapears or game crashes, lobby disapears after 30s from the list, but players in lobby stays endefinetely with no warning that lobby no more exist. is there a way to change lobby owner when original owner is offline?
@lemetamax2 жыл бұрын
Yeaasss! Will watch early tomorrow morning. This video's thumbnail gave me a game idea: a superhero game with Code Monkey as the titular character.
@CodeMonkeyUnity2 жыл бұрын
Heh that would be fun!
@kpr24 ай бұрын
I always appreciate your tutorials & this one's making all of this seem far easier than I'd have expected. Keep the great stuff coming!
@CodeMonkeyUnity4 ай бұрын
Not sure what timestamp you're referring to, what two different variables? You mean lobbyName and maxPlayers? It's to avoid using magic numbers kzbin.infoCQ5xHgRZGQo Sure, you can use a coroutine instead of a float timer. Personally I prefer float timers because I dislike the cumbersome structure that coroutines force you to use. You need a MonoBehaviour, need IEnumerator, need yield return, need StartCoroutine(); whereas with a float timer you just have a simple number. But that's just personal preference.
@kpr24 ай бұрын
@@CodeMonkeyUnity Apologies. By the time I got to the end of the video it more or less made sense & I edited the comment, haha 😆. I was referring in particular to the lobby, hostLobby, and then joinedLobby variables. For the sake of "safety", I followed most of your instructions, though I did swap out the Update timers for coroutines as I'm just used to them. My head's swimming a bit as the last 20 minutes of the video really ramped things up a notch, but I was able to keep up well enough & everything looks good! I'll certainly be grabbing your project files to check for reference as I'd like to see how you implemented the UI functionality, particularly for kicking players & such. Thanks so much for all of the amazing tutorials (and I always use Codemonkey10 at checkout now, so many additional thanks for that, too). You rock! \m/(>.
@AntAptive Жыл бұрын
Could you possibly make a tutorial on how to make the UI for the lobby and how to connect it to this? I've followed this tutorial but I'm not quite sure how to do that. The main problem I'm having is I'm not quite sure how to get the names of the players in the lobby, but I see you set it up to do that in your UI. Regardless, thank you for making these tutorials for us!
@alec_almartson2 жыл бұрын
Awesome. 👍🏻😁 You made it look easy... which is the Best a Teacher can do. I will try it on my future Prototype. Thank you for making this video. 😄✌🏻
@Crazytm242 жыл бұрын
This is exactly what I needed, thank you!
@notlaw15672 жыл бұрын
Thanks for showcasing this package. As always a really useful tutorial! It gave me thoughts about if this is how channels are implemented in mmorpg's.
@JasonLovettGameDev2 жыл бұрын
This was gold! Literally just made my entire lobby system for my game just following along
@CodeMonkeyUnity2 жыл бұрын
Nice! Best of luck with your game!
@JasonLovettGameDev2 жыл бұрын
@@CodeMonkeyUnity Thanks man! Appreciate it!
@captainnoyaux Жыл бұрын
@@CodeMonkeyUnity Same ! Thanks a lot I'll definitely support you when my game generates more money !
@potatogod3882 Жыл бұрын
how did you made so lobby players would be transfered to actual gameplay scene?AC
@hralpuh Жыл бұрын
Im also trying to work that out, and have been through several days... when I download the project files they seem to be a bit broken, so its hard to figure out how the UI gameobjects should be constructed.
@bloobyjoobyjoob89492 жыл бұрын
Yus! This is exactly what I needed! Any chance you could do Vivox next?
@CodeMonkeyUnity2 жыл бұрын
Yup it's on my list to research
@bloobyjoobyjoob89492 жыл бұрын
@@CodeMonkeyUnity yus thanks you so much
@S_Tadz Жыл бұрын
Note that if the 30 seconds lifeapan of the lobbies bugs you, it can be changed via the UGS dashboard up to an hour (3600 seconds). Probably negligeable, but helps send less data, which is always good.
@CodeMonkeyUnity Жыл бұрын
Oh that's interesting, I don't remember seeing that, must be a nice recent addition
@arvydazo420311 ай бұрын
@@CodeMonkeyUnity yas but lobby host leaves the loby, noone can connect to that lobby and it just stays there in the list with ghost players
@josephderosa55692 жыл бұрын
Yes!!! UGS tutorials are amazing! Thank you so much! Can you please make one for Unity Game Server? I cannot find it anywhere on the net outside of docs and a video showing a practical example would be extraordinarily helpful, not just to me but to MANY others.
@CodeMonkeyUnity2 жыл бұрын
Yup Game Server Hosting (Multiplay) and Matchmaker are two other tools I want to research
@devonn62 жыл бұрын
Finally ...😍😍 You are awesome!
@sir.niklas2090 Жыл бұрын
Yall, just a tip don't name your script "Lobby" since its a keyword it will give you head aches... :D
@afrikaansedude25257 ай бұрын
I knew i shouldn't name i Lobby but yet still my smooth brain did exactly wat i told it not to do..😂
@jaa51973 ай бұрын
You also can't name Players "Player" because Player already exists in the lobby package
@o2dyt Жыл бұрын
Amazing tutorial. I followed along and got everything working. Thank you!
@Hhuxx1 Жыл бұрын
the Join player using Id didnt work is something wrong?
@o2dyt Жыл бұрын
@@Hhuxx1 Hey! What's the error?
@Hhuxx1 Жыл бұрын
@@o2dyt Id didnt exist
@MrMrn872 жыл бұрын
I would love some insight in Steam intergration with Unity Multiplayer Networking
@RigidDecay2 жыл бұрын
Thanks so much for making this man, I’ve been waiting 😅
@GreazyController2 жыл бұрын
Yes, finally a great tutorial on this!
@rootbindev2 жыл бұрын
i love your multiplayer tutorials
@lilbaby4PF11 ай бұрын
If you are new to unity these tutorials will be somewhat challenging , Because he's using his custom UI stuff instead of unity built in stuff. These tutorials can be simplified a lot.
@CodeMonkeyUnity11 ай бұрын
What custom UI stuff? I'm not even using any UI for the most part of the tutorial, only made a custom demo for the end
@jaybehl75673 ай бұрын
@@CodeMonkeyUnity how can I switch to the game scene for everyone after creating the relay? Please respond this has been bugging me for the past several weeks
@klevialushi5712 жыл бұрын
This video was needed since i was thinking of implementing the same thing in a 2d game that im making, thanks!
@stefancc839 ай бұрын
Super cool video. How did you manage to run 2 builds in Unity? Thanks!
@CodeMonkeyUnity9 ай бұрын
They're not both inside Unity, only one is in Unity the other one is a standalone build
@somegamer7958 Жыл бұрын
Couple of minor changes I'd make - using multiple lobby variables is a bit confusing. You really just need one. Switching them back and forth isn't necessary since one client is going to be be a part of one lobby at a time. Also, logging into a lobby via code. I think for a tutorial it makes more sense to log in by lobby Id, because that's a value you can actually get. Only the host of the lobby gets access to the lobby's code.
@CodeMonkeyUnity Жыл бұрын
What do you mean multiple Lobby variables? There's just one member variable which is set whenever a function changes it, you need to do that since the variable won't update by itself. If you want to see it as part of a complete game I used this in my complete course kzbin.info/www/bejne/bZjPdKZ8bsupadU
@Yasser-Dev2 ай бұрын
The Greatest Of all times ❤ Thanks for your efforts and I hope you’ll see my comment (Your biggest fan yasser)❤
@CodeMonkeyUnity2 ай бұрын
I'm glad the video helped you!
@Synith192 жыл бұрын
Wooooo another multiplayer video!
@SuperKREPSINIS11 ай бұрын
i have small issue. im using your lobby assets you provided. when player leaves lobby or relay. or shuts down game completely, he stays in the lobby and cant reconect. when im testing lobby always says it has two players, so the host and testing build. i also keep lobby on dontdesroyonload when moving to gameplay scene, just to keep lobby active for new players to join, but i dont think it makes this problem. also in dashboard in lobby i changed so if player is disconected for 10 seconds, he would be removed from looby, it was set on 2 minutes, and still it doesny work, players stays in the lobby no mater what.
@mohamedmusthafa105711 ай бұрын
Developer's Gem ❤
@Lifeport-z Жыл бұрын
How would I implement this into vr?
@s1m1ng7on Жыл бұрын
I have a question - as you said in this video, using netcode for game objects, relay and lobbies makes for a seamless multiplayer experience. What is the right video to start watching in order to do that? I don't really understand how they differ and how they work together.
@CodeMonkeyUnity Жыл бұрын
Each of the videos focused on each tool. This one is the lobby video Here is the Relay unitycodemonkey.com/video.php?v=msPNJ2cxWfw And NGO unitycodemonkey.com/video.php?v=3yuBOB3VrCk
@playnowgaming46282 жыл бұрын
Really helpfully video and appreciate your work bro ❤
@jean-michel.houbre Жыл бұрын
Good afternoon! In anticipation of the looby part of the "Learn Unity Multiplayer" video, I just finished the "Making a MULTIPLAYER Game? Join your Players with LOBBY!" video, a very clear and very informative video as usual. Thank you for the passage concerning the prices, I had already read it, but it is reassuring for a non-English speaker to have an additional interpretation. I have many qustions : a) when all players leave the lobby, we get a bunch of errors in the console: - [Lobby]: LobbyNotFound, (16001). Message: lobby not found - HttpException`1: HTTP/1.1 404 Not Found How to manage them? b) I didn't understand why we have 2 lobby variables (hostLobby and joinedLobby). We only have one lobby, don't we? c) At 47:20, you have a using Unity.VisualScripting clause. This happened to me from time to time, and I got into the habit of uninstalling several packages installed by default by Unity: VisualScripting, Visual Studio Code Editor and JetBrains Rider Editor. I have the impression (at 90%) that Visual Studio offers me fewer functions for autocompletion. I would like it to be automatic, but I admit that my first attempts were not convincing :) Thank you very much for this video !
@jean-michel.houbre Жыл бұрын
Connection with Codemonkey lost ... I hope you're doing well.
@davidwusoftdev Жыл бұрын
For (a) you would need to set the lobby to null in the catch section of the code, so that the Update function stops the heartbeat to an already deleted lobby. For (b) you can probably modify the code to only use joinedLobby. I'm guessing CM uses two different variable names for teaching clarity. I have no idea about (c). If you don't need that reference in your code, just delete the line. You should keep Visual Studio Code Editor package if you're using the VS IDE to write your code though, I think it's needed for proper integration. Good luck!
@jean-michel.houbre Жыл бұрын
@@davidwusoftdev Thanks!
@emberdragons8244 Жыл бұрын
Thanks, that was really helpful
@rajsah46672 жыл бұрын
🤩 great tutorial
@designer.trifonov Жыл бұрын
Its super lesson! Thanks! :)
@DP_12 жыл бұрын
thank you, you helped me a lot 😲🙂
@connerreynolds6142 Жыл бұрын
Great tutorial very clear! Did you make a video on how to transition from the lobby scene like the one you created to the actual multiplayer gameplay scene?
@CodeMonkeyUnity Жыл бұрын
You can just sync some Lobby data, set it to 0 by default then set it to 1 when you wnat to start the game, that's waht I did in my complete game kzbin.info/www/bejne/bZjPdKZ8bsupadU
@davidgauffindahlin6982 жыл бұрын
You are the best
@JesseTheGameDev Жыл бұрын
I'm getting a bug when I run my game in a standalone build that causes the player to never leave the lobby if I close the game while still inside it. I can force leave the lobby, but closing the game seems to leave the lobby open forever. Any experience with this bug or an idea on how to fix it? UPDATE: I think calling delete lobby or remove player from lobby from OnApplicationQuit works, but only if you don't do it asynchronously (so no async/await in the call).
@LegendaryCombatForce Жыл бұрын
How to add search bar so that many players playing the game have option to search the name of any player and add him as a friend instead of lobby
@mjkkaya6056 Жыл бұрын
How do you achieve to show so many features in a single video? This is awesome!
@Maskedmous2 жыл бұрын
Lobby services with 10 gb is neat. Free authentication, remote config and cloud storage. Relay services however can become quite costly**. let's say your game is $15. 30% goes to steam, $5 for simplicity. Then you have your own take of $5. The rest $5 goes back into the game. which means ($5 / $0.16) / 12 ≈ 2,6 years. After that you're paying it yourself to support your own games networking. By then you require another monetization feature just to keep the game running. Or revert back to Direct IP which is troublesome for most players to set up. Most of them don't even know how to access a router / modem let alone configure it for some game. I'm ignoring bandwidth here, but that also is quite costly when you go above 150 gb of data. Multiplayer is great, just not the costs that come with them. ** Sure there are caveats and this calculation is a worst case scenario 100% playtime. It still feels expensive. Perhaps my view on it is too extreme.
@CodeMonkeyUnity2 жыл бұрын
Your math is a bit confusing, you're assuming every single player will be online at the exact same time playing 24/7 for 2.6 years, that is an extreme scenario that doesn't really ever happen. Remember it's Concurrent users, not just Users. As an example, my own game Battle Royale Tycoon, which was a decently successful release (for an indie dev) only had a single month above 50 CCUs with 75. So if the game was multiplayer it would have costed me $4 while it sold over $100,000 So to me the math seems really good. If you have thousands of CCUs then your game is a mega-hit which sold hundreds of thousands of copies and those players will not play 24/7 for 2 years.
@Maskedmous2 жыл бұрын
@@CodeMonkeyUnity That makes a lot more sense. Like I mentioned with the '**' Worst scenario with 100% playtime. But you're right not everyone will play every day for 2 years long. Thanks for explaining
@muerrtee Жыл бұрын
i am getting this error while setting up the lobby system Error CS0029 Cannot implicitly convert type 'Unity.Services.Lobbies.Models.Lobby' to 'Lobby'
@CodeMonkeyUnity Жыл бұрын
Did you name your class Lobby?
@muerrtee Жыл бұрын
@@CodeMonkeyUnity yep i named it the same took me a while to realize now everything works totally fine thanks the tutorial is really good
@harsimargawri8113 Жыл бұрын
I have a question about constructors and initialisers, like at 31:08, u have used curly brackets to pass in the arguments for createLobbyOptions, but on the other other, in some cases, just normal round brackets are used for passing in arguments. How does it exactly work? Thanks for the help!
@CodeMonkeyUnity Жыл бұрын
It depends if the constructor has parameters or not. But regardless of whether it does or not you can always use curly brackets to set public fields
@-Bill-Clinton- Жыл бұрын
awesome tutorial!
@CodeMonkeyUnity Жыл бұрын
I'm glad you liked it! Thanks!
@OneTime_12 Жыл бұрын
I understand you mentioned how to make the players on team, but it would be great for you to show us. Im not that good of a coder and im lost most of the time. Anyway to make a video on selecting team both manual and random, adding friends, creating parties, thing like that. Seems like alot for me but it might not be that big of a task for you. Thanks even id you say no lol !!
@SMORIGINALS2 жыл бұрын
My this question is out of this video---- Q- concept of making jungle marble blast game....how is work....? Could you make any video for this....?
@Steve-gi2yj7 ай бұрын
question, @CodeMonkeyUnity, you mentioned that its better to create the game as one package, server, host and client... i am planning on making a mobile game... not sure if I should create the "Server" version first, then convert it to or switch type to Mobile after creating the server version... so the client can be mobile.. your thoughts? hoping to do a Dedicated server hosting for unity to host.
@sadryan4013 Жыл бұрын
Anyone else having an issue where the player class exist but also doesn't exist at the same time?
@poisht8536 ай бұрын
Thank you for the video!! I have realized one thing that happens sometimes. It might have to do with the fact that most of the code here are async code that when I stop playmode (from testing), time and after the scene changes when exiting playmode - (aka is different to what it was before starting play mode)... usually this is fine as reloading the same scene by clicking in the scene from the project in the editor restores it to what it was before... But I was wondering if this could happen for a build as well? because I had a few times where the camera was getting disabled for no particular reason when exiting playmode and this would be really bad if it happens in a build and remains that way...
@lazarbecic2199 Жыл бұрын
Thanks a ton!
@arsalanasif835411 ай бұрын
Loved the video! Just wanted to ask, why don't you like coroutines? I thought it was standard procedure to keep most of your logic inside coroutines and functions.
@CodeMonkeyUnity11 ай бұрын
Personally I don't like the pattern they force you to use. You need to use a MonoBehaviour, you need to StartCorouting(), you need to make a function that return IEnumerator, you need yield return I find that whole pattern to be needlessly convoluted. But they work perfectly fine, so if you like them then by all means use them
@arsalanasif835411 ай бұрын
@@CodeMonkeyUnity Those are definitely valid reasons. I guess I'm just more used to them now. Find it much easier to hold execution and sync with fixed updates in coroutines. Just wanted to know if I was missing something here.
@VladaPersonal Жыл бұрын
This great tutorial could really use chapters.
@linkrider2302 Жыл бұрын
My question is, I managed to connect, how can I switch to the game scene and how can I host it in the lobby via netcode? Or is it automatic?
@andrubaskara487910 ай бұрын
Hi, have you found the solution?
@jaybehl75673 ай бұрын
update please
@RoffeDH Жыл бұрын
I can't even get past the intro before I get an error I can't find a resolution for: "Cannot implicitly convert type 'Unity.Services.Lobbies.Models.Lobby' to 'Lobby'" The code: Lobby lobby = await LobbyService.Instance.CreateLobbyAsync(lobbyName, maxPlayers); I even copied it directly from the website and still got this error. What am I doing wrong? I've added all the exact same "using" at the top of the script even.
@CodeMonkeyUnity Жыл бұрын
Sounds like you already defined a class named Lobby in your project
@RoffeDH Жыл бұрын
@@CodeMonkeyUnity fuck... I did 😅 every time', the simple and easy babe is already taken and I spend days to try and figure out why it didn't when. Thanks!
@im_an_intern_unity_dev2 ай бұрын
haha u saved me
@UnityDevJOY Жыл бұрын
I'm using ParrelSync to quickly test the game in another Unity Editor. But by doing this, the second player is assigned the same ID at the start. This means that I keep on getting the error "LobbyConflict, (16003). Message: player is already a member of the lobby." when trying to join. Is there any workaround?
@CodeMonkeyUnity Жыл бұрын
You need to use a different name when Authenticating when running on the same machine, just like I added a input window to give each build a different name.
@UnityDevJOY Жыл бұрын
@@CodeMonkeyUnity Hello! I found a solution right after typing the comment but I think it got automatically deleted because I put a link in it. I used authentication profiles to isolate my players. Here is my Start function: private async void Start() { var options = new InitializationOptions(); playerName = "Player_" + Random.Range(10, 99); options.SetProfile(playerName); await UnityServices.InitializeAsync(options); This way, each player gets assigned an unique ID.
@DiegoAtravesar Жыл бұрын
@@UnityDevJOY Just want to throw a quick shout out here, I ran into this exact issue on my end during my testing and this helped me resolve it!
@theplaymakerno1 Жыл бұрын
Can you explain this? Where do you actually do this?@@CodeMonkeyUnity
@Ionixification2 жыл бұрын
Ur awesome man
@goldenapple80110 ай бұрын
Is there any more detailed description on how you created the lobby UI? I have watched your other videos but still do not manage to replicate it.
@ozalpm Жыл бұрын
You are a lagend!
@jonbruenderman3 ай бұрын
Is it possible to use this lobby setup, then on start, spin up a dedicated server? I setup matchmaking, but now I want to add the lobby service instead of waiting for random players to join.
@bluzenkk2 жыл бұрын
Thanks~ very helpful ~
@LegendaryCombatForce Жыл бұрын
Please tell that how can we make a functional search bar on which if we search then it will show the list of online multiplayers And if we click on any player it will show option "add friend" if we click on add friend it will be added to our friends list
@DrWoofOfficial Жыл бұрын
Do you have a database set up to store info of all players?
@juanalvear65927 ай бұрын
Hello, just using this right now, I added the team selection on my lobby screen but only the player themselves can edit their PlayerData, not even the host can, so how would you work around this?
@rucesocial2 жыл бұрын
That's pretty good.
@ryutmrgl11 ай бұрын
How do you change data for each player, like the avatars you've show in this video and sync it with other players? I've trying to make a team based lobby with no succeed, I have tried to change data of each slot for each player but it does not work, since only the player itself can change his own data and the host of the lobby can't change the data of other players.
@TUPGD8 ай бұрын
figured the issue but dont see a fix....When you press Authenticate without changing the name from Code Monkey, it will not authenticate nor let you go back...
@LachfroschX Жыл бұрын
Thanks a lot for this great Tutorial. I am having some trouble with connecting a UI to the code though, like you showed at the end. When trying to create the List of existing Lobbys I created a prefab for the list entrys but I can't figure out how to dynamically spawn elements of this prefab and also how to then fill it with the lobby name, maxplayers and so on. I tried taking a look at your project files but i can't figure it out. Also for the UI, I saw you put everything in one Scene - I created multiple Scene for each "Window" - Which route would be considered "correct" according to Unity Guidelines? If your style is the proper way, do you have a Link to a tutorial on how you did that? Again, Thanks a lot!
@sameoy6962 жыл бұрын
Games that are the survival of the strongest, and for example, their number is 100. How, if one person remains, a slogan appears that he is a winner, and the game ends
@rafaelbrustolin46877 ай бұрын
I didnt know unity had a high level lobby system like this
@sanjeebboyaju4800 Жыл бұрын
Great tutorial. Quick question, How do you add bot in lobby? or do I add bot in game play?
@CodeMonkeyUnity Жыл бұрын
You would probably only add that during gameplay. After you start the game if there are fewer than the max number of players spawn a bot for the remaining ones
@Notllamalord6 ай бұрын
I come with updates! when you poll a lobby for updates you can do special logic only when the lobby has changed. Every lobby has a version which changes whenever the lobby is updated. here's some sample code for checking for updates, put it inside the if statement for when the LobbyPollTimer < 0 Lobby oldLobby = joinedLobby; joinedLobby = await LobbyService.Instance.GetLobbyAsync(joinedLobby.Id); if (joinedLobby.Version != oldLobby.Version) { //your custom logic }
@lavimahal82902 жыл бұрын
Make a tutorial for netcode using Steamworks p2p also plz.
@bananaglove20202 жыл бұрын
I would like that too!
@vardanbetikyan4117 Жыл бұрын
The Lobby deletes itself and doesn't migrate host after the host "unexpectedly" disconnects (simply turning off unity play) instead of just leaving the room. Is there a way around this?
@jihadrouani5525 Жыл бұрын
Massive thanks for this multiplayer series, and super excited for the upcoming one, I hope you make more and more videos or even courses on multiplayer, DOTS, ECS... I'm sure they'll be very valuable. And I hope I can support with more sizeable donations in the future, being an indie dev making games with nothing released yet is kinda hard on my ressources 🥲
@CodeMonkeyUnity Жыл бұрын
Thanks for the super thanks! Best of luck in your game dev journey!
@nileshsharma9009 Жыл бұрын
Great Video! just want to know if we can customize the lobby code or not.. like if i want it to be for 5 characters only, something like that was present in photon i think!
@CodeMonkeyUnity Жыл бұрын
No I don't think that's possible, it's auto-generated on Unity's side
@arvydazo420311 ай бұрын
when lobby host left the lobby, for example wifi disapears or game crashes, lobby disapears after 30s from the list, but players in lobby stays endefinetely with no warning that lobby no more exist. is there a way to change lobby owner when original owner is offline?
@stefancc839 ай бұрын
do you have any video showing how to transfer data between host and guest and both of them getting notified on events? Usecase: guest changes its data and host gets notified about changes and viceversa.
@mohamedmusthafa10579 ай бұрын
Can u Please Explain I can See QuickJoin Method On Lobbies Class And LobbyServices class as well whats Difference both?
@md3d5196 ай бұрын
im curious on how you made the chat and commands , a tutorial on that would be appreciated
@Overdrink76 ай бұрын
It's a unity asset If I remember well. And he probably explained it in a previous video
@Overdrink76 ай бұрын
See the previous video of the playlist
@romain4088 Жыл бұрын
is it possible to spawn the players in the lobby in the same game with the character they picked using unity netcode?
@CodeMonkeyUnity Жыл бұрын
When you join the lobby you can initiate the NGO connection right away, that's what I'm doing in my multiplayer game, video coming out next Monday
@k3bolkb6414 ай бұрын
Photon or Netcode what should I use?
@MarekNijaki2 жыл бұрын
Very very good video
@TheKr0ckeR2 ай бұрын
Can we test this without relay on across computers from different places? Do we need relay setup to get in a lobby without locally?
@CodeMonkeyUnity2 ай бұрын
Lobby does not need Relay, Lobby is just an HTTP connection so there are no issues with firewalls or NAT. You only need Relay to create the NGO connection
@Somiaz Жыл бұрын
How do I even get the UI set up? It seems this was also a crucial part that was missed? Especially since so many changed were made from during the tutorial. It would have been nice to see how to set everything up fully even with basic Unity UI stuff.
@CodeMonkeyUnity Жыл бұрын
In any way you want, every game will have a different UI. If you want to see that step by step I did pretty much exactly the same thing in my free multiplayer course kzbin.info/www/bejne/bZjPdKZ8bsupadU
@ananths1122 Жыл бұрын
This was very useful. (Question) I un-commented "HandleRefreshLobbyList( )" , but 5 seconds was too soon for it, says "Too many requests", What other time interval do you suggest for lobby refresh ?
@CodeMonkeyUnity Жыл бұрын
The docs mention the rate limits for each function
@netanelkomm5636 Жыл бұрын
Hey code monkey, i've got a problem related to scene loading: when the host decides to start the game, StartGame is called, updating the KEY_START_GAME just like in your relay tutorial. Then it loads the game scene. Upon the completion of the game scene loading - the function SceneManager_OnLoadEventCompleted is called (custom function i made) - to spawn the connected players. The problem - it only spawns the host. It happens because the clients join after the scene was loaded - maybe because the update polling isn't happening immediately, and also the fact that joining a relay takes time. Is there any way to solve this? Maybe wait for all the lobby clients to join or something? Because what I'm doing now is just waiting 5 seconds which is obviously not ideal....
@CodeMonkeyUnity Жыл бұрын
How did you listen to that function? Some load events are only triggered on the host, there is one for when the host finishes loading, others when clients finish loading, and I think there's one when all clients have finished loading, you need to hook onto that one and spawn all clients
@netanelkomm5636 Жыл бұрын
@@CodeMonkeyUnity Okay, i'd send you the link where you can see the functions, but it seems that you disabled links in your comments.... So i'll write it manually. Here's the class I made for spawning the players, I put it in the lobby scene: As you can see, Im using OnLoadEventCompleted. Its important to mention that this runs on the host. public class SpawnPlayers : NetworkBehaviour { [SerializeField] private Transform playerPrefab; // Start is called before the first frame update public override void OnNetworkSpawn() { if (IsServer) { NetworkManager.Singleton.SceneManager.OnLoadEventCompleted += SceneManager_OnLoadEventCompleted; } } private void SceneManager_OnLoadEventCompleted(string sceneName, UnityEngine.SceneManagement.LoadSceneMode loadSceneMode, List clientsCompleted, List clientsTimedOut) { Debug.Log("Spawning players..."); foreach (ulong clientId in NetworkManager.Singleton.ConnectedClientsIds) { Debug.Log(clientId); Transform playerTransform = Instantiate(playerPrefab); playerTransform.GetComponent().SpawnAsPlayerObject(clientId, true); } } }
@netanelkomm5636 Жыл бұрын
@@CodeMonkeyUnity I mean, the problem is not with the loading. Its the fact that the event is invoked when all clients finish loading the scene. But when LoadScene is called, the clients haven't connected yet - since they haven't polled the lobby update yet - so it's only taking the host (which is the only connected client), into account.
@ANlevant Жыл бұрын
this is very interesting, but I came looking for a way to connect my lobby with my Multiplayer game which uses Netcode for Game Objects
@Flem100DK2 жыл бұрын
Shouldn't you return Task instead of void when it's not an event?
@CodeMonkeyUnity2 жыл бұрын
It depends if you want to return any value or not. If you want to return anything at all then yes you need to return Task But if you don't want to return anything then void works fine
@anujsaini0271 Жыл бұрын
I have some doubts, how host is migrated if host has quit the game suddenly? How Host is migarted without using migrateLobbyHost() by host as host lobby will be null hence no pingheartBeat would be called?