-
Notifications
You must be signed in to change notification settings - Fork 32
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
Implement Load Progress Tracking #164
Conversation
After testing on web there are two caveats that mean we still get some initial frame glitching while the page is loading:
|
OK I fixed the parallax background issue by loading the background image handles into the As far as the egui menu issue, I think we tackle that later as it's really a minor point for now, though definitely something to look into later. |
62584a9
to
91904ae
Compare
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.
Nice! 👍
91904ae
to
30b4a33
Compare
30b4a33
to
06e496e
Compare
This should be ready, but I'd like your buy off at least on the idea of adding a macro crate @odecay before we merge. |
06e496e
to
876eebd
Compare
Ah what happened here? I haven't had the chance to look it over and now see its closed. |
I'm in the middle of re-basing it, but I'm not sure why it automatically closed? Give me a second. |
There pushed the rebase. |
I'm not conceptually opposed to the idea of having macro crate. I've not written macros before but I looked over the macro code and it doesn't seem too bad. |
OK, then I'll merge this and as always we can change/improve later! bors r+ |
Build succeeded: |
PR fishfolk#164 broke hot reloading by accidentally triggering asset update events every time it would check the game load progress. This moves game load progress checking to a system condition instead with a read-only borrow to the game asset to prevent the issue.
PR fishfolk#164 broke hot reloading by accidentally triggering asset update events every time it would check the game load progress. This moves game load progress checking to a system condition instead with a read-only borrow to the game asset to prevent the issue.
PR fishfolk#164 broke hot reloading by accidentally triggering asset update events every time it would check the game load progress. This moves game load progress checking to a system condition instead with a read-only borrow to the game asset to prevent the issue.
173: Fix Bug With Hot Reload and New Loading Progress r=64kramsystem a=zicklag PR #164 broke hot reloading by accidentally triggering asset update events every time it would check the game load progress. This moves game load progress checking to a system condition instead with a read-only borrow to the game asset to prevent the issue. Co-authored-by: Zicklag <zicklag@katharostech.com>
Loading screen still needs to be implemented.
This PR implements a solution for tracking the load progress of game assets.
This works towards #161, but it doesn't implement the UI yet, just the load progress tracking.
It allows us to get the load progress for both
GameMeta
andLevelMeta
and adds logic to wait until game and level assets are loaded before starting the game/level. This time period should be replaced with a loading screen in a subsequent PR.Why This is So Complicated
Tracking the loading progress for the game is not trivial due to the fact that we have several different kinds of asset and handles referenced throughout the
GameMeta
struct at many different levels of struct nesting.My initial thought was to add a simple function where I simply manually return all the
HandleId
s in the various different parts of theGameMeta
struct in a vector. This instantly became very difficult because of how spread out between types the handles are. There wasn't a good way to know if I had gotten all the handles, and if we added more handles later, we would have to remember to update the list which would be horrible to manage and would almost surely become out of date.Instead, in this PR I added a
HasLoadProgress
trait that we use a custom derive macro to derive onGameMeta
and all of the structs that it contains. This ensures that all of the handles contained in theGameMeta
struct will be properly evaluated when checking load progress and it doesn't require difficult manual listing of handles.The cost is that we write a macro and add a macro crate to our codebase, but this took me less than a day, and it is a relatively simple macro. I think it turned out rather elegant and I don't know of any other reasonable alternative at this point, but let me know if you have other thoughts!