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

load tiles from network if they aren't in the local asset directory #19

Merged
merged 6 commits into from
Nov 23, 2023

Conversation

oli-obk
Copy link
Collaborator

@oli-obk oli-obk commented Nov 22, 2023

not pretty, but it works

cc #18
cc #5 (does not fix this yet, as we aren't caching downloaded assets locally yet)

this is very hacky and requires you to adjust your asset folder. You need to move everything from the models subfolder into the main assets folder. How this came to be:

  1. loading from the server uses some/path/x/y.glb.gz while loading from disk uses some/path/x_y.glb
  2. bevy tries to load textures and any other things required by a glb relative to the directory of the glb
  3. bevy_http uses the directory of the server for loading the glb but then sub-assets are loaded from the default path. This is probably a bevy deficiency around custom asset loaders.
  4. I created a fork of bevy_http that uses a placeholder string instead of a slash (but converts that placeholder to a slash before doing the network operation)
  5. but now (due to 3.) it looks for textures in assets/textures. So I moved everything up instead of trying to figure this out correctly for now. There are FIXMEs in the code so we don't forget.

@oli-obk oli-obk changed the title Autoload tiles load tiles from network if they aren't in the local asset directory Nov 22, 2023
src/tilemap.rs Outdated
Comment on lines 10 to 15
loading: Option<(IVec2, Handle<Scene>)>,
loading: Option<(IVec2, Handle<Gltf>, LoadSource)>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change from Scene to Gltf is necessary because I was unable to implement gz decompression for arbitrary handles. We'll be able to switch back to Scene in the future

@DerKarlos DerKarlos merged commit 4abd733 into DerKarlos:main Nov 23, 2023
6 checks passed
@oli-obk oli-obk deleted the autoload_tiles branch November 23, 2023 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants