-
Notifications
You must be signed in to change notification settings - Fork 774
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
Deprecate data_version
and introduce checksum
for DataPackages.
#684
Deprecate data_version
and introduce checksum
for DataPackages.
#684
Conversation
* Added a note about `data_version` is deprecated. * If `development_mode` is true, set the `data_version` to 0 for legacy clients.
…version` to 0 * Modified all existing worlds that did not set a `data_version` to 1, as that was the previous default.
data_version
and introduce checksum
and cache_safe
for DataPackages.data_version
and introduce checksum
for DataPackages.
Crossed out the stuff talking about |
This PR needs to be updated as the data_versions added to some games are outdated, and the version(s) in the docs are nolonger depricated but already removed |
Now that I'm back in action PC-wise, plan is to finish wrapping this up over the next week so we can have it ready to deploy when we're ready to do all the planned protocol changes. |
^^ And that was almost a month ago |
Yeah, my sense of time is bad. |
worlds/AutoWorld.py
Outdated
# | ||
# Deprecated. This is only used by older clients. Newer clients should be checking the checksum in DataPackage | ||
# instead. | ||
data_version: ClassVar[int] = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 currently still implies to embed the relevant game's datapackage into the resulting .archipelago file.
This PR should probably explain this or offer an alternative, as with this default and explanation I'd expect people to use version 0 now, as in not change it, which is undesired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully the changes to the comment should be more clear.
@@ -37,7 +37,7 @@ class Hylics2World(World): | |||
|
|||
topology_present: bool = True | |||
|
|||
data_version: 1 | |||
data_version = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should probably be in a different pull request as a bug fix.
The only reason it's working without this fix is that it's getting the 1
value from the base class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally this set data_version
to 0 as default to ensure new worlds were automatically in testing mode and that would have affected this world. It could be reverted now that I changed the default back to 1, but honestly it's such a small tweak that it's probably just fine in my opinion, but if you insist, I can revert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saying that it should be in a different PR is not saying that it shouldn't be in this PR.
It's not a problem if it's both here and in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i were to continue this - what is still missing?
Caching in the client,
caching in the server,
always including datapackage in generated games,
stripping datapackage when storing generated games on the webhost,
anything else?
Do we want to truncate the hash for filename (MAX_PATH=256 may be a problem for some games?) If so, wouldn't a web-safe b64 representation be less likely to collide even if stored CI?
>>> len(hashlib.sha1(dump.encode()).hexdigest())
40
>>> len(urlsafe_b64encode(hashlib.sha1(dump.encode()).digest()).rstrip(b"=").decode())
27
>>> len(f"C:\\Documents and Settings\\A Longer Username\\Local Settings\\Application Data\\My Great Client\\datapackage\\A Link To The Past\\{'0' * 40}.json")
168
hex would still kinda work in the worst case if we don't add more to it than I did above.
b183669
to
cb32925
Compare
At least now I know nobody tested it xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving in so far that I read through it. Unfortunately did not find the time for decent testing and doubt I will this week.
Co-authored-by: Fabian Dill <[email protected]>
While I don't fully understand the inner workings. I ran ror2 explore mode with this with the world removed and everything worked just fine. |
tested with KH2 same as kindasneaki with the same results everything works fine |
…rchipelagoMW#684) Co-authored-by: black-sliver <[email protected]>
…rchipelagoMW#684) Co-authored-by: black-sliver <[email protected]>
As discussed a bit more in Proposed Changes to DataPackage and Network Protocol in discord, I'm proposing we make the following changes to the DataPackage and Network Protocol to deprecate and eventually stop using
data_version
to indicate if a given world definition has an updated items/locations table. Instead, clients can reference thechecksum
of a given game and request the server for an updated DataPackage if it does not match their local cache'schecksum
.Then, a client can choose to override (or store additionally) that new DataPackage if thecache_safe
property is true as well. This can be helpful for games that are still in development or testing and there may be rapid change to the items/locations table and we don't want to cache every single change. In worlds, they can set adevelopment_mode
member toTrue
to indicate that it is notcache_safe
.Also made the updates to the documentation to show the new changes and which properties are deprecated to allow time for library and game maintainers to update before it can be removed entirely.
Updates to RoomInfo:
Updates to GameData (DataPackage Data):
The reason for this change is to hopefully avoid situations where integrators forget to increment the
data_version
and allow clients to be 100% sure that if their checksum matches the server, their DataPackage is exactly the same as the servers. This should incentivize library maintainers to cache their data as they can be sure the DataPackage has not updated.@Berserker66 @Ijwu @JarnoWesthof @black-sliver @KonoTyran @espeon65536 @FelicitusNeko @N00byKing as you all have libraries (or help maintain them) that I am aware of. I have the thread in Discord as well.