If I have game with dedicated server. Can I make to travel different players to different maps?
Yes you should be able to if you ServerTravel on the server side it self
Do you mean you want the server to be playing on multiple maps at once, and have different groups of players travel to those different maps, so player group A is playing on Map A of server A, but player group B is playing on Map B of same server A?
I’m not sure if it is possible. I think a Server can only play in one World at a time. A world is a container of Levels(maps) that have been loaded either as primary map or streamed in additionally.
So I think the answer is that no, you have to use another server to play a different world for the other group of players.
Somebody please tell me if I am wrong.
In the meantime if you don’t want to set up multiple servers, you could simply teleport the players of group B to a different place in the same World that is very far away so nobody from the first area can see or interact with them, instead of loading a new World (or you could stream in a level).
But if you do that way, then group B will still be playing in the same World, just a different area of it, so they will (I think) be playing under the same Game Mode and Game State.
So if each map has one server, different players play on different servers. When players move from one map to another, they need to switch to the new server. This official document tutorial tells us how to switch maps and connect to the new server, but it doesn’t tell us how to ensure that the connection is legal. For example, if a player modifies his or her character data and props when connecting to a new server, the new server does not know how many props the player in the old server has and what the character’s attributes are. We also need to enable the old server to communicate with the new server, passing player information to the new server. I may also need to send a key to this player and the new server to make sure that it is this player who switched the map, not the other player. What should be done in this respect? Specifically, how to make multiple map servers connect and exchange data to form a complete server containing all maps?
Thank. Can you tell me how to make a client transfer from server A to server B, with the transfer of some data.
One way is that you can have the Client use the Open node to open the other server’s static IP address. This will connect the client to the other server and enter the level that the other Server is playing on.
To move the client’s state/data to the other server you can store it in the Game Instance’s variables. Actors are inside of the World, and this includes Player State, Game State, Pawns, etc. So when the World is destroyed by leaving the level or the server that level is on, then all those things are destroyed on the Client as well. So if you store information in those then it will disappear before you connect to the other server and definitely when you load its World.
So copy those things you want the Client to remember, into the Game Instance. Then when the Client connects to the other Server and enters the same World on the Client side, then you can use the information in the the Game Instance and send that information to the new Server, and that new Server can replicate it to all the other Clients (mostly by copying it into the Server’s version of the Player State, Player Controller, etc variables that are set to replicate or repnotify, with some effects using MultiCast RPC for immediate effect only if needed), so they see you the same way as you see yourself. RepNotify functions for these important variables will make sure that other Clients joining late or who were not in relevant range when you spawn, see the updated info about your player.
If you connected via online subsystem to Server A, this doesn’t mean you have to use online subsystem to connect to server B, but the online subsystems do provide a means to FIND the other server(s), so you’ll have to figure out how you want to do that.
In that case you may need to separate the source-of-truth information about the players from the Unreal executable, to a database or files or something, that the game accesses to find out about the incoming player. Maybe even better if it is in a centralized location that all the game servers access.
So you have a player info server and before the player disconnects from game server A, then game server A updates the player info on the player info server for the player that is going to connect to game server B. When player arrives at game server B, then game server B queries the player info server for that player and applies the player’s attributes back onto their runtime actors.
In other words, use a separate server the same way you would use a gameinstance.
If you’re using an online gaming service like Steam, I think they provide a way to store player info based on the Steam account, used to identify the player, and assign that to the PlayerState. I’m not sure though because I haven’t used Steam yet or any other gaming online service (My experience so far is LAN only with no persistent gameplay-affecting attributes other than player team selection in team deathmatch)