Code Monkey home page Code Monkey logo

bevy_asset_ron's Introduction

OBSOLETE!

This project is no longer maintained. It has been superseded by bevy_common_assets.

Custom RON Assets for Bevy

This crate allows you to easily register arbitrary custom data to be loaded by Bevy as an Asset, from files using the RON format.

It minimizes the amount of boilerplate needed for such custom asset types.

You only need to derive the required traits on your custom type, and add a RonAssetPlugin to your App!

Caveat: you need to come up with a unique file name extension for each new asset type. Bevy also requires a unique UUID for TypeUuid.

#[derive(serde::Deserialize)]
#[derive(TypeUuid)]
#[uuid = "1df82c01-9c71-4fa8-adc4-78c5822268f8"]
struct GameItemDescriptionAsset {
    damage: f32,
    durability: f32,
    min_level: u8,
}

fn main() {
    App::new()
        // bevy
        .add_plugins(DefaultPlugins)
        // our asset
        .add_plugin(
            // load `*.item` files
            RonAssetPlugin::<GameItemDescriptionAsset>::new(&["item"])
        )
        .add_startup_system(setup)
        .run();
}

fn setup(server: Res<AssetServer>) {
    // load our item configs!
    let handles = server.load_folder("items");

    // TODO: store the handles somewhere
}

Now you can just create files like assets/items/big_gun.item:

(
  damage: 25.0,
  durability: 170.0,
  min_level: 4,
)

See examples/load_rons.rs for a more elaborate example!

$ cargo run --example load_rons

Compatible Bevy versions

Compatibility of published bevy_asset_ron versions:

bevy bevy_asset_ron
0.7 0.4
0.6 0.3
0.5 0.2
0.4 0.1

bevy_asset_ron's People

Contributors

chrisburnor avatar inodentry avatar miniaczq avatar rparrett avatar rsaihe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bevy_asset_ron's Issues

config as HashMap

if my config is defined like a HashMap:

type BulletsConfigs = HashMap<BulletType,BulletConfig>;

how then do I apply TypeUuid to it?

Does not work with bleeding edge bevy

error: failed to select a version for syn.
... required by package wasm-bindgen-macro-support v0.2.73
... which satisfies dependency wasm-bindgen-macro-support = "=0.2.73" of package wasm-bindgen-macro v0.2.73
... which satisfies dependency wasm-bindgen-macro = "=0.2.73" of package wasm-bindgen v0.2.73
... which satisfies dependency wasm-bindgen = "^0.2.73" of package wgpu v0.9.0
... which satisfies dependency wgpu = "^0.9" of package bevy_wgpu v0.5.0 (https://github.com/bevyengine/bevy?branch=main#225d6a13)
... which satisfies git dependency bevy_wgpu of package bevy_internal v0.5.0 (https://github.com/bevyengine/bevy?branch=main#225d6a13)
... which satisfies git dependency bevy_internal of package bevy v0.5.0 (https://github.com/bevyengine/bevy?branch=main#225d6a13)
... which satisfies git dependency bevy of package my_package v0.1.0
versions that meet the requirements ^1.0.67 are: 1.0.81, 1.0.80, 1.0.79, 1.0.78, 1.0.77, 1.0.76, 1.0.75, 1.0.74, 1.0.73, 1.0.72, 1.0.71, 1.0.70, 1.0.69, 1.0.68, 1.0.67

all possible versions conflict with previously selected packages.

previously selected package syn v1.0.65
... which satisfies dependency syn = "=1.0.65" of package bevy v0.5.0
... which satisfies dependency bevy = "^0.5" of package bevy_asset_ron v0.2.0 (https://github.com/inodentry/bevy_asset_ron#06f4de58)
... which satisfies git dependency bevy_asset_ron of package my_package v0.1.0

failed to select a version for syn which could resolve this conflict

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.