Multiplayer - Counter Strike like round system


I am currently trying to implement a Counter Strike like round system, which resets the map state at the end of each round while preserving the GameState. It needs to respawn destroyed Actors, remove Decals, kill dynamically spawned Actors and open/close doors etc after each round.

I just can’t get it to work.

I tried to



bSeamlessTravel = true; 

but that just reloads the map and kills the current GameState - and I handle the RoundTime, CurrentRound and the RoundState (Buytime, InProgress, EndingSoon) in there.

I also tried


which just calls Reset() on every Actor, that doesn’t help much.

What is the best way to do this? Any help appreciated.

Thanks in advance.

Not sure but I think might be something you are looking for.

Thank you, and that is indeed what I went with for the time being. I just store the CurrentRound and load it back in and handle everything with the new GameState. Not sure if that will work with PlayerStates yet, have to test it a bit more.

But anyways, thanks to you and to Daekesh and HateDread from #unrealengine. First hurdle taken.

A quick update:

I kinda hacked it in using GameInstance. I whish there was a better default support for rounds and carrying over GameState/PlayerState, but some serious black magic did the trick.

I used bSeamlessTravel and RestartGame() to actually reload the map. Before I RestartGame(), I just save all necessary data to GameInstance and load it after GameState loads again.
To carry over the Player Score, I had to override GameMode::HandleSeamlessTravelPlayer(), because it called PlayerState->Reset everytime, and I only want to reset it if the last round was played out.

Ok, 4am in the morning. I need some sleep :slight_smile:

In fact, you should create your own gamemode that manage the round and between round reset all the actors that need to be reseted.

To identify them, you can make them implement a “Reset” interface, so in the “between round” game state, you loop over all actors that implement this interface and you call the “reset” function on it.

So the gamestate will persists until the end of the Match.

For information, you can look at what UT team did for their CTF gamemode, it might help you to understand the principles.

I kinda understand the principles and AActor already has a Reset() interface that does just that, but the default implementation for Reset() doesn’t do anything. Therefore for resetting every Actor, you have to implement alot of state handling, initialization and stuff. You also need to keep track of dynamically spawned ones Actors and ones that have been destroyed.

Relaoding the level and resetting everything to persistant values (stored in .umap) was just waaaay easier and more reliable.

But I will definately look into how UT handles CTF, maybe I find the missing piece of the default implementation.

Ok, I just checked UTCTF, and they don’t even use rounds in there. At least I found no indicator. Seems like you just respawn on death and the map stays the same until at least half time.