Turn-based combat forbevy_battle
A generic turn-based battle plugin for Bevy — damage resolution, effects, class procs, and enemy AI as a pure Rust core with an optional Bevy ECS layer, driven by a seeded RNG for deterministic results.
Pure core, optional ECS
The same combat logic runs inside a full game or a headless FFI build — combat math lives in types.rs with zero Bevy dependency.
- Default — the bevy feature adds the BevyBattlePlugin and ECS derives.
- Headless — disable default features for a plain Rust type surface for FFI cdylibs and headless serializers.
What it gives you
Features
Pure Rust core
Types, enums, and combat math in types.rs with zero Bevy dependency, usable from FFI cdylibs and mobile crates.
Optional Bevy ECS plugin
The bevy feature (default) adds Component / Event / Resource / Message derives, the BevyBattlePlugin, snapshot/world helpers, and the full combat system pipeline.
Deterministic RNG
BattleRng seeds every roll so battles reproduce exactly.
Global tuning
A CombatModifiers resource adjusts combat behavior in one place.
Enemy AI hook
Integrates bevy_behavior behavior trees for enemy turn logic.
Get started
Usage
use bevy::prelude::*;
use bevy_battle::BevyBattlePlugin;
App::new()
.add_plugins(BevyBattlePlugin)
.run();Questions
Frequently asked
What does the bevy_battle crate do?
It provides generic turn-based battle types — damage resolution, effects, class procs, and enemy AI — as a pure Rust core plus an optional Bevy ECS plugin.
Can bevy_battle be used without Bevy?
Yes. The default "bevy" feature adds the BevyBattlePlugin and ECS derives, but disabling default features leaves a plain Rust type surface suitable for FFI cdylibs and headless serializers.
Are battles deterministic?
Yes. A seeded BattleRng resource drives combat rolls, so the same seed and inputs reproduce the same outcome for testing and replay.