Map/World/Level misunderstandings


I´m a bit confused. I wasted hours and hours for researching this little understanding problem.

First of all, I have a few general questions:

  1. The UWorld class seems to be a class which I do not have to override. Is this right? How should I implement special behavior for the worlds (which I can use again in an other world)?
  2. Which is the class for the maps, is it Level, or World or anything else?
  3. The Level classes are only for streaming large Worlds?
  4. The WorldContext is also only for streaming?

Now I try to explain, what I want to do and where my problems are.

I want to create a little multiplayer game. The players have no visible actors in the World, they just exist as SpectatorPawns and can move and look around in the world. So its absolutely uninteresting where the players are. In this world, there exists some buildings, and all of this buildings have their own indoor map (or possible more than one). This maps can be entered of the players, but the other players should stay on the maps where they are.
So, here is my Problem. Where should I implement my GameLogic? I currently have a custom AGameMode object as my game logic, but as I understand it the GameMode changes when I enter a new map. Is it possible to have two or more maps open on the server?
And how do I implement a client map change in c++? I see many methods in a few classes, but they all seem to be not the right.

I’m no expert but I don’t think that a server can have two different maps running at the same time - you’ll probably need a different server for each one. Normally what you would do is setup the first world you describe with the spectators as it’s own level, and then when the player enters one of the buildings transition that player to a new world.

Ok, i think i have an idea to solve this Problem and the engine Design becomes a little Bit clearer. I am going to try a little Bit around, perhaps My idea will work :stuck_out_tongue:

I don’t have too much experience with this so I might be completely wrong with the following.

I believe APlayerState will persist as long as the player is on your server so you may want to use that to keep track of what players are doing.

UWorld		 ::ServerTravel(...)	
APlayerController ::ClientTravel(...)	
UEngine		 ::Browse(...)
UEngine		 ::LoadMap(...)	

I believe from these you can use Browse(…) as it changes maps locally, but keeps the player on your server.

Thanks for this reply.
But now I am in trouble with my GameLogic. Like I explained, I build a multiplayer game, but you can also play it as a singleplayer!
The game is divided into different days, which I have to calculate on the server. So, where do I have to place my gamelogic? The Gamelogic should only be used on the server (the DayTime and other stuff should be replicated). I tried to put it into the “GameInstance” class, but this class will not be replicated…
The GameMode/GameState is also not the correct part because each World has its own and the players are able to change the world.
So, which is the common way to go here?

Use gameinstance to store data, read that data in your gamemode and set variables in gamestate that are replicated. So gameinstance stores data that gamemode passes through to gamestate which replicates to the clients?

Can’t recall if gamestate is replicated or not?

Sry, but this sounds like a really hacklicke solution. Is there no proper way to run a script on host only and replicate some variables to all clients? I am totally confused…

I’m not sure exactly what you’re trying to do, but it looks like you want to load maps but only on the client?

You might be able to use level streaming on the client to load the map without loading it on the server.