Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor serialization and deserialization system #20

Closed
shomykohai opened this issue Jul 6, 2024 · 0 comments · Fixed by #21
Closed

Refactor serialization and deserialization system #20

shomykohai opened this issue Jul 6, 2024 · 0 comments · Fixed by #21
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@shomykohai
Copy link
Owner

Describe the feature

Right now quest system provides a few methods to serialize and deserialize quests.

  • quests_as_dict(), which returns a dictionary with the pools as keys, and the ids of the quests as value.
  • dict_to_quests(dict: Dictionary, quests: Array[Quest]), which does the opposite of quests_as_dict: it loads back the quests into the pools based on a dictionary with the same format.
  • serialize(), which returns the quest serialized into a json object. Right now it export whatever variable is declared.

This system has to be refactored, first of all by giving a new name to quests_as_dict and dict_to_quests.
Then, add a deserialize() method to inject the json object data into the quests to load data (useful for saving/loading quest progresses)
Finally, make serialize() and deserialize() call a method on the quest itself instead of guessing which data has to be loaded. This allows to load data into declared sub-resources and provides more flexibility to the end user to choose which data has to be saved.

Why do you think it should be added?

Making QuestSystem as flexible as possible and yet simple is the main focus. Allowing custom deserialize and serialize makes it possible to choose which data is useful to be saved and reducing the save file size by filtering only the actual useful data.

@shomykohai shomykohai added bug Something isn't working enhancement New feature or request labels Jul 6, 2024
@shomykohai shomykohai self-assigned this Jul 6, 2024
@shomykohai shomykohai added documentation Improvements or additions to documentation and removed bug Something isn't working labels Jul 10, 2024
@shomykohai shomykohai linked a pull request Jul 10, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant