Best way to store removed nodes for saving?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By anssiko

Hi,

I have a turn-based game with several characters with stats etc. At the moment my save script runs at the end of the fight, and saves all nodes belonging to class “character”. This leaves removed nodes out. I want to save both removed and remaining characters at the end of a fight, to award xp ad so forth.

What is the best way to go about this? I have some ideas on how to proceed, but I’d appreciate some confirmation from someone with exprience and insight.

a) Have a boolean variable “injured”. This would require a lot of checks with turn system, pathfinding etc.
b) Re-instance injured characters to an invisible node, and read them from there for saving.
c) Append the removed characters to a list, and re-instance them for saving.
d) Save all character experience (or other relevant info) to singleton, and save the information from there at the end of a fight.

Thanks for any input!

:bust_in_silhouette: Reply From: JimArtificer

Don’t overthink it. Since this is a relatively simple problem I think most of your suggestions would work fine.

If you asked me this question without providing options I would probably just suggest keeping a list of the defeated enemies and use that list to calculate the experience/treasure/etc after combat.

Thanks. I’m going ahead with a dictionary of sub-dictionarys per character, and copying that to a singleton at the end of a battle.

anssiko | 2020-07-18 04:58