GillianYue / Bubbla

Repo for my independent spaceshooter game, Bubbla.
0 stars 0 forks source link

Quest Save Load #98

Closed GillianYue closed 4 years ago

GillianYue commented 4 years ago

Currently, quests are loaded in at the start of title scene via one single csv file.

Let's think about how we should approach this. If this is handled, then the storage of other kinds of data can follow a similar pattern.

So the quests are universal in the sense that there's a place where one copy of ALL quests ever existent is stored, and each player stores their own progress of what's completed and what's not, what's available and what's in line of getting done.

And so I think that during title scene load we should check for all conditions and compare between the "official" quests and the player's progress and make the corresponding changes (some quests made available b/c of new conditions, some quests completed compared to past run; etc etc.)

GillianYue commented 4 years ago

Quest is a class, can be found in QuestLoader. The csv file is now officially in charge of storing ALL quests, and they will be loaded in by the loader, and after parsing the loader will hold on to a long array of Quests. The title scene will wait for questloader to be done parsing and Save/Load to be done loading quest progress then compare the two to figure out what to display.

Quest (loader) is there, till need to work on S/L and compare

GillianYue commented 4 years ago

Apparently saving requires that all objects within the save data to be serializable. Color, for example, is not a serializable type. However, we can make "Color" serializable via implicit casting, see here for how-to

Same goes for Vector2, a script called SerialzableProperties created for those conversion classes

GillianYue commented 4 years ago

the saving files are saved to Users/gillianyue/Library/Application\ Support/DefaultCompany/Bubbla

lib is hidden in finder so use terminal to delete files

GillianYue commented 4 years ago

and YES, it worked. Currently it only saves in test mode when key "s" is pressed, but you know