I have a game where you are in a main level. This level is where you will spend most of your time. During the gameplay, you spawn actors, wherever you want, and they are to stay there (unless you want to destroy them). These spawnable actors are the basis of the entire game.
I plan to have it so you can find little challenges. These challenges will open a new level that is specifically a challenge level. When you are done with the challenge, you will go back to the main level. It is crucial that the previously mentioned actors, and everything else in the level, are exactly as they were before you went into the challenge level.
When the player completes a challenge level, and I open the main level again, everything is reset to default. This makes sense, but like I said, this cannot be the case. Everything must be as it was before.
I tried looking up some videos about saving levels, but it seemed like I needed to store EVERYTHING i wanted to be the same as a variable and reset variables and respawn actors and everything manually. Is there a way to accomplish what I need: save the level so you can return back to it how it was? And when you complete a challenge level, I can just do like an “open main level save” kinda deal?
Thank you for any input, it is greatly appreciated :^)
I was under the impression that Unreal would have some sort of built in “save all” mechanic to make it easy to deal with changing levels and all that. So do I have to pretty much make all of that myself? Not trying to sound cocky, is a genuine question. Am willing to take on the challenge, but was not anticipating that.
This kind of makes me wonder though, if someone is playing the finished game, and reopens it, how would their whole progress be saved? Wouldn’t the game just go back to its default thing before the player started doing anything (spawning actors)?
Short answer, yes you must implement the save system that you want. Generally a level should represent the default state of your level.
Think of a game like Mario. Each level has a default state that you start in and play through except you picked up X number of coins in the level. So you don’t need to save all and waste a ton of disk space, you just need to save the state of the coins, and when the level is loaded you read the save and apply those settings back to the coins.
Save all is too heavy handed and hence probably why there isn’t a solution for that out of the box.
Do you think something like this could work to properly save the progress of my level?
There are different kinds of actors the player can spawn. So there would be a class, it would contain two variables: The type of actor spawned, and the location of the actor.
Whenever the player spawns an actor, it’ll create a class variable thingy, assign it the proper actor type and the location of where it was spawned. It would then add this specific class variable thingy to an array of those class variable thingies.
Then, whenver the player leaves the level, and then comes back, it’ll go through every element in that array, spawn an actor of whatever type at whatever location, for all of the actors in the array.
You have the right idea. Generally speaking when working with anything deriving from UObject, all Properties can have a SaveGame flag added to them that will allow you to serialize only the specified properties of an object.
Your solution is acting like a save manager, which is fine also. I would suggest if you go that route to make a generic interface that is used for saving.
imma be honest i dont know what a lot of that means, i’m very new to UE4. Appreciate the response though and will look over stuff and see how i eventually want to tackle it
I would suggest for you to try to implement all the system you think you will need on a very very small scale before diving too deep into one direction. You’ll get more done in the long run, especially in unreal.