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

Save data updating #322

Open
Ruin0x11 opened this issue Apr 30, 2021 · 0 comments
Open

Save data updating #322

Ruin0x11 opened this issue Apr 30, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Ruin0x11
Copy link
Owner

Ruin0x11 commented Apr 30, 2021

The basic idea would probably be:

  1. Use binser to deserialize the raw Lua tables, but don't run any class deserializers.
  2. Trigger an event that manipulates the raw data to convert it to the desired format.
  3. Run the class deserializers on the raw data.

The raw data would be a set of Lua tables containing the version of the engine/mod that the data came from and the serial ID/require path of the class in its metatable or similar.

binser would be modified to no longer handle automatic class instance deserialization with this change. I think having our own Lua table to class instance deserializer would be best, given how robust the updating logic should be.

Also, this change would enable writing unit tests for save migrations, which is crucial for verifying correctness. The tests would supply the raw data that step 1 returns and verify that the final class instance returned by step 3 is properly converted.

The classes must be deserialized from the deepest nested property upwards, so that :deserialize() would be able to call class methods on child class instance properties.

@Ruin0x11 Ruin0x11 added the enhancement New feature or request label Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant