bevy_mortar_bond 0.4.0

Bevy integration plug-in for mortar language
Documentation

bevy_mortar_bond

license

bevy_mortar_bond — A Bevy "bond" (binding) plugin for the mortar language.

English Simplified Chinese
English 简体中文

Introduction

Bringing the power of strict content-logic decoupling to the Bevy engine.

bevy_mortar_bond is the dedicated bridge for the mortar scripting language—a Domain Specific Language (DSL) designed specifically to keep narrative text and event logic separate and clean.

By integrating Mortar into Bevy, this plugin enables a streamlined workflow where designers can craft fluid, branching dialogues in lightweight .mortar files without polluting the narrative with technical markers. It provides a native framework that bridges Mortar's logic with Bevy's ECS, making it simple to drive game events, animate characters, and manage dialogue UI as a natural extension of your Rust codebase.

Features

  • 📜 Mortar Script Integration: Seamlessly load and execute .mortar script 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 .mortar files, 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 MortarEventBinding component 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.

Bevy Version Support

bevy bevy_mortar_bond
0.18 0.3.0
0.17 < 0.3.0

Usage

  1. Add to Cargo.toml:

    [dependencies]
    bevy_mortar_bond = "0.3.0"
    
  2. Basic Usage:

    use bevy::prelude::*;
    use bevy_mortar_bond::MortarPlugin;
    
    fn main() {
        App::new()
            .add_plugins(DefaultPlugins)
            .add_plugins(MortarPlugin)
            .run();
    }
    

Examples

Running Examples

Dialogue UI Example - Demonstrates basic dialogue boxes and clickable option buttons:

cargo run --example dialogue_ui

Example Description

  • 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.

Dependencies

This project uses the following crates:

Crate Version Description
bevy 0.18 Game Engine
mortar_compiler Local Mortar Language Compiler
serde_json 1.0 JSON Serialization/Deserialization
bevy_mortar_bond_macros Local bevy_mortar_bond Macros

Dev Dependencies

Crate Version Description
proptest 1.6 Property-based / fuzz testing

Contribution Guide

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.

License

This project can be distributed under the terms of either of the following licenses:

You may choose either one.