WasmPlayer: fix game resource images not loading#1784
Merged
Conversation
Resource registration was attempted before WorldModel.Initialise(), at which point ResourceGetter/GetResourceNames are still null, so no resources were ever registered as data URLs. Moving the loop to after Initialise() ensures the PackageReader has populated those delegates from the .quest zip file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Instead of converting all resources to base64 data URLs at startup, generate them on demand the first time GetURL() is called for each resource. This avoids loading tens of MB of images/audio that may never be used, while keeping data URLs (vs. blob URLs) so they embed correctly in saved HTML and survive save/restore. Also makes PackageReader case-insensitive and null-safe so resource lookups are robust regardless of capitalization in the zip. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WorldModel.Initialise()ran — at that pointResourceGetter/GetResourceNamesare stillnull, so nothing was ever registered and images 404'd_helper.Initialise(), then improved further with lazy loading:GetURL()is called, rather than all upfront at startupsrcvalues embed directly into the saved HTML — save/restore works correctly across page loadsPackageReadermade case-insensitive and null-safe for resource lookupsTest plan
/examples/images.questin WasmPlayer — images should display correctly🤖 Generated with Claude Code