Hey guys… i have a question don’t know if you can help me with it.
We’re developing a singleplayer game, and want to know where to put the logic for our Load and Save game (the progression of all the game, like collectibles found, stages cleared, etc).
Originally we wanted to do this on the GameMode and GameState (gamestate having the variables, and gamemode saving those variables via a SaveGame object or FArchive). The problem is that we want that data to persist on the user session (when he loads the game), but i’m pretty sure that the GameMode and GameState objects get re created everytime you load a new level.
How would you guys do that?, would you use gamemode with a PersistentLevel that never really unloads?. Would you use the GameInstance to store the data?
Pretty much everyone uses GameInstance for situation like yours.
I would keep on using PlayerState tho, in case coop/multiplayer is wanted later on.
Hey there! [USER=“434”]BrUnO XaVIeR[/USER] awesome that you answered me jajaj.
Yeah! i’m thinking on mantaining the playerstate and gamestate, but mantaining the persistent Data on the gameinstance, and just loading it when the gamemode changes (due to changes in the level). Now with that in mind… i’m lost on this topic:
Because chosing between doing 1 persistent level gamewise vs 1 level per stage (as in a mario game for example)… some things do change.
- 1 persistent level i can use the typical transition stage for loading, but it’s more messy for a stage bassed game
- 1 level per stage is cleaner, but the gamemode changes on every change (do correct me here, i’m pretty sure that’s the case)… so for a Loading Screen solution i would have to do something like a MoviePlayerModule like this GitHub - ue4plugins/LoadingScreen: A plugin for Unreal Engine 4 to expose simple controls for managing
Hope you can just point me in the right direction, if it’s not an issue…
thanks a lot!
Yes, when you load new persistent level everything GameMode is wiped then reloaded.
GameInstance and Game Singleton aren’t part of World so when you change the persistent level those stay unchanged until game is closed.
[USER=“434”]BrUnO XaVIeR[/USER] Awesome… last question and won’t bother anymore… would you use 1 persistenlevel gamewise, or 1 per stage?
I’m pretty sure at that point is just a matter of preferences, but i’m just checking out before i commit the map hierarchy and cannot change it later
That is very dependent on the game design and your own preferences, yes.
For something like a platformer where levels are relatively short, 1 level per stage is fine; for a game where big levels can grow above 500mb in RAM usage I would plan on using level streaming as much as possible until reaching a point where some cinematic is played then a new persistent level is loaded.