Recent update information (2016-03-16) - here!
During gameplay scripting there often surface a need to remember a state of levels when traversing between them or to save and load this data to a file. Moreover, many elements of the virtual world need to change according to progression of the plot. This system was created to be a foundation which solve these issues. It is created entirely in BP.
What you can do with this system:
- Keep state of your levels when traversing between them (supports streaming levels as well).
- Create game based on quick save/load feature or checkpoints.
- Decide for yourself which data in your objects is saved/loaded.
- Script virtual worlds changing with the progression of your game using plot facts.
Additional features:
- Support for spawned objects and destroying objects originally placed in the level.
- Spawned objects can be attached to parents placed in the level, which allow to attach them to streaming levels or destroy them with their parents.
- Optional plot facts validation with data table imported from CSV file for better control over your documentation (plot fact will not work without being placed in the table first).
**Original post:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -**
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Hello everyone!
For some time already I work on a foundation to build a game on. It allows to script game progression and save/load its state at any moment. I would like to submit this Blueprint to the Marketplace, so I decided it’s finally time to show results of my work to you and gather some feedback when I put some finishing touches.
First short video. It’s just a quick recording of the BP in action, I will definitely create a project and a film better showing each feature later. I suggest watching in full HD to see log entries in upper-left corner of the screen (“Game Saved” / “Game Loaded”). Sometimes I load a few times in a row to show it more clearly.
What you see here is a project with two main maps. The first one includes all important content, second one (1:05) is there just to show BP remembers state of the objects when player traverse between levels.
Game progression is based on facts array - when something happens in the game, for example our hero just reached Volcano of Doom, a “fact” is placed in an array for game to know this event already occurred. It is possible to create CSV data table to validate these during gameplay (if you want to be sure designers document facts before using them in game).
There are four types of objects that need to be saved to a file:
- Plot Objects - they have a scripted state for every plot fact that they are subscribers of (the system uses events to call them) [0:42, 0:56 - plot facts are triggered by volumes on the top of each stairs and Plot Objects change colour after being informed about activating their facts];
- Dynamic Objects - they initially exist on the map and have their variables we would like to save and load (“Dynamic” is just a name I chose, they can be static geometry) [every white cube with a sphere inside on the film, 0:30 - as child component, 0:32 - as a BP instances];
- Spawned Objects - they initially don’t exist on the map but we would like to preserve them in a save game file [each sphere spawned below a moving cube];
- Player Character - our pawn.
Three latter can be a Plot Objects as well but they can’t be “blended” with each other. System also supports Streaming Levels (but they can’t be Always Loaded due to a bug (?) I described here - Event Begin Play in Always Loaded Streaming Level - World Creation - Epic Developer Community Forums). When you spawn anything in UE4 it is always spawned in Persistent Level so I created a way to attach Spawned Objects to a parent. It’s an option, as seen in the video these objects can be preserved in different ways - without a parent (1:25 - two on the left), with a parent but not saved after leaving streaming level (1:25 - two on the right), with a parent and saved after leaving streaming level (1:51) and I work now on preserving them in a save game but not between Persistent Levels (for example a mighty fireball your enemy is throwing when you are about to switch between maps - it would be funny to find it still flying towards you after some time and returning to the same place).
System also remembers which objects initially placed on the map were destroyed. For it all to work you only need to inherit a class for Dynamic Objects and Spawned Objects (and override Save/Load functions to manually get/set your variables), add some nodes to your character and Plot Objects. I still work on making it as easy to use as possible. I still need to check if new changes in the components (UE4.8) will allow for some interesting modifications to the system.
So, what do you think? Sorry for such a wall of text, I will do my best and compress it into some nice features list later this week. First of all please let me know if you are interested in such system created entirely in BP. If you have any questions just let me know.
PS
Also this bug need to be fixed for player character to spawn correctly after load in a packaged project: