Download

Reset game state/player without reloading level?

As the title says, is there a way to re-spawn (Single-Player) and reset AI position, physics position etc… without reloading level?

Yes, sort of.

In my implementation, I let the game state keep track of my dynamic actors. If its time to restore to a previous state, I go through and call destroy on all of my dynamic actors.

Then, I go through and spawn all of the dynamic actors I need in order to return to a prior game state, and then I set the actors internal data values (if I have to).

You can do all of this without saving to a file or reloading from a file. The specifics are going to be very particular to your implementation and game actors, so this is something you’ll have to think through carefully, particularly in regards to game state.

Each actor has a Function “Reset” (or OnReset in Blueprints), which gets called when you call “ResetLevel” on your GameMode class.

You can override them and do what ever you need and want within them.

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AGameMode/ResetLevel/index.html
https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AGameMode/ShouldReset/index.html

Does this account for the possibility that an actor was spawned during runtime?

If that Actor has an implementation of the Reset function, then yes, sure. Just destroy him in that function. And if the actor is placed and spawned, just use a simple boolean that saves of you spawned him or placed him. Then you can destroy him or just move him back to the place position depending on the boolean.