Skip to content

Bli-AIk/bevy_mortar_bond

Repository files navigation

bevy_mortar_bond

license

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

example.mp4

Want to try it yourself?
Clone the repo then `cargo run --example live_terminal`.

English Simplified Chinese
English 简体中文

Introduction

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.

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.

Usage

  1. Add to Cargo.toml:

    [dependencies]
    bevy_mortar_bond = "0.1.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.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

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.

About

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

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages