Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Full reload or level reset before applying checkpoint?

I'm trying to understand when and where to apply my checkpoint information in a typical singleplayer character death->load checkpoint situation. I want to reset level state , but this could be any streamed area. I can serialize the relevant information just fine into my checkpoint, but it looks like I have to do a full server travel and world refresh to reset the state of the level.

The reset() function isn't implemented on many Actors and has no calls on components. I haven't fully tested this in a package build, but the current full reload seems rather slow.

Product Version: Not Selected
more ▼

asked Jan 30 '15 at 09:06 PM in Using UE4

avatar image

708 32 30 53

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

To restart the current game you can call 'RestartGame' from AGameMode. You can also just make a ServerTravel like:

 GetWorld()->ServerTravel("?Restart", bAbsolute);

I would recommend you calling 'RestartGame' and if case you want to control when to restart the game you could override the 'RestartGame' in your own 'AGameSession' class.

more ▼

answered Jan 31 '15 at 10:06 PM

avatar image

6.4k 127 98 606

avatar image dzeligman Feb 01 '15 at 01:21 AM

Thanks for the reply, but I already have code to do that. My question was more about the most efficient and quickest way of "resetting" level content and then applying checkpoint information. The quickest in terms of development time is to do a server travel and apply the checkpoint info. It appears the quickest in terms of loading and setup time would be to reinitialize all actors that need it via their Reset() function, cleanup all transient/dynamic actors and then apply the info.

I'm doing this for online co-op so everything has to replicate correctly too. For now the server travel approach is what I'm going with to save dev time.

avatar image Moss Feb 01 '15 at 11:23 AM

As you say, the only other way is to implement a Reset method in all your Actors if you do not want to reload the map.

avatar image dzeligman Feb 02 '15 at 10:13 PM

When applying checkpoint info do you do it before or after beginplay? In order for blueprint only actors to respond to saved property changes it looks like it needs to be pre-begin play and maybe after postinitproperties.

avatar image Moss Feb 02 '15 at 10:20 PM

You can do it in C++ in PreInitializeComponents.

avatar image dzeligman Feb 02 '15 at 10:56 PM

Do you deserialize all checkpoint info within RouteActorInitialize after preinitializecomponents? How is that handled with streaming?

My ideal world is I can load all actors, load my checkpoint info on top of actors that have it and then perform the rest of initialization.

If I need to do save fix-up in or around preinitializecomponents I don't see an easy way of either doing it in a batch or finding the specific save info for each actor from the checkpoint information. Streaming may also complicate these things.

If I introduce online to this it adds another level of complexity. bleh.

avatar image Moss Feb 03 '15 at 08:28 AM

It isn't trivial in any case, if you spawn all actors, load your data and the apply it to your actors you need to wait to start the match until this has been finished and all is synced between clients, using replication or loading all data in all clients at once, this way you would not requite to wait for network initialization. That's the way I did my last checkpoint system, spawning all actors and then initializing them in all clients at the same time. To make the game wait until you want to start it manually you can use the 'bDelayedStart' boolean flag in 'AGameMode'.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question