Players will not see already joined players when connecting to lobby system #367
Comments
This is a very annoying issue. A guy on Discord gave me some scripts that are a workaround on this, but I had to tweak them a bit to make them work. Otherwise, I discovered that a Thread.Sleep in the lobbyservice helps a lot with this problem |
Persegan gave me those fixes as well (he's been very kind), but they have issues if you have many players because there are too many messages that get exchanged. Yesterday I tried with 4 players on Android devices and the lobby got crazy. |
I have not run into that issue even with that many and more players connecting. Although the way I use it, my players are not all connecting into the lobby at the same exact time. |
I would have to look at the code again but I feel like instead of sending an RPC for every player already in the lobby, a RPC should be created to send all that info in one call. One RPC that sends all players already connected to the newly connected player. In theory would fix your issue, just would have to look how you could set it up. |
I'm going to investigate it next week for the program we are implementing, maybe if I find a solution, I can share it with the community. I will keep you posted! |
Hey @blapaz @Persegan I have improved the solution by Persegan:
Now I have no endless loops anymore, even with 10-12 players! My idea has been sending the messages of old players only to the last connecting user, and preventing the function to be called multiple times. Furthermore I've modified the RPC about players so now a name is shared. I know git well, but I'm not very practical with big GitHub repos, so can you tell me how can I start from Persegan solution and do a pull request? For people stumbling here before I make the pull request, I'll try to share here some code snippet. Start from solution from Persegan, not from the regular branch, or nothing will work. Then in the LobbyManager:
This will make sure the event is sent only to the latest connecting player and won't be repeated Now switch to LobbyService:
If I haven't forgotten anything, it should work, and you should have less exchange of messages and also the propagation of the names you have chosen for your players! I hope this will help someone |
Version Number and Operating System(s):
2019.3.6f & Windows 10
Expected behavior:
When implementing the lobby system, all players should show in the lobby no matter if they join first, second, and so on. They should also then be shown for all clients whenever they choose to join the game from the lobby.
Actual behavior:
Currently when implementing the lobby system, players that are in the lobby do not see anyone who joined before them (players do not show in list or receive those players messages). The same occurs with the order of players who then join the game. This does not occur if the lobby system is removed and players load directly into the game.
Eg. When player two joins he will not see player one listed. However, player one will see player two. Messages from player two will show to player one but not vise versa.
This same pattern also occurs then when players join the game from the lobby.
Steps to reproduce:
Create project following the instructions found on the wiki for Getting Started using the Network Manager. Once everything is in place add the Lobby System.
[Optional] Discord Username:
Panda™ #9444
The text was updated successfully, but these errors were encountered: