Crates.io | leafwing_manifest |
lib.rs | leafwing_manifest |
version | 0.2.0 |
source | src |
created_at | 2024-04-17 22:18:02.289731 |
updated_at | 2024-07-07 15:22:26.306075 |
description | A flexible crate for managing game assets that share a common structure. Manifests are generated from on-disk data, and offer a straightforward way to quickly look-up and generate game objects. |
homepage | https://leafwing-studios.com/ |
repository | https://github.com/leafwing-studios/leafwing_manifest |
max_upload_size | |
id | 1211838 |
size | 202,317 |
leafwing_manifest
is a straightforward, opinionated tool to transform "assets on disk" into flexible, robust objects inside of your Bevy game.
There are four key concepts:
Resource
which contains a mapping from identitifiers to items.Data is deserialized from disk into a raw manifest, which is processed into a manifest which contains a list of all available game objects of a given class. That manifest is then used to spawn and look up the properties of specific kinds of game objects in your game code.
bevy Version |
leafwing_manifest Version |
---|---|
0.13 | 0.1 |
0.14 | 0.2 |
An in-memory resource where you can look up the statistics for various game objects is incredibly useful:
For more background reading on why this crate exists, and the design decisions made, check out MOTIVATION.md
.
To get started:
AssetState
(like the SimpleAssetState
that we ship) to your app that handles the lifecycle of loading assets.ManifestPlugin<S: AssetState>
to your App
.Monster
) that stores the final data that you want to share between all objects of the same kind.app.register_manifest::<Monster>
, supplying the path to the data to load.Manifest<Monster>.get(id: Id<Monster>)
.See the simple.rs
example to jump right in!
If your assets require processing (for validation, or if they contain references to other assets),
you will need a raw manifest type, and corresponding raw item type.
Take a look at the raw_manifest.rs
example next!
Note that we don't compress our manifests into a binary format in our examples. While you can do so, we don't encourage you to (except as an optimization in shipped games). The added pain during version control and debugging is typically not worth the improvements to file size or loading speed during development.