Making a MULTIPLAYER Game? Join your Players with LOBBY!

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 462

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  2 роки тому +20

    ❤ Watch my FREE Complete Multiplayer Course ua-cam.com/video/7glCsF9fv3s/v-deo.html
    💬 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) ua-cam.com/video/3yuBOB3VrCk/v-deo.html
    Multiplayer through FIREWALL with Relay! (Unity Gaming Services) ua-cam.com/video/msPNJ2cxWfw/v-deo.html
    What is Unity Gaming Services? ua-cam.com/video/JwClCc2_zC8/v-deo.html
    EASY Console! Run any Command! (Add Cheats, Set Gravity, Spawn Enemies Quantum Console Asset Review) ua-cam.com/video/bOf6CjpuSFs/v-deo.html
    Simple Text Input Field Window in Unity (Submit Score, Name) ua-cam.com/video/4n6RT805rCc/v-deo.html

  • @coryscustominstalls7168
    @coryscustominstalls7168 Рік тому +150

    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

    • @JohnGamble
      @JohnGamble 10 місяців тому +1

      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.

    • @NedjmouBlaxword73
      @NedjmouBlaxword73 9 місяців тому

      Thanks

  • @eze-cs
    @eze-cs 2 роки тому +46

    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!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +9

      Thanks for the kind words! I'm glad you found the videos helpful!

    • @arvydazo4203
      @arvydazo4203 11 місяців тому

      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
      @RicardoSanchez-es5wl Місяць тому

      @@arvydazo4203I think host migration is in unity 6

  • @TheAsbj0rn
    @TheAsbj0rn Рік тому +12

    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
      @CodeMonkeyUnity  Рік тому +5

      I'm glad the video has helped you! Best of luck with your game, thanks!

  • @ezrahuffman
    @ezrahuffman Рік тому +10

    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.

  • @SzaboB33
    @SzaboB33 2 роки тому +15

    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!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +17

      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
      @ergicela4420 Рік тому

      @@CodeMonkeyUnity does a multiplayer game cost , or how much you need to spend to create a multiplayer game by your self?

    • @phlips8254
      @phlips8254 Рік тому +3

      @@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
      @sir.niklas2090 Рік тому

      Honestly Multiplayer is still difficult get some practice in, not years but just understanding.

  • @zanuka9765
    @zanuka9765 6 місяців тому +5

    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); //

  • @durvesh007
    @durvesh007 2 роки тому +11

    Really appreciate this detailed explanation 👍

  • @Wonder_Verse_Tech
    @Wonder_Verse_Tech 2 роки тому +34

    Was going to sleep, code monkey's notification came, so I am here ... Postponed sleep for next 52 minutes 😁

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +12

      Heh don't worry, the video will still be here in the morning!

    • @Wonder_Verse_Tech
      @Wonder_Verse_Tech 2 роки тому +2

      @@CodeMonkeyUnity 😅Yeah , But you can understand the passion for game Devs .

    • @padamgupta6941
      @padamgupta6941 2 роки тому +2

      @@CodeMonkeyUnity अरे कुछ नहीं मंकी भाई यह सो गया था तुरंत ही मेरा रूममेट है ये

    • @Wonder_Verse_Tech
      @Wonder_Verse_Tech Рік тому

      @@padamgupta6941 abe 🤣 ... Accha screenshot lagane ki wjh se dhundh liye tum... Bhkk...

    • @magnushlund
      @magnushlund Рік тому +1

      Legend says that he still hasn’t slept. Been watching codemonkey nonstop ever since.

  • @captainnoyaux
    @captainnoyaux 2 роки тому +3

    I'm working on the multiplayer version of my game, nearly finish this is coming at the right time :D Thanks a lot

  • @evanstaylordigital8232
    @evanstaylordigital8232 Рік тому +7

    Awesome video. I have come back to this several times while prototyping my own lobbies implementation. Would be super helpful if you included chapters!

    • @arvydazo4203
      @arvydazo4203 11 місяців тому

      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?

  • @Neo-Meo-X
    @Neo-Meo-X 2 роки тому +4

    This is more than an amazing tutorial. thanks for sharing this. Looking forward to watching more multiplayer tutorials!

  • @alec_almartson
    @alec_almartson 2 роки тому +5

    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. 😄✌🏻

  • @roubatov
    @roubatov 2 роки тому +5

    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!

    • @racistpixel1017
      @racistpixel1017 Рік тому

      how dud you made so all the players would be spawned to gameplay scene ?

    • @Nounsi_Dev
      @Nounsi_Dev 7 місяців тому

      @@racistpixel1017 have to make it work with netcode for gameobject

  • @lemetamax
    @lemetamax 2 роки тому +2

    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.

  • @alexdev447
    @alexdev447 Рік тому +1

    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!!

  • @kpr2
    @kpr2 4 місяці тому

    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!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 місяці тому +1

      Not sure what timestamp you're referring to, what two different variables? You mean lobbyName and maxPlayers? It's to avoid using magic numbers ua-cam.com/users/shortsCQ5xHgRZGQo
      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.

    • @kpr2
      @kpr2 4 місяці тому

      @@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/(>.

  • @notlaw1567
    @notlaw1567 2 роки тому +1

    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.

  • @Crazytm24
    @Crazytm24 2 роки тому +2

    This is exactly what I needed, thank you!

  • @o2dyt
    @o2dyt Рік тому +1

    Amazing tutorial. I followed along and got everything working. Thank you!

    • @Hhuxx1
      @Hhuxx1 Рік тому

      the Join player using Id didnt work is something wrong?

    • @o2dyt
      @o2dyt Рік тому

      @@Hhuxx1 Hey! What's the error?

    • @Hhuxx1
      @Hhuxx1 Рік тому

      @@o2dyt Id didnt exist

  • @RigidDecay
    @RigidDecay 2 роки тому

    Thanks so much for making this man, I’ve been waiting 😅

  • @bloobyjoobyjoob8949
    @bloobyjoobyjoob8949 2 роки тому +3

    Yus! This is exactly what I needed! Any chance you could do Vivox next?

  • @josephderosa5569
    @josephderosa5569 2 роки тому +2

    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.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +3

      Yup Game Server Hosting (Multiplay) and Matchmaker are two other tools I want to research

  • @JasonLovettGameDev
    @JasonLovettGameDev 2 роки тому +1

    This was gold! Literally just made my entire lobby system for my game just following along

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому

      Nice! Best of luck with your game!

    • @JasonLovettGameDev
      @JasonLovettGameDev 2 роки тому

      @@CodeMonkeyUnity Thanks man! Appreciate it!

    • @captainnoyaux
      @captainnoyaux 2 роки тому

      ​@@CodeMonkeyUnity Same ! ​ Thanks a lot I'll definitely support you when my game generates more money !

    • @ArveKarve
      @ArveKarve Рік тому

      how did you made so lobby players would be transfered to actual gameplay scene?AC

    • @hralpuh
      @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.

  • @sir.niklas2090
    @sir.niklas2090 Рік тому +15

    Yall, just a tip don't name your script "Lobby" since its a keyword it will give you head aches... :D

    • @afrikaansedude2525
      @afrikaansedude2525 7 місяців тому +1

      I knew i shouldn't name i Lobby but yet still my smooth brain did exactly wat i told it not to do..😂

    • @jaa5197
      @jaa5197 3 місяці тому

      You also can't name Players "Player" because Player already exists in the lobby package

  • @AntAptive
    @AntAptive Рік тому +5

    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!

  • @S_Tadz
    @S_Tadz Рік тому +1

    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
      @CodeMonkeyUnity  Рік тому

      Oh that's interesting, I don't remember seeing that, must be a nice recent addition

    • @arvydazo4203
      @arvydazo4203 11 місяців тому

      @@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

  • @MrMrn87
    @MrMrn87 2 роки тому +5

    I would love some insight in Steam intergration with Unity Multiplayer Networking

  • @Yasser-Dev
    @Yasser-Dev 3 місяці тому

    The Greatest Of all times ❤
    Thanks for your efforts and
    I hope you’ll see my comment
    (Your biggest fan yasser)❤

  • @klevialushi571
    @klevialushi571 2 роки тому

    This video was needed since i was thinking of implementing the same thing in a 2d game that im making, thanks!

  • @GreazyController
    @GreazyController 2 роки тому +1

    Yes, finally a great tutorial on this!

  • @emberdragons8244
    @emberdragons8244 Рік тому

    Thanks, that was really helpful

  • @devonn6
    @devonn6 2 роки тому

    Finally ...😍😍
    You are awesome!

  • @stefancc83
    @stefancc83 10 місяців тому +1

    Super cool video. How did you manage to run 2 builds in Unity? Thanks!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  10 місяців тому +2

      They're not both inside Unity, only one is in Unity the other one is a standalone build

  • @designer.trifonov
    @designer.trifonov Рік тому

    Its super lesson! Thanks! :)

  • @lilbaby4PF
    @lilbaby4PF 11 місяців тому

    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.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  11 місяців тому

      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

    • @jaybehl7567
      @jaybehl7567 4 місяці тому

      @@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

  • @playnowgaming4628
    @playnowgaming4628 2 роки тому

    Really helpfully video and appreciate your work bro ❤

  • @s1m1ng7on
    @s1m1ng7on Рік тому +2

    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
      @CodeMonkeyUnity  Рік тому +2

      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

  • @rootbindev
    @rootbindev 2 роки тому

    i love your multiplayer tutorials

  • @LegendaryCombatForce
    @LegendaryCombatForce Рік тому +1

    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

  • @Lifeport-z
    @Lifeport-z Рік тому

    How would I implement this into vr?

  • @JesseTheGameDev
    @JesseTheGameDev 2 роки тому +2

    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).

  • @SuperKREPSINIS
    @SuperKREPSINIS Рік тому +1

    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.

  • @DP_1
    @DP_1 2 роки тому +1

    thank you, you helped me a lot 😲🙂

  • @connerreynolds6142
    @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
      @CodeMonkeyUnity  Рік тому +1

      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 ua-cam.com/video/7glCsF9fv3s/v-deo.html

  • @mohamedmusthafa1057
    @mohamedmusthafa1057 Рік тому

    Developer's Gem ❤

  • @rajsah4667
    @rajsah4667 2 роки тому

    🤩 great tutorial

  • @-Bill-Clinton-
    @-Bill-Clinton- Рік тому

    awesome tutorial!

  • @jean-michel.houbre
    @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
      @jean-michel.houbre Рік тому

      Connection with Codemonkey lost ... I hope you're doing well.

    • @davidwusoftdev
      @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
      @jean-michel.houbre Рік тому

      @@davidwusoftdev Thanks!

  • @Synith19
    @Synith19 2 роки тому

    Wooooo another multiplayer video!

  • @muerrtee
    @muerrtee Рік тому +2

    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
      @CodeMonkeyUnity  Рік тому +2

      Did you name your class Lobby?

    • @muerrtee
      @muerrtee Рік тому +1

      @@CodeMonkeyUnity yep i named it the same took me a while to realize now everything works totally fine thanks the tutorial is really good

  • @VladaPersonal
    @VladaPersonal Рік тому

    This great tutorial could really use chapters.

  • @lazarbecic2199
    @lazarbecic2199 Рік тому

    Thanks a ton!

  • @harsimargawri8113
    @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
      @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

  • @davidgauffindahlin698
    @davidgauffindahlin698 2 роки тому +1

    You are the best

  • @mjkkaya6056
    @mjkkaya6056 Рік тому

    How do you achieve to show so many features in a single video?
    This is awesome!

  • @sadryan4013
    @sadryan4013 Рік тому +2

    Anyone else having an issue where the player class exist but also doesn't exist at the same time?

  • @rafaelbrustolin4687
    @rafaelbrustolin4687 7 місяців тому

    I didnt know unity had a high level lobby system like this

  • @goldenapple801
    @goldenapple801 10 місяців тому

    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.

  • @freecash3474
    @freecash3474 10 місяців тому

    Can someone help me with how I can create a player data of type int or bool instead of string? 26:37 Do I have to use string?

    • @Squid_Fat
      @Squid_Fat 10 місяців тому

      Data = new Dictionary()

    • @freecash3474
      @freecash3474 10 місяців тому

      @@Squid_Fat It didn't work it still asks for string for value

  • @TUPGD
    @TUPGD 8 місяців тому

    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...

  • @LegendaryCombatForce
    @LegendaryCombatForce Рік тому +1

    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
      @DrWoofOfficial Рік тому

      Do you have a database set up to store info of all players?

  • @OlekandrAntonesku
    @OlekandrAntonesku Місяць тому

    31:20 Lobbies Filter

  • @linkrider2302
    @linkrider2302 Рік тому +1

    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?

  • @RoffeDH
    @RoffeDH Рік тому +1

    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
      @CodeMonkeyUnity  Рік тому +1

      Sounds like you already defined a class named Lobby in your project

    • @RoffeDH
      @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_dev
      @im_an_intern_unity_dev 2 місяці тому

      haha u saved me

  • @bluzenkk
    @bluzenkk 2 роки тому

    Thanks~ very helpful ~

  • @mohamedmusthafa1057
    @mohamedmusthafa1057 9 місяців тому

    Can u Please Explain I can See QuickJoin Method On Lobbies Class And LobbyServices class as well whats Difference both?

  • @poisht853
    @poisht853 7 місяців тому

    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...

  • @Steve-gi2yj
    @Steve-gi2yj 8 місяців тому

    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.

  • @arsalanasif8354
    @arsalanasif8354 11 місяців тому

    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.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  11 місяців тому

      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

    • @arsalanasif8354
      @arsalanasif8354 11 місяців тому

      @@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.

  • @UnityDevJOY
    @UnityDevJOY 2 роки тому +2

    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
      @CodeMonkeyUnity  2 роки тому +2

      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
      @UnityDevJOY 2 роки тому +4

      ​@@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
      @DiegoAtravesar Рік тому +1

      @@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
      @theplaymakerno1 Рік тому

      Can you explain this? Where do you actually do this?@@CodeMonkeyUnity

  • @somegamer7958
    @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
      @CodeMonkeyUnity  Рік тому +1

      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 ua-cam.com/video/7glCsF9fv3s/v-deo.html

  • @stefancc83
    @stefancc83 10 місяців тому

    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.

  • @TarrenHassman
    @TarrenHassman Рік тому

    I looked at the basic coroutine and couldn't figure out why you didn't like the pattern until I tried to make it async lmao

  • @Maskedmous
    @Maskedmous 2 роки тому

    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.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +2

      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.

    • @Maskedmous
      @Maskedmous 2 роки тому

      @@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

  • @arvydazo4203
    @arvydazo4203 11 місяців тому

    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?

  • @jonbruenderman
    @jonbruenderman 3 місяці тому

    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.

  • @lavimahal8290
    @lavimahal8290 2 роки тому +2

    Make a tutorial for netcode using Steamworks p2p also plz.

  • @k3bolkb641
    @k3bolkb641 4 місяці тому

    Photon or Netcode what should I use?

  • @Ionixification
    @Ionixification 2 роки тому

    Ur awesome man

  • @SMORIGINALS
    @SMORIGINALS 2 роки тому

    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....?

  • @LachfroschX
    @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!

  • @juanalvear6592
    @juanalvear6592 7 місяців тому

    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?

  • @jihadrouani5525
    @jihadrouani5525 Рік тому +1

    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
      @CodeMonkeyUnity  Рік тому +1

      Thanks for the super thanks! Best of luck in your game dev journey!

  • @OneTime_12
    @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 !!

  • @md3d519
    @md3d519 6 місяців тому

    im curious on how you made the chat and commands , a tutorial on that would be appreciated

    • @Overdrink7
      @Overdrink7 6 місяців тому

      It's a unity asset If I remember well. And he probably explained it in a previous video

    • @Overdrink7
      @Overdrink7 6 місяців тому

      See the previous video of the playlist

  • @romain4088
    @romain4088 Рік тому +1

    is it possible to spawn the players in the lobby in the same game with the character they picked using unity netcode?

    • @CodeMonkeyUnity
      @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

  • @ryutmrgl
    @ryutmrgl 11 місяців тому

    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.

  • @nileshsharma9009
    @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
      @CodeMonkeyUnity  Рік тому

      No I don't think that's possible, it's auto-generated on Unity's side

  • @force.4game649
    @force.4game649 2 роки тому

    We want to learn sign in google firebase. Everybody wait this thanks! Please next video do this!

  • @sanjeebboyaju4800
    @sanjeebboyaju4800 Рік тому

    Great tutorial. Quick question, How do you add bot in lobby? or do I add bot in game play?

    • @CodeMonkeyUnity
      @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

  • @shmz6691
    @shmz6691 8 місяців тому

    How would i make it so the players in my lobby are moved to a round, preferably with netcode since i want to make a FPS

  • @KG-id3hk
    @KG-id3hk Рік тому +1

    What font are you using?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому +1

      It's the default TextMeshPro font, LiberationSans

    • @KG-id3hk
      @KG-id3hk Рік тому

      @CodeMonkeyUnity wow thank you, i love how you reply to your comments ❤️ subscribed 😁

  • @vardanbetikyan4117
    @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?

  • @Notllamalord
    @Notllamalord 6 місяців тому

    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
    }

  • @anujsaini0271
    @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?

  • @illuminatidad
    @illuminatidad 4 місяці тому

    Can you help me with this simple problem? How do I get the player data saved in the lobby, such as name and loadout, in the game when I actually run it? For example displaying the users name to other players? I know it's probably simple but an explanation would be awesome.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 місяці тому

      Store it in a variable locally on the lobby owner, have that lobby owner start hosting the game, wait for all to be connected, send a ClientRPC to send that data to all clients
      Or you don't even need the host to send anything, just store in a local variable for each connected player since they know the lobby state

    • @illuminatidad
      @illuminatidad 4 місяці тому

      @@CodeMonkeyUnity I'm so sorry could you explain it in more detail? I guess I don't entirely get how the client rpcs work here, like save the variable in the lobby script or the player script? Also how do I connect the PlayerId from the lobby to the networkmanager client id? Are they the same?

  • @LegendaryCombatForce
    @LegendaryCombatForce Рік тому +1

    Can you please tell me how to add search button in it

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      I covered the filters at 13:22

    • @LegendaryCombatForce
      @LegendaryCombatForce Рік тому +1

      No I just ask that how add search bar instead of lobby like I have many players playing online game and one of them want to add another as a friend and he will search his name on the search bar and then add him as a friend

  • @brianjirvin
    @brianjirvin Рік тому

    Should you leave the lobby open during a co-op game say a simple co-op ARPG/Co-op hack and slash game?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  Рік тому

      Depends on what you want to do, if you want to enable something like host migration then yes leave the lobby open, if not close it

  • @DA-te7xe
    @DA-te7xe 2 роки тому +2

    I want to make a great game but I am wary of how much, complex and overbearing trying to learn what's required will be. All Unity basics, csharp+ whatever it's called, all the computer stuff I'm not tech savvy with, if I mess 1 pivotal super important thing and can't undo it, what if loading tests are way too long, what more costs I might need that Idk rn etc.

    • @ryanpatton4394
      @ryanpatton4394 2 роки тому +3

      lol don't worry about sprinting before you can crawl. I've only started learning recently and it is extremely time consuming and tedious BUT I can honestly say its worth every second. If your passionate about something never let something that might not even happen or be a problem you face hold you back, just go

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 роки тому +1

      Don't worry, you can always undo everything, if you write some code and it gives an error, you can always find and fix the error, there's no permanent breaking changes in programming, it's not a physical thing where you can't go back.
      Start small, make tiny things, and over time you will learn more and more.
      Here's a nice guided path: unitycodemonkey.com/question.php?q=how-to-learn-unity
      Best of luck!