Tutorial: Online multiplayer 🔫 FPS Unity & Photon Fusion EP7 (Lobby Session Browser)

Поделиться
HTML-код
  • Опубликовано: 21 сен 2024

Комментарии • 63

  • @PrettyFlyGames
    @PrettyFlyGames  Год назад +8

    There is a bug in the host migration code which prevents it from working properly when not using a single scene. If you have problems with host migration ensure that you use the latest version for the Photon Fusion SDK as there has been some fixes for host migration.
    Change this in NetworkRunnerHandler.cs
    StartCoroutine(CleanUpHostMigrationCO());
    //Add this -> New host needs to ensure that it knows what scene is active.
    runner.SetActiveScene(SceneManager.GetActiveScene().buildIndex);
    Debug.Log($"HostMigrationResume completed");

  • @kl3mta3
    @kl3mta3 Год назад +7

    there are so few videos on Fusion thank you for these. They probably help a lot of people!

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Thanks! Yeah, I do it helps people to get started with Photon Fusion

  • @peileed
    @peileed 7 месяцев назад +1

    this helped a lot! way more information than I needed because I just wanted the list of rooms but you got me there

    • @PrettyFlyGames
      @PrettyFlyGames  7 месяцев назад

      Awesome, glad that it was helpful!

  • @ajaybhojani1958
    @ajaybhojani1958 Год назад +1

    Thank you for the great support ! 🤝

  • @lilbaby4PF
    @lilbaby4PF Год назад +1

    Nice tutorials as usually, Helps with getting started with fusion.

  • @soyalberto9717
    @soyalberto9717 Год назад +1

    Your videos have helped me so much, I hope u could make one video on how to count the kills of each player and how to end a game after a player has reached a certain number of kills

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад +1

      Glad to hear that! I'll add it to the request list 🙏

  • @hiroplaygame
    @hiroplaygame Год назад +1

    i hope you will make a tutorial for session room. like instead of directing a player to the next scene it will add the player to the session room where all players are listed and then they can join the match or leave the room

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад +1

      Thanks, I'll add it to the list of requests.

  • @dmitrys3269
    @dmitrys3269 Год назад +1

    Thanks for excellent videos, it really helps to reach the result in short period of time.
    Are you going to show how to switch scene back to MainMenu on some condition during the play? Or probably you can suggest where to start.

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Glad that you liked it. I can add it to the request list but in what case would you use it? Like when the client drop connection to the server or a plain exit to main menu for the client?

    • @dmitrys3269
      @dmitrys3269 Год назад

      @@PrettyFlyGames Let it be a plain exit after one of the player has died. Max players count is two.
      Can I just use Runner.Shutdown() when player dies in the HPhandler and reload the scene using SceneManager from OnShutdown() INetworkRunnerCallbacks?
      Or maybe I need some game manager wich will track all players and if needed despawn both of them, shut down network runner and reload the scene.

  • @bdd740
    @bdd740 Год назад +1

    Thanks a lot.

  • @lucasr1
    @lucasr1 11 месяцев назад

    Hi, thanks for your great tutorials! can you explain more about the GameManager script, to which entity must be attached?

    • @PrettyFlyGames
      @PrettyFlyGames  11 месяцев назад +1

      You are welcome!
      The game manager should be attached to a game object of its own and it should be a singleton which means that there should only be one existing at any time in your game.

  • @flickergames7624
    @flickergames7624 8 месяцев назад

    Hi, thank you for this wonderful tutorial. Can we add a private session in photon fusion?

    • @PrettyFlyGames
      @PrettyFlyGames  8 месяцев назад

      Hi!
      Np, glad that you liked it 🙏
      Sure, there a few ways to do it really. Either you can set the session to IsVisible to false and/or you can use SessionProperty to set a password which would then be required before you are allowed to join a room.

  • @LaPanthera
    @LaPanthera Год назад

    Good video! May you advise how to know Players Count connected to Lobby? Something like get list of possible chat contacts in LOBBY?

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Thanks!
      You get the number of players connected to each session by sessionInfo.PlayerCount
      I've not looked into chat so far so not really sure how that works.

  • @JaViToPwN
    @JaViToPwN Год назад

    Hey! Which version of Fusion is in this tutorial? I wanted to program to whole series from the start and I know the first episode is 1.0, is this updated?
    Thank you so much for these amazing videos!

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      This tutorial is for Photon Fusion 1.1 . If you follow this video it is based on 1.1 instead of 1.0 ruclips.net/video/KqpMOdPj3co/видео.html

  • @IgorAherne
    @IgorAherne Год назад

    Thank you! What happens if we try to create a room using a name that already exists?
    Is there some callback that we can expect to get?

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      You can check if there is already a room with a name. Otherwise it depends on the game mode you are using, so if you have autohost/client then it will just connect as a client otherwise you'll get an error. If you are running server mode then you'll get an error message saying server is already in room.

  • @Foz_Games
    @Foz_Games Год назад

    bring more videos 😍

  • @gunzazaza32
    @gunzazaza32 Год назад

    Thank for this tutorial !!! ,but I want to make some waiting room when we join the lobby ,Can photon fusion do this ?

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Sure, you just have to use a Unity scene for that. So once you join a room then load up a lobby scene where the players can wait and possible chat until the game is ready to launch.

  • @klutz6557
    @klutz6557 Год назад

    Where did you loaded the "World1" Scene? Can you share that code? i am little confused
    & where are you handling the player spawning?

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Scene switching is covered a bit more here ruclips.net/video/3GBl1FDkC6g/видео.html have a look at that and see if it helps.

  • @scientificunity7666
    @scientificunity7666 9 месяцев назад

    I can't see the characters in the video, because of the small characters. Maybe someone has a link to the git of this project please
    ?

    • @PrettyFlyGames
      @PrettyFlyGames  9 месяцев назад +1

      You can download the source for the project here www.patreon.com/posts/tutorial-online-75034121

  • @esdawetseger8399
    @esdawetseger8399 Год назад +1

    is there any help?, when I create a game room and the game room is migrated to the client, when I enter the room again it's stuck on the joining menu but it's already connected to the game room

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад +1

      Hi!
      The best way to get assistance is to join our Discord server discord.gg/AyYtKXT
      I'm not sure what you are trying to achieve? Is the issue when you create a new game session as a host and then you leave that which triggers the host migration to a client and after that you cannot join this room again from the former host?

    • @esdawetseger8399
      @esdawetseger8399 Год назад

      @@PrettyFlyGames Yes, like that

  • @dupladeumso
    @dupladeumso 9 месяцев назад

    Hello! I'm having a small lag bug in my game. When I enter someone's room, when the room starts to lag when I shoot, I end up shooting several shots at once. How to fix shot lag?

    • @PrettyFlyGames
      @PrettyFlyGames  9 месяцев назад

      That sounds a bit strange. How much lag do you have (you can measure the RTT and see how long time it takes). If it lags too much then pick a server region closer to you.

    • @dupladeumso
      @dupladeumso 9 месяцев назад

      @@PrettyFlyGames I found a small solution, but I still have lag. I duplicated the script that shoots the rocket and modified it to be a bullet shooter. This way the bullet has a visible mesh. So I fixed the lag of firing multiple shots, but if I enter someone's room, the shot takes a while to appear for me. But how does the region change?

  • @NewbNinjas
    @NewbNinjas Год назад +1

    How do we use client/server instead of peer-to-peer?

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      I think you already gotten some answers through Discord but if others are asking the same question here is the answer: Most of the things are the same as the code for Host/client when it comes to Server/client. I hope to make a pure server/client tutorial in the future.

  • @muadhg2206
    @muadhg2206 Год назад

    I think I found a new bug.
    The problem appeared only now after the whole code is added, if you have a session with two people.
    The problem is that if you try to kill the client with the host, he freezes in the red screen.
    Can you try it out please.

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад +1

      Download the project and see if it works: www.patreon.com/posts/tutorial-online-75034121 It works as it should for me.

  • @muadhg2206
    @muadhg2206 Год назад

    Did you try out hostmigration? For me it throws errors but i dont know if this is a problem of my version.

    • @muadhg2206
      @muadhg2206 Год назад

      Nevermind. I solved it. It was just that in "onHostMigration" it searched for a object of type "NetworkRunneeHandler" but it couldnt find anything.
      The solution is to add the NetworkRunnerHandlerPrefab to the Scene "World1"

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Yes, there is a bug in the host migration code which prevents it from working properly when not using a single scene. Also ensure that you use the latest version for the Photon Fusion SDK as there has been some fixes for host migration.
      Change this in NetworkRunnerHandler.cs
      StartCoroutine(CleanUpHostMigrationCO());
      //Add this -> New host needs to ensure that it knows what scene is active.
      runner.SetActiveScene(SceneManager.GetActiveScene().buildIndex);
      Debug.Log($"HostMigrationResume completed");

  • @joselito1637
    @joselito1637 Год назад

    There is a problem, if you press "create session" before completed the update of session list I got a red warring

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад +1

      I'm don't seem to have an issue with this. What does your red warning say?

    • @joselito1637
      @joselito1637 Год назад

      @@PrettyFlyGames I download your project and session list works fine, but if you press "play" in unity editor, and try to make a match so fast before "JoinLobby" callback finish you will get a red warning, check it.

    • @joselito1637
      @joselito1637 Год назад

      @@PrettyFlyGames I also can reply same bug on EP8, I think is a photon bug, if you press "play" enter and press "create" before JoinLobyy started finish, you will get a Fusion.startgameexception

    • @joselito1637
      @joselito1637 Год назад

      I have found another bug, if you make a session, and join back to menu, after all session list is not updated

  • @tatustudio6983
    @tatustudio6983 Год назад

    can i iscrease max player per room ? i want custom max players abount 32 player per room thanks

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Sure! Just set the session max player count to what you need. However the free key is max 10 concurrent players.

  • @muhammadachir1495
    @muhammadachir1495 Год назад

    .why you font is too small :'(

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Do you mean in Visual studio or the game? You can download the source here if you need to see the code www.patreon.com/prettyflygames?filters[tag]=Photon%20Fusion

  • @googleuser4720
    @googleuser4720 Год назад

    I hate the flow of the tutorials. Man its just so hard to keep up when youre copying stuff all over the place. Dude, uncool.

    • @PrettyFlyGames
      @PrettyFlyGames  Год назад

      Ok thanks for the feedback. Is it the tutorial in general or just the code copying part?

    • @googleuser4720
      @googleuser4720 Год назад

      @@PrettyFlyGames Its also the way its set up, every player script is talking to every other player script. Why use GetComponent when you can just drag and drop a serialized field reference?
      Can you redo the entire tutorial without having dependencies on the player scripts?

    • @Jicefrost
      @Jicefrost Год назад +1

      @@PrettyFlyGames this is good tutorial. nothing bad in you're style :)