With a listen server, how can I rejoin a client who has travelled to a new level?
Hello, I've got a simple setup with a listen server and a client. I'd like to allow the client player to choose to leave the starting area and load up a new level, and then I'd like to let the listen-server join the client at the new level whenever this player is ready.
If it helps we can say player1 and player2 start in a "base" and there is an interactable door that when used takes you to the wilderness outside. I want player1 or player2 to be able to click use this door to go to the wilderness alone, and then whoever uses the door second, I want them to load into the wilderness that has already been loaded for the other player.
I am testing in the PIE with 2 players.
I can get player 2 to travel on his own no problem with a client travel call, but if I attempt to follow with a client travel call on player 1, nothing happens, which leads me to assume that something prevents the listen server from travelling via client travel, although I can't see this documented anywhere. I've also tried travelling with server travel for the listen server, but this goes to a new instance of that level even though I pass in the URL string I got from player2's NetConnection as the destination for player1.
I suppose I may have an issue with both of my players being at localhost, but I don't have a second box to test this with at the moment, and I'm not sure of a good way to emulate that otherwise. I also just can't find any wikis or answers about existing functionality to let me have my players exist on separate levels, so I don't know if I'll have to wire up some custom communication over sockets to make this work properly.
Please let me know if there is a good way to achieve this, it seems like something most multiplayer games would use, so I'm surprised I'm not seeing anything on it.
asked Jun 11 '19 at 09:44 PM in C++ Programming
Ok so after some time away from this I realize the real thing to be searching for was if Unreal supports having multiple levels linked to a server (listen server in my case) and that's been much easier to answer. Based on https://answers.unrealengine.com/questions/375951/multiplayer-one-server-and-many-clients-with-diffe.html I can't have multiple levels open and owned by the server, which of course means there will be no concept of travelling to "level B".
If anyone else finds this and is stuck, depending on your needs you can probably have multiple physical play spaces in one level (probably with level streaming) that your players are teleported between.
It also should be possible to use unreal's network sockets to share some data between both players once they are in separate levels, so that you can still see for example, the other player's healthbar, location (what level they are in), and other relevant info. After this I imagine you can destroy / create sessions as needed and use join session to get to each other's levels instead of something like client travel.
I haven't started looking into unreal's sockets implementations much yet but here's a rama link that should be valuable to get started https://wiki.unrealengine.com/TCP_Socket_Listener,_Receive_Binary_Data_From_an_IP/Port_Into_UE4,_%28Full_Code_Sample%29
Follow this question
Once you sign in you will be able to subscribe for any updates here