bevy_mortar_bond — A Bevy "bond" (binding) plugin for the mortar language.
example.mp4
| English | Simplified Chinese |
|---|---|
| English | 简体中文 |
bevy_mortar_bond is a Bevy plugin that integrates the Mortar scripting languagexample.mp4e into the Bevy game engine. It provides a powerful framework for creating dynamic dialogue systems, interactive events, and complex game logic using Mortar scripts.
It addresses the problem of integrating a flexible external scripting language for content creators and game designers, allowing users to conveniently define game flow, character interactions, and dynamic scenes.
You can simply write your game logic and dialogue in .mortar script files and seamlessly integrate them into your Bevy application.
In the future, it may also support more advanced scripting features and integrations.
- Mortar Script Integration: Seamlessly load and execute
.mortarscript files within your Bevy application. - Bevy ECS Compatibility: Designed to work idiomatically with Bevy's Entity Component System (ECS), allowing scripts to interact with game entities and components.
- Resource Loading: Provides a Bevy resource loader for
.mortarfiles, enabling easy management and hot-reloading of script resources. - Dialogue System Foundation: Offers core utilities and examples for building dynamic and branching dialogue systems.
- Bindable Event Indexes: The
MortarEventBindingcomponent lets you drive events from any index source (typewriter effects, audio cues, etc.), and the examples include a built-in ECS typewriter utility so you can keep everything self-contained.
-
Add to Cargo.toml:
[dependencies] bevy_mortar_bond = "0.1.0"
-
Basic Usage:
use bevy::prelude::*; use bevy_mortar_bond::MortarPlugin; fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugins(MortarPlugin) .run(); }
Dialogue UI Example - Demonstrates basic dialogue boxes and clickable option buttons:
cargo run --example dialogue_ui- dialogue_ui: This example showcases a fully functional dialogue UI with typewriter text effects, dynamic Mortar event handling (e.g., animations, color changes, sound playback), variable state management, and conditional text, all integrated into a custom Bevy UI.
- Clicking option buttons updates the dialogue text.
- Buttons have visual feedback for hover and click states.
This project uses the following crates:
| Crate | Version | Description |
|---|---|---|
| bevy | 0.17.2 | Game Engine |
| mortar_compiler | Local | Mortar Language Compiler |
| serde_json | 1.0 | JSON Serialization/Deserialization |
| bevy_mortar_bond_macros | Local | bevy_mortar_bond Macros |
Contributions are welcome! Whether you want to fix bugs, add features, or improve documentation:
- Submit an Issue or Pull Request.
- Share ideas and discuss design or architecture.
This project can be distributed under the terms of either of the following licenses:
- Apache License 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
You may choose either one.