#ecs #multi-threading #performance #library #game-engine

ABC-ECS

一个简单、快速、灵活的Rust实体-组件-系统库

5个版本

0.2.1 2024年7月25日
0.2.0 2024年4月16日
0.1.5 2024年4月7日
0.1.4 2024年2月10日
0.1.3 2023年12月25日

#270游戏开发

Download history 4/week @ 2024-04-29 9/week @ 2024-05-20 1/week @ 2024-06-10 121/week @ 2024-07-22 54/week @ 2024-07-29 10/week @ 2024-08-12

456 每月下载量
3 个Crates中使用 (通过 abc_game_engine)

MIT/Apache

100KB
2K SLoC

性能

这个ECS是以可用性为设计理念的。不过它只是一个伪ECS。根据需要,你可以使用run或single_entity_step和pre-step来利用我们提供的多线程。根据需要,你可以在这两种方法之间切换。如果需要,这个ECS可以非常高效。

ABC游戏引擎 - 简单ECS框架

这个Rust项目提供了一个基本的框架,用于在ABC游戏引擎中使用实体组件系统(ECS)方法来管理游戏实体、组件和系统。

快速示例

创建一个世界

use ABC_ECS::World;

struct Position {
    x: f32,
    y: f32,
}

struct Velocity {
    x: f32,
    y: f32,
}

fn main(){
    let mut world = World::new();

    let entities_and_components = &mut world.entities_and_components;
    // Add an Entity and Components:
    let entity = entities_and_components.add_entity();

    // Add components like Position and Velocity
    entities_and_components.add_component_to(entity, Position { x: 0.0, y: 0.0 });
    entities_and_components.add_component_to(entity, Velocity { x: 1.0, y: 1.0 });

    // or you can do it in one step:
    let entity = entities_and_components
        .add_entity_with((Position { x: 0.0, y: 0.0 }, Velocity { x: 1.0, y: 1.0 }));
}

文档

请访问这里的文档。

贡献

欢迎贡献!首先提交一个问题,然后我们可以从那里开始工作!如果你不确定要做什么但想帮忙,请加入Discord并ping我,我很乐意帮助!

依赖

~1.5MB
~30K SLoC