Open Level after character select screen puts player in own world(should be Multiplayer)

Hello.

I created a character select screen, theres 4 characters. This is on its own level.
If I sumulate multiplayer on this level, all players start at the char select screen in the same “world” so this is fine.

After a selection is made,

  • I set a variable in game instance to log the character choice
  • then open the starting level using ‘open level’
  • in the blueprint of the starting level, the variable in game instance is got and using that it spawns the actor then possess the actor

This works for all players, except once they get to the next level… they cant see each other anymore. Its like it loads 4 different instances of the level rather than all of them into the same one.

If I start the game from the new level (not using char selection) all characters start together(as the same default skin set in default pawn). But they can shoot and kill each other as per expected.

In the spawn and possess functions, I’ve tried running on server, multicasting, separating the functions and trying variations and they all give the same result… correct character spawning and possessing in their own world.

Hopefully someone can help. Let me know if anymore information would help.

Just using Open Level for each individual player making their selection will load into their own levels.

For multiplayer one player has to start the game as a server and there are multiple ways you can do that in blueprint.

The easiest way to start a server is to use the Execute Console Command node. The command you would want to execute to load the level as a server is: open MapName?listen. This will create a listen server that other users will be able to join. For a user to join that server they will have to use the Execute Console Command node with the command: open ipoftheserver. ipoftheserver should be the IP of the hosts computer. You would have to modify your menu for players to specify if they want to start as host or join an existing server.

The other way would be to use Online Session Nodes which you can read about here. Online Session Nodes | Unreal Engine Documentation

hey nyu,

thanks for the prompt reply.

I didnt know about the OnlineNodes. I’ll have a read on that.
Few things though.

For testing now, do I have to create a build everytime then and run three instances? I thought adding players and dedicated server check mark, simulates that.

Also:
After the player makes their selection, instead of opening the level, I’m assumign thats where the host or join session comes into play, assuming join… do I still spawn and possess the actor from the level blueprint as I’m doing already?

You should be able to continue testing without having to build each time. If one window starts a server as host, the other windows open should still be able to connect.

You will most likely have to change how you handle your character select menu now. You should turn your selection menu into some form of lobby. Players all start a separate menu where they can choose to host or join. If a player hosts they will open the server and load into the character selection level. From there others will be able to join the host on that level and pick their characters.

After the character selections menu the host should be able to load into the level where characters will spawn and they can start playing. The host can initiate a console command called ServerTravel which allows the host and clients to load a new level without any disconnects and saving player info. UWorld::ServerTravel | Unreal Engine Documentation

Thanks Nyu.
I think you’re on the right track.

I found this recent tutorial which is good start. I went through it.
I’ll attempt to merge it with my char select screen. IF I’m successful I’ll post results and mark this answered for others