Download

Single player RPG: Using a persistence level & save/load game object when switching between levels.

**Please help me contribute to this thread. **

This thread discusses the following concepts for a single player RPG:

  • A dedicated, persistent level to store data that is never destroyed throughout current session of the game.
  • Saving data to a save game file and loading into a persistent level later on.
  • Level streaming on top of your persistent level.
  • Loading and appliying customization to the players main character one time when the game loads and keeping it in the persistent level.
  • Remembering inventory, equipment, gear and things you pick up.

Q: Why is a persistent level important for a single player RPG?

The persistent level is a level that never gets unloaded when you start a new game or load an existing save game. Once you load a persistent map via the “Open Level” node, you can then load or unload other streaming maps at will via the “Load Streaming Map” node. Maps you load in this manner must have been added as streaming maps to the persistent map using the “Levels” window dialog, and have had their streaming method set to “Blueprint”. Ideally, you only place objects in the persistent map that are required to be there for all maps. Otherwise, persistent maps should be empty.

Q Where do I store character customization information?
A: To a save file by creating a save game object class. This information is loaded into your persistent level and applied to a pawn character. This pawn character will stay in the persistent level and never be destroyed and won’t need to be reloaded nor have it’s customizations re-applied.

Q: Where do I store story plot flags?
A: This is the same concept. To a save file by creating a save game object class. This information is then loaded into your persistent level and loaded into your plotFlagList which can be in a blueprint in your persistent level.

Q: Where do I store a list of acquired items the player has found?
A. Read the answers up above, it’s the same as any other data. Save the info to your save game file. When the player loads a game, the data is then read and stored into a blueprint in your persistent

Q: Where do I store a list of all NPCs whose location can change constantly from level to level?
A: Hmm, this is tricky. You can’t store every NPC in the entire game in your persistent level. When level streaming, you’ll load a new map into your persistent level, during this time you can decide what NPC’s need to be loaded into that area, if the loading time is long you can switch to a loading screen. Let’s say NCP’s travel from city to city, you’ll have to go through an array that keeps track of their locations to see if they needed to be loaded into the level you’re loading.

SCROLL DOWN FOR VIDEOS THAT DISCUSS Persistence, Save Game Objects when switching between levels for single player RPG

Remembering variable data between levels.

UE4 - Using Game Instances & Persistent Variables
https://youtube.com/watch?v=K_4CWDxwufg

HTF do I? Save Variables between Maps ( UE4 )
https://youtube.com/watch?v=XjPdyoy7ySo

So far my conclusion is to use a combination of gameInstance and a custom Save Game object class to ensure persistence across map levels.

Here is another helpful video, probably the most important one:

Unreal Concepts - Persistent or Saveable Objects ( UE4 )

https://www.youtube.com/watch?v=YrdEha-Ogc8

Saving a game to a custom SaveGame object
https://docs.unrealengine.com/latest…ame/index.html

Here’s a good explanation on GameInstance vs GameState I found on this forum:
https://forums.unrealengine.com/deve…266#post672266

When switching levels how do you keep the pawn character persistent so you don’t have to re-apply character customization?

I found it, I hope this helps anyone:

https://forums.unrealengine.com/deve…697#post833697

I found this one by UnrealGaimeDev on 6/8/18 which is prolly the best I’ve seen - Info seems to be in the ‘Top Secret’ drawer along with saving methods other than click ‘s’ button to save type crap:( .
Sorry - I’m a noob and it’s been a long day of failure - but I’m lovin it!
If anyone can point me to a tut where you can have multiple save slots each with a player entered name I will love you forever!
https://www.youtube.com/watch?v=D1O-faDNg_g

I have found this useful:

Thank you OptimisticMonkey - that looks really good - is there detailed documentation included?