x

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. 

How to save hundreds of peculiar variables, such as a barrel's contents on the other side of the world (similar to Skyrim/Oblivian save data)

Hey community,

So I ran into a predicament where I will soon need to be able to save all modified variables after playing a session of my game. The problem is there are a whole bunch of these variables. These variables can include everything from a random mob's position and health, to the contents of each and every one of the containers in the world, along your quest progress on one of the hundreds of available quest. So my question is, how can I successfully save these thousands of variables without the save game file exceeding 36 terabytes, and how exactly to go about it.

Any info is greatly appreciated!

Product Version: UE 4.11
Tags:
more ▼

asked Apr 06 '16 at 01:37 AM in Blueprint Scripting

avatar image

ABroman
7 4 4 6

avatar image JohnADaniels Aug 24 '18 at 06:09 PM

I am saving lots of objects transform data in a save file. The save file is huge, like 200 megs. I was bale to save about 1/4 of the file size by taking the item name out of the array and only saving it one time.

Is there any way to clean up the way the transform saves, I find it amazing that it will write the following information over and over and over, thousands of times which makes the save file huge.

It seems like ti would just be saving the actual transform XYZ coordinates and not all the other text which is just bloat.

Any help would be great!

`¸D€‰C úB Scale3D  StructProperty  Vector ? ? ? None Rotation  StructProperty   Quat €? Translation  StructProperty  Vector ²D€‰C úB Scale3D  StructProperty  Vector ? ? ? None

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

5 answers: sort voted first

For custom work, short of writing your own code/plugin, you are stuck with basic save game object. However, there are a couple people who have already written plugins for this very thing. There is one in the UE4 Marketplace called "Easy Save & Load" which can be found here: https://www.unrealengine.com/marketplace/easy-save-load and it seems to already be compatible with 4.11 (or so it says on marketplace website link above.)

There's another one, that seems far more comprehensive called "Savior". The forum postings of the developer can be found here: https://forums.unrealengine.com/showthread.php?88541-Plugin-Auto-Save-Game&highlight=savior but is not sold in the UE4 Marketplace but rather on Gumroad which the link can be found in the forum post or just click here: https://gumroad.com/l/uxnlQ

It doesn't state on the gumroad link if it's 4.11 compatible but I saw in the forum it was at least 4.10 but I see no mention of 4.11. He says that he will keep the project updated with every major release so I would expect it to be compatible soon if it isn't already. In either case, you could probably just recompile the plugin yourself to make it 4.11 compatible, assuming the devs didn't change any of the necessary Save Game API stuff (which I did not see in the release notes.)

I know these are paid options but as I mentioned, short of doing all the C++ (or extensive BP) work yourself, these are probably your best options.

Hope this helps! Don't forget to accept the answer if it does! Thanks

Jesse

more ▼

answered Apr 06 '16 at 02:15 AM

avatar image

jtsmith
1.4k 70 29 92

avatar image ABroman Apr 06 '16 at 02:31 AM

So if I were to purchase "Easy Save & Load" and implement into my game, how would I save the contents of all of the container scattered throughout the world? Would I have to make an array of all of the containers and their data structs and save it to an array variable in the save game object? Or would saving this array of structs be too hefty?

avatar image jtsmith Apr 06 '16 at 03:05 AM

Honestly I've never used either of these plugins. I've read up on the Savior one, which is pretty robust (one I plan on purchasing when I'm at that stage) and the developer of the Easy Save & Load has a website with instructions/videos on how to use his plugin (Savior has a video as well), which can be found on the marketplace page or just click here: http://www.mamoniem.com/products/easy-save-load/

I would suggest reading up on both of them to see which works best for your needs. I personally like the Savior (from what I read) because it let's you save every single actor, specific blueprints, specific variables, levels, locations, rotations, scales... Nearly Everything and it will just do what it needs to do to save everything for you without worrying about anything. From what I read on the Savior, simply click the "Save Game" box on each variable you want to save and the plugin will do the rest. The only problem he says he has in the plugin is saving Structs but he offers ways to work around this. Again, I suggest reading the Savior forum posts to learn about that and go to the other website to learn about the Easy Save/Load.

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

i don't recommend you save any vector locations, just save the number of the last entrance the player walked through. Mobs and NPCs shouldn't save health or location, just a single boolean representing alive or dead. when the game loads, if they are alive, give them full health. their locations can be generated with random logic and the player wont know the difference.

if you used Zelda like chests, you could just store a boolean representing whether its opened or not, but if each chest has multiple items, and the player can choose to take some of those items, you will need to keep track of alot more data. to optimize things, you could place some limitations on container rules, like only allowing the player to remove items, and not allowing them to put items in, and limiting the containers to a maximum of 8 items. this would allow you to store each removed item as a bit, making each chest a single byte. when the chest spawns into the world, it can check these bits to decide which items to remove from its defaults.

when storing items in your player's inventory, you should only store the ItemID integer, and for randomized loot, you should store the random seed integer, instead of storing all of its base stats. if you want to store things with stats that can be leveled up, they will take up a lot more data. stacked items can be just an ItemID integer and Amount byte. never store names of things, unless the player can design those names in game, and if they can name their avatar, put a tight limit on character count. for all other names, they can be looked up using the ItemID.

i recommend storing all of this data in a single struct called Data, inside an actor called Inventory, which you can spawn from you player controller on begin play, and load its data from your SaveGame file. this Data struct can contain arrays of other structs, or arrays of simple data types. for example: the chest format i described above, could be an array of bytes. when you enter a new area, your inventory can get all actors of Chest, for each Chest, get the ChestID, and use that as an index to Get a byte from the array, then do some math to break the byte into bits, and starting at the end of the list, remove the items at each index corresponding to the bits that are true. enemy spawns work the same way.

more ▼

answered Apr 06 '16 at 03:10 AM

avatar image

ScottSpadea
9.6k 319 205 449

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

In Blueprints? You're kind of stuck with SaveGame objects. They're pretty good and they handle arrays, so you can stuff a lost in there.

If you're willing to go the extra mile, in C++ you could write your own save system and compress it. It's more likely to get corrupted though and you would have to properly test it.

I really doubt that your save files could become huge. These variables are not big, if you save locations and states via variables such as booleans and vectors, I doubt it'd become huge.

more ▼

answered Apr 06 '16 at 01:50 AM

avatar image

keyle
1.8k 65 27 89

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

I know this is an old topic but believe that the best way to organize your data is to divide it into categories and then make structures in order to save it structured. Then for loading the content or for saving it, you might manage to do it quite simple by breaking the structure down into the variables and you can have everything nicely wrap up. You set up the structure and then assign the type to the variable on the SaveGame BP.

Here's a good post get into the topic, in case anyone needs some extra information.

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/28614-how-do-blueprint-structures-actually-work

more ▼

answered Dec 02 '18 at 06:27 AM

avatar image

Georgecirilo
6 1 2

avatar image JohnADaniels Dec 03 '18 at 08:37 PM

That is what I ended up doing and it. Worked perfectly in BP with a small save file size.

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

Know this is an old question, buuut- you could probably get away with using xml or some kind of spreadsheet for the starting inventory. Then your save-game would only need to store if said content's changed since starting the game. That's pretty much how it's done in the particular games you've mentioned.

more ▼

answered Oct 13 '16 at 07:37 PM

avatar image

king-worm
60 4 5 8

(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