Dexterous Developer

GitHub Workflow Status (with event) GitHub Workflow Status (with event) crates.io cli Static Badge

An experimental hot reload system for the bevy game engine. Inspired by DGriffin91's Ridiculous bevy hot reloading - adding the ability to re-load arbitrary systems, and the ability to transform resource/component structures over time.

Fuller documentation is available at: https://lee-orr.github.io/dexterous_developer/

Features

Known issues

Installation

Grab the CLI by running: cargo install dexterous_developer_cli. If you don't want to use the cli - there is more info in the docs.

You'll be able to run the dexterous verion of your code by running dexterous_developer_cli in your terminal.

In your Cargo.toml add the following:

```toml [lib] name = "libTHENAMEOFYOUR_GAME" path = "src/lib.rs" crate-type = ["rlib", "dylib"]

[dependencies] bevy = "0.11" dexterous_developer = "0.0.4" serde = "1" # If you want the serialization capacities ```

If your game is not a library yet, move all your main logic to lib.rs rather than main.rs. Then, in your main.rs - call the bevy_main function:

```rust fn main() { libNAMEOFYOURGAME::bevy_main(); }

```

and in your lib.rs, your main function should become:

```rust

[hotbevymain]

pub fn bevymain(initialplugins: impl InitialPlugins) { App::new() .addplugins(initialplugins.initialize::()) // You can use either DefaultPlugins or MinimnalPlugins here, and use "set" on this as you would with them // Here you can do what you'd normally do with app // ... and so on } ```

If you have a plugin where you want to add reloadable elements, add the following in the file defining the plugin:

```rust

impl Plugin for MyPlugin { fn build(&self, app: &mut App) { app .setupreloadableelements::(); } }

[dexterousdevelopersetup]

fn reloadable(app: &mut ReloadableAppContents) { app .addsystems(Update, thissystemwillreload); }

```

For the best results, you'll want to add the following to your .cargo/config.toml:

```toml

Add the contents of this file to config.toml to enable "fast build" configuration. Please read the notes below.

NOTE: For maximum performance, build using a nightly compiler

If you are using rust stable, remove the "-Zshare-generics=y" below.

[target.x86_64-unknown-linux-gnu] linker = "clang" rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]

NOTE: you must install Mach-O LLD Port on mac. you can easily do this by installing llvm which includes lld with the "brew" package manager:

brew install llvm

[target.x86_64-apple-darwin] rustflags = [ "-C", "link-arg=-fuse-ld=/usr/local/opt/llvm/bin/ld64.lld", "-Zshare-generics=y", ]

[target.aarch64-apple-darwin] rustflags = [ "-C", "link-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld", "-Zshare-generics=y", ]

[target.x86_64-pc-windows-msvc] linker = "rust-lld.exe" rustflags = ["-Zshare-generics=n"]

Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'

In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.

[profile.dev]

debug = 1

Enable a small amount of optimization in debug mode

[profile.dev] opt-level = 1

Enable high optimizations for dependencies (incl. Bevy), but not for our code:

[profile.dev.package."*"] opt-level = 3

[profile.dev.package.gfx-backend-vulkan] opt-level = 3 debug-assertions = false

```