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");
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
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
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.
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?
@@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.
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.
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.
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.
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
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?
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.
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?
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.
@@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?
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!
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.
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.
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"
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");
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 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.
@@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
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
@@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?
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");
there are so few videos on Fusion thank you for these. They probably help a lot of people!
Thanks! Yeah, I do it helps people to get started with Photon Fusion
Thank you for the great support ! 🤝
Thank you so much 🙏
this helped a lot! way more information than I needed because I just wanted the list of rooms but you got me there
Awesome, glad that it was helpful!
Nice tutorials as usually, Helps with getting started with fusion.
Thanks! Glad that you liked it 👍
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
Glad to hear that! I'll add it to the request list 🙏
Thanks a lot.
You are welcome!
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
Thanks, I'll add it to the list of requests.
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.
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?
@@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.
Hi, thanks for your great tutorials! can you explain more about the GameManager script, to which entity must be attached?
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.
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?
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.
Good video! May you advise how to know Players Count connected to Lobby? Something like get list of possible chat contacts in LOBBY?
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.
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
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?
@@PrettyFlyGames Yes, like that
Hi, thank you for this wonderful tutorial. Can we add a private session in photon fusion?
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.
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?
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.
@@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?
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
?
You can download the source for the project here www.patreon.com/posts/tutorial-online-75034121
Where did you loaded the "World1" Scene? Can you share that code? i am little confused
& where are you handling the player spawning?
Scene switching is covered a bit more here ruclips.net/video/3GBl1FDkC6g/видео.html have a look at that and see if it helps.
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!
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
bring more videos 😍
Working on it :)
How do we use client/server instead of peer-to-peer?
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.
Thank for this tutorial !!! ,but I want to make some waiting room when we join the lobby ,Can photon fusion do this ?
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.
Did you try out hostmigration? For me it throws errors but i dont know if this is a problem of my version.
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"
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");
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.
Download the project and see if it works: www.patreon.com/posts/tutorial-online-75034121 It works as it should for me.
There is a problem, if you press "create session" before completed the update of session list I got a red warring
I'm don't seem to have an issue with this. What does your red warning say?
@@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.
@@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
I have found another bug, if you make a session, and join back to menu, after all session list is not updated
can i iscrease max player per room ? i want custom max players abount 32 player per room thanks
Sure! Just set the session max player count to what you need. However the free key is max 10 concurrent players.
.why you font is too small :'(
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
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.
Ok thanks for the feedback. Is it the tutorial in general or just the code copying part?
@@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?
@@PrettyFlyGames this is good tutorial. nothing bad in you're style :)