Hi there, I know the system in Unreal with blueprint by using the node save game to slot etc. I watched some tutorials about it but it’s still unclear to me since every tuto I watched shows the same. A simple store value for one actor into a slot/variable. My question is, I am currently developing a puzzle game in which a lot of object, light etc will be moving a lot. Do I have to store every single actor inside each different save slot with a different name? Or save all the same actor type inside an array ? Or does it exist an easier way to do it. I’m pretty noob in term of saving loading system. Also for loading, do I need to have in each actor a “begin play” that loads the position of the actor based on the save file?
Thanks a lot for your help. I m a bit confused here.
You have to store all the required info to regenerate the world as is. For example, let us say you have 1000 cubes of size <1, 1, 1> in your world that you want to store. You have to write down 1000 vectors and rotators that you can use to spawn the actors where they used to be when you saved.
If each actor has a scale and a special mesh, then you have to find some way to encode the mesh, maybe as an index in a mesh array, and store that with the scale.
I hope this makes it a bit clearer.
But when do I store the vector of the cube. and then how do I tell that this specific vector stored is for this specific cube? That’s where I m a bit lost
That is up to you. Just like you store that single float, you repeat it and store all the data. How that data is structured you decide and you have to write and read in a manner that agree on the structure of the data. FOr example, first you store an int telling you how many vectors there are, then that number of vectors follows. When that is done you read the name, size and other properties of your character. etc etc. You structure the data and you have to write code that writes and reads the data the correct way.
Once read you just spawn characters and actors and whatnot and set the correct values based on what you read.
Ok I will give it a try. At the moment I m trying to store the vector of my cube into an array based on integer tag, then when I load the array, I m getting the vector based on the tag index based of the array, to try to get multiple vector and have a kind of “automatic array system” based just on the tag. Then when I add a new cube I always add +1 on the tag so it’s saving a new array index. Kind of tedious but I might get it working
That s a nightmare, I m trying many different ways, but I m a bit lost… I m doing it wrong, I never did saving before…! Here is what I m trying to work on just to test it if it works. alt text
Consider using a STRUCT stored inside a MAP of STRINGS. In my opinion, it’s the best way to save and load data.