I’m using blueprints and I only have one level in the whole game, so there is no need to store variables between levels. Also this is single player so no replication.
I need to keep track of variables like hour, minutes, seconds, the value of an enum that defines the periods of a day such as morning/evening/etc , health, equipment, inventory, etc. These many variables are in many different blueprints and somehow I have to connect them to the save game blueprint.
I’m currently using different blueprint interfaces (not functions inside an interface, but rather different interfaces), to connect each of these variables to their equivalent variables in the save game blueprint. I’m using one interface per blueprint that needs to communicate with the save game blueprint. But I end up having A LOT of interfaces and it gets confusing quickly. Is there a better way?
Also, I think that save game blueprint does not keep track of object references and ignores them, so how am I supposed to store references of the equipment I have and the inventory too? Should I index each piece of equipment so to store the index and then send it back to the character BP upon loading the game?
You can have a single float variable to increment and from it calculate hour, min, sec and period of the day based on a range to only have to save a single variable.
I’m personally a fan (so far) of designing systems around save game. A few getters / setters go a long way in helping keep everything in one place. This makes save game like a hub everything pulls from without copying. Actors with unique id can use it as key to get x values, for example, and don’t have to worry about getting anything when saving since its all already there… with a few exceptions.
If you could list or give a few examples how it is right know perhaps we could be of more help.
Clock BP:
Every second the first delay delegate triggers the custom function that starts the count of seconds at the bottom right. Second delay is an autosave that every 600 seconds (10min) triggers a custom event that exectures a blueprint interface that connects with the save game blueprint (see below). The other event is the one that connects the menu (widget button in specific) to the save game menu. I thought that this way I would have 2 ways to save: auto save every 10 min. and manual save.
Continuation. Depending on the hour range, set an enum to a time period of the day such as morning, noon, evening, etc. At the bottom right, set hour to 0 when it reaches 24.
edit: I have noticed that I do not have used messages for calling the BPIs, rather I have called them as if they were custom events? Visually shouldn’t there be an envelope on the top right of the call node? Is that the reason it’s not executing the logic?
int32 can go up to 2,147,483,647. As seconds thats 596,523 hours, 68 years. If more time is needed than perhaps a float might be a better option. I find this way easier to manage.