1 unstable release

0.0.0 Feb 15, 2023

#28 in #lets

Apache-2.0 OR MIT

8KB

Bevy Roguelike Toolkit (BRLTK)

An opinionated rougelike toolkit for bevy

BRLTK lets you use Bevy with various roguelike libraries. Currently, it supports doryen-rs, bracket-lib, and bevy_ascii_terminal

Compatible Bevy versions

The main branch is compatible with the latest Bevy release

Compatibility of BRLTK versions:

BRLTK bevy
0.1.0 0.9

Getting Started

Using doryen-rs backend:

App::build()
    // Add the `BRLTKPlugin` to Bevy.
    .add_plugin(BRLTKPlugin::with_backend(DoryenBackend {
        // here are all the available options.
        // better practice is to use default values (see other examples)
        app_options: DoryenAppOptions {
            console_width: CONSOLE_WIDTH,
            console_height: CONSOLE_HEIGHT,
            screen_width: CONSOLE_WIDTH * 8,
            screen_height: CONSOLE_HEIGHT * 8,
            window_title: String::from("my roguelike"),
            font_path: String::from("terminal_8x8.png"),
            vsync: true,
            fullscreen: false,
            show_cursor: true,
            resizable: true,
            intercept_close_request: false,
            max_fps: 60,
        },
        ..Default::default()
    }))
    // Add your Bevy systems like usual. Excluding startup systems, which
    // only run once, these systems are run during Doryen's update phase;
    // i.e. 60 times per second.
    .add_startup_system(init)
    .add_system(input)
    // The `RenderSystemExtensions` trait lets you add systems that should
    // be run during Doryen's render phase.
    .add_doryen_render_system(render)
    .run();

Using bracket-lib backend:

⚠️(Default Plugins are required for the bracket-lib backend)⚠️

App::build()
    .add_plugins(DefaultPlugins)
    // Add the `BRLTKPlugin` to Bevy.
    .add_plugin(BRLTKPlugin::with_backend(
        BracketLibBackend::simple_80x50()
            .with_named_color("blue", BLUE)
            .with_named_color("pink", Color::PINK),
    ))
    .insert_resource(State {
        y: 0,
        going_down: true,
    })
    .add_system(tick)
    .run();

Once set up, you can quickly try out the examples by cloning this repo and running the following commands:

# Switch to the correct version (latest release, default is main development branch)
git checkout latest

# Runs the "basic_doryen" example
cargo run --example basic_doryen

or
# Runs the "basic_bracket" example
cargo run --example basic_bracket

Libraries Used

Bevy is only possible because of the hard work put into these foundational technologies:

  • bevy: a refreshingly simple data-driven game engine built in Rust
  • doryen-rs: Ascii roguelike library in rust with native and wasm support
  • bracket-lib: bracket-lib is a wrapper of the bracket- set of crates designed initally for roguelike development (as RLTK) and later transitioned into a general use crate.
  • bevy_ascii_terminal: A simple ascii terminal integrated into bevy's ecs framework.

Thanks and Alternatives

Additionally, I would like to thank the Jice and his library doryen-rs for providing the bones to build this toolkit. This crate uses a modified version of doryen-rs to provide a more bevy-like interface.

I would also like to thank alexschrod who started this implementation back in bevy 0.5, which allowed me to fork the repository and continue the work.

And as always, a special shoutout to thebracket for his bracket-lib game engine which began my journey into the world of roguelikes. He is my inspiration for this project.

License

BRLTK is free, open source and permissively licensed! All code in this repository is dual-licensed under either:

This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.

The assets included in this repository (for our examples) typically fall under different open licenses, but most are free for commercial use.

See CREDITS.md for the details of the licenses of those files.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps