-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Asset system rework and GLTF scene loading #693
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
Conversation
I'm going to try to re-add WASM support by making the AssetIo interface async. |
8b2a5ec
to
f6e453e
Compare
I am trying to implement an archive, not exactly a GTLF, but imagine those world of warcraft fat files that are 2gb long and contain many assets, but you don't really need to load all of them. This system enables the load an asset that depends on more assets on a single file, so the archive needs to know the formats and type of all the sub-assets. Maybe I should use a I am not sure I understood this PR completely, and I am sure this PR definitely improves things, and maybe in the near future it will be easier to support my use-case. I am saying maybe because I am not really sure I understand everything. Sorry for the noise :) |
@anarelion You could probably do something like that with this pr (by implementing a loader capable of loading all of the asset types you need from a single file), but its worth pointing out that @kabergstrom has plans to add "pack file" support to atelier, which would allow you to "pack" all of your assets into a single file, then load from that in your released game. It might be worth waiting for the atelier migration so you can just take advantage of that. |
@cart thanks for your answer. I will try to pass sub-slices to other loaders |
f6e453e
to
8b775f2
Compare
8b775f2
to
7535408
Compare
0.3 removed At some point we need to block the game until the assets needed for the next gamestate are available. Are we supposed to register systems that emit events when our assets load? I think I'm missing a few pieces of this puzzle. |
@masonk we removed explicit blocking on asset io because it (1) causes hitching and is generally an anti-pattern (2) explicitly can't work in WASM due to how the runtime works. load_sync is "bad" because it blocks the event loop. People like it because the blocking makes it easy to ensure "game logic" happens after "loading logic". But we don't actually need to block the event loop to accomplish that outcome. Instead we just need a way to enforce the order of operations. We added States in 0.4 as a solution to this problem (and other problems). They enable you to have a "loading" state and a "game" state. Check out this example to see how you can use States to handle "loading" scenarios without blocking. |
Thanks, that states example with |
Updates the requirements on [petgraph](https://github.com/petgraph/petgraph) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/petgraph/petgraph/blob/master/RELEASES.rst">petgraph's changelog</a>.</em></p> <blockquote> <h1>Version 0.7.1 (2025-01-08)</h1> <ul> <li>Do not unnecessarily restrict <code>indexmap</code> version (<code>[#714](https://github.com/petgraph/petgraph/issues/714)</code>_)</li> <li>Export <code>UndirectedAdaptor</code> (<code>[#717](https://github.com/petgraph/petgraph/issues/717)</code>_)</li> </ul> <p>.. _<code>[#714](https://github.com/petgraph/petgraph/issues/714)</code>: <a href="https://github.com/petgraph/petgraph/pull/714">petgraph/petgraph#714</a> .. _<code>[#717](https://github.com/petgraph/petgraph/issues/717)</code>: <a href="https://github.com/petgraph/petgraph/pull/717">petgraph/petgraph#717</a></p> <h1>Version 0.7.0 (2024-12-31)</h1> <ul> <li>Re-released version 0.6.6 with the correct version number, as it included a major update to an exposed crate (<code>[#664](https://github.com/petgraph/petgraph/issues/664)</code>_).</li> </ul> <h1>Version 0.6.6 (2024-12-31 - yanked)</h1> <ul> <li>Add graph6 format encoder and decoder (<code>[#658](https://github.com/petgraph/petgraph/issues/658)</code>_)</li> <li>Dynamic Topological Sort algorithm support (<code>[#675](https://github.com/petgraph/petgraph/issues/675)</code>_)</li> <li>Add <code>UndirectedAdaptor</code> (<code>[#695](https://github.com/petgraph/petgraph/issues/695)</code>_)</li> <li>Add <code>LowerHex</code> and <code>UpperHex</code> implementations for <code>Dot</code> (<code>[#687](https://github.com/petgraph/petgraph/issues/687)</code>_)</li> <li>Make <code>serde</code> support more complete (<code>[#550](https://github.com/petgraph/petgraph/issues/550)</code>_)</li> <li>Process multiple edges in the Floyd-Warshall implementation (<code>[#685](https://github.com/petgraph/petgraph/issues/685)</code>_)</li> <li>Update <code>fixedbitset</code> to 0.5.7 (<code>[#664](https://github.com/petgraph/petgraph/issues/664)</code>_)</li> <li>Fix <code>immediately_dominated_by</code> function called on root of graph returns root itself (<code>[#670](https://github.com/petgraph/petgraph/issues/670)</code>_)</li> <li>Fix adjacency matrix for <code>Csr</code> and <code>List</code> (<code>[#648](https://github.com/petgraph/petgraph/issues/648)</code>_)</li> <li>Fix clippy warnings (<code>[#701](https://github.com/petgraph/petgraph/issues/701)</code>_)</li> <li>Add performance note to the <code>all_simple_paths</code> function documentation (<code>[#693](https://github.com/petgraph/petgraph/issues/693)</code>_)</li> </ul> <p>.. _<code>[#658](https://github.com/petgraph/petgraph/issues/658)</code>: <a href="https://github.com/petgraph/petgraph/pull/658">petgraph/petgraph#658</a> .. _<code>[#675](https://github.com/petgraph/petgraph/issues/675)</code>: <a href="https://github.com/petgraph/petgraph/pull/675">petgraph/petgraph#675</a> .. _<code>[#695](https://github.com/petgraph/petgraph/issues/695)</code>: <a href="https://github.com/petgraph/petgraph/pull/695">petgraph/petgraph#695</a> .. _<code>[#687](https://github.com/petgraph/petgraph/issues/687)</code>: <a href="https://github.com/petgraph/petgraph/pull/687">petgraph/petgraph#687</a> .. _<code>[#550](https://github.com/petgraph/petgraph/issues/550)</code>: <a href="https://github.com/petgraph/petgraph/pull/550">petgraph/petgraph#550</a> .. _<code>[#685](https://github.com/petgraph/petgraph/issues/685)</code>: <a href="https://github.com/petgraph/petgraph/pull/685">petgraph/petgraph#685</a> .. _<code>[#664](https://github.com/petgraph/petgraph/issues/664)</code>: <a href="https://github.com/petgraph/petgraph/pull/664">petgraph/petgraph#664</a> .. _<code>[#670](https://github.com/petgraph/petgraph/issues/670)</code>: <a href="https://github.com/petgraph/petgraph/pull/670">petgraph/petgraph#670</a> .. _<code>[#648](https://github.com/petgraph/petgraph/issues/648)</code>: <a href="https://github.com/petgraph/petgraph/pull/648">petgraph/petgraph#648</a> .. _<code>[#701](https://github.com/petgraph/petgraph/issues/701)</code>: <a href="https://github.com/petgraph/petgraph/pull/701">petgraph/petgraph#701</a> .. _<code>[#693](https://github.com/petgraph/petgraph/issues/693)</code>: <a href="https://github.com/petgraph/petgraph/pull/693">petgraph/petgraph#693</a></p> <h1>Version 0.6.5 (2024-05-06)</h1> <ul> <li>Add rayon support for <code>GraphMap</code> (<code>[#573](https://github.com/petgraph/petgraph/issues/573)</code><em>, <code>[#615](https://github.com/petgraph/petgraph/issues/615)</code></em>)</li> <li>Add <code>Topo::with_initials</code> method (<code>[#585](https://github.com/petgraph/petgraph/issues/585)</code>_)</li> <li>Add logo to the project (<code>[#598](https://github.com/petgraph/petgraph/issues/598)</code>_)</li> <li>Add Ford-Fulkerson algorithm (<code>[#640](https://github.com/petgraph/petgraph/issues/640)</code>_)</li> <li>Update <code>itertools</code> to 0.12.1 (<code>[#628](https://github.com/petgraph/petgraph/issues/628)</code>_)</li> <li>Update <code>GraphMap</code> to allow custom hash functions (<code>[#622](https://github.com/petgraph/petgraph/issues/622)</code>_)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/petgraph/petgraph/commit/2765d2a55044a35a20d95c50a2f318fbc3bb85f4"><code>2765d2a</code></a> Release 0.7.1 (<a href="https://github.com/petgraph/petgraph/issues/722">#722</a>)</li> <li><a href="https://github.com/petgraph/petgraph/commit/d341db9d18582cfcffebf320896947e55ecba09c"><code>d341db9</code></a> ci: downgrade hashbrown rather than limiting indexmap (<a href="https://github.com/petgraph/petgraph/issues/714">#714</a>)</li> <li><a href="https://github.com/petgraph/petgraph/commit/73c64b629f38dc8b0a8edc7550f16a662ed05c25"><code>73c64b6</code></a> Make UndirectedAdaptor & inner G pub (<a href="https://github.com/petgraph/petgraph/issues/717">#717</a>)</li> <li><a href="https://github.com/petgraph/petgraph/commit/d057429081bc02812d3605d1e7159f0e73361e51"><code>d057429</code></a> Release <code>0.7.0</code> (<a href="https://github.com/petgraph/petgraph/issues/713">#713</a>)</li> <li><a href="https://github.com/petgraph/petgraph/commit/13ebd7d2ddd4a1ac07a33606c0d4f82d342e5fa6"><code>13ebd7d</code></a> Release <code>0.6.6</code> (<a href="https://github.com/petgraph/petgraph/issues/706">#706</a>)</li> <li><a href="https://github.com/petgraph/petgraph/commit/159341e4af2a1292d8a1da428d64784e2dfc8ae5"><code>159341e</code></a> Implement DSatur graph coloring algorithm</li> <li><a href="https://github.com/petgraph/petgraph/commit/7fa3aac97168de7fca54644a5b45c464d5245535"><code>7fa3aac</code></a> fix: adjacency matrix for csr and adjacency list (<a href="https://github.com/petgraph/petgraph/issues/648">#648</a>)</li> <li><a href="https://github.com/petgraph/petgraph/commit/9fda6bbe2e52663d03317083d2623faa4f0d4cd4"><code>9fda6bb</code></a> Update gitignore with possible editor extensions to ensure they do not occur ...</li> <li><a href="https://github.com/petgraph/petgraph/commit/9b5837e395c342e9cb2e5a2b3870fa7ee6650ef4"><code>9b5837e</code></a> Allow clippy::needless_range_loop in benches</li> <li><a href="https://github.com/petgraph/petgraph/commit/ad9f83c2ae237ba6f5832a19f01ef8c3ae14dd19"><code>ad9f83c</code></a> Process warnings in 'test' target</li> <li>Additional commits viewable in <a href="https://github.com/petgraph/petgraph/compare/[email protected]@v0.7.1">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
I've been working with "resident asset-expert" @kabergstrom for awhile now to figure out the future of the Bevy asset system. @kabergstrom built atelier-assets, which has an impressive set of features and has basically everything a pro-grade engine needs from an asset system. While learning atelier, I decided to explore the space for a bit by experimenting with directly expanding the current bevy_asset with the features we were interested in.
After much discussion about adopting
atelier-assets
vs expanding the current system, we agreed that atelier was the best long term bet. @kabergstrom is alreading building the features Bevy requires into atelier (such as WASM support and loading assets as paths) and we expect to move forward relatively quickly on that. I will be lending a hand where I can. However the exact delivery date is undetermined.We have a number of scenarios that are blocked on the current asset system (GLTF loading is a big one). Rather than rush the atelier migration, I decided it was worth it to merge a subset of the bevy_asset improvements I made to unblock certain scenarios, and to ultimately make the transition to atelier easier.
This adds a number of major changes to the asset system:
It also adds the following:
Parent
would result in broken references. Components can now implement the EntityMap trait, which allows the references to be remapped during spawn