How to use gamemode in a large persistent world online?

Hello guys

I am wondering about how to use AGameMode in a large persistent world. I am aware of the concept behind GameMode but I haven’t been able to apply it successfully. Here is an example of what I am trying to achieve:

Intializing game world loads level and game mode,a large level with multiple players online concurrently that can log in and log out at will (actors despawn upon logout). Upon login the server will remember logout position and relay it to the client. My question is: what a gamemode’s purpose in this case?

I am still a beginner when it comes to applying UE4 in code as I don’t know where my start point is. An example in c++ would improve my understanding greatly. I looked for tutorials, example code and community existing projects but wasn’t able to find what I am looking for specifically.

Thanks in advance.

Take a look at these docs for a start:
https://docs.unrealengine.com/latest/INT/Programming/index.html

In your case you’d want to look into:

AGameMode::Login(...) // or Pre- or PostLogin

and

AGameMode::Logout(...)

You could save the position in AGameState, which is the replicated “state” of the game mode.

You will probably want to inherit from those classes. Any easy way to do so is this:

Some more references here: