BenPyton/ProceduralDungeon

Multiplayer Problems

Terandox-The-Pineapple opened this issue · 4 comments

I done every step from the wiki for multiplayer and created a startroom, which the players spawn in.

In this Room is an Door that teleports all players to the Map with the dungeon generator...

but they never land in the same Dungeon. Also they cannot see each others in the Dungeon, but they can in the Starting Room

I don't know well how to use network in UE4, but from what you have described I suppose there is something wrong with your travel from your starting (connection lobby?) map to the dungeon map (since the players did not see each other).

About the plugin, I suggest you to wait for all players to have fully travelled to the dungeon map before calling the Generate function from the DungeonGenerator.
(There is currently no generation when a client travel in a map where the server has already generated the dungeon)

EDIT
I have tested the multiplayer, it works fine when all the players are already on the map when I call the Generate function.
All the players have the same dungeon, and they see each other.

I tried my best but i don't can get it to work...

Now both Players are stuck in the Void for ever and the Dungeon never Generates.

Screenshot of my Function: https://drive.google.com/file/d/1Gi4NobxlqNQIWe_-UBeMfd8wLH-aLJzN/view?usp=sharing

Playercount holds the Number of Players that were in the lobby as the teleport to the Dungeon beginned.

Also I used an Open Level Call to teleport the players, is that right?

p.s. I used an While Loop because an On Tick Event doesn't worked also

As I said, before trying to use the procedural generation, make sure your multiplayer works.
You can place a big plane in your map, where all the players are teleported. Then, make sure they seee each other and they are properly replicated (movements and actions of each are seen by the others).
If you struggle with that part, I will be no help for you. Try searching for tutorials, StackOveflow and the UE forums to make it to work.

Once you have checked this is working correctly, then you have to detect when all players are in your map before calling the Generate function.
You do it currently in the BeginPlay of the DungeonGenerator. This will check once when the DungeonGenerator is created (so before any player has arrived in the map). This for sure will never works.
I am not an expert in UE4 multiplayer, but I suggest you to search for an event like OnPostLogin (I don't know if this is triggered when travelling to a new map).
For instance, you can do this check in your LevelBlueprint: each time a player arrives in the map, you check if the number of player currently in your map correspond to the total number of player connected to your session.
If so you can call the Generate function on the DungeonGenerator.

Also, I don't have the time right now, but in the future I would like to trigger a Generate when a client player arrive in the map with an already generated dungeon.
However, currently when you call Generate, it will generate the same dungeon on all clients already in the map. The behaviour works as intended for now.

EDIT
After some search on Internet, I found that OpenLevel disconnects all clients from the server. You should use ServerTravel instead.
From there, you have 2 solutions:

  • you do a non-seamless travel, that will disconnect, then reconnect all clients once the server is in the new map. (in that case you want to use PostLogin to count the number of connected client before calling the Generate function)
  • you do a seamless travel (with a loading screen during transition map) that keep clients connections alive, and use HandleStartingNewPlayer to count the clients and call the Generate on the DungeonGenerator.

Sources:
https://dawnarc.com/2017/06/ue4networking-in-baisc-travelling-in-multiplayer/
https://docs.unrealengine.com/en-US/InteractiveExperiences/Networking/Travelling/index.html

Remember to extensively use PrintString to debug your code (eg. when your check of player count is called).

Since you haven't updated this issue for a long time, I assume it is fixed on your side.
I close it.