Crate ecs [] [src]

Entity Component System Library (ECS)

For info about why an ECS may be beneficial, see some of these articles:

There is a large variety of ways an ECS may work. This particular one is similar to Artemis. Although this isn't a port to Rust, most functionality should be similar, and the tutorials/manual there should be able to make up for the current lack of documentation [FIXME]

Here's the basic structure:

  • An Entity is just an identifier. It contains no data or logic whatsoever.
  • A Component is a piece of data (eg: Position, Velocity, Colour). While containing logic can sometimes be useful, it's best practice to avoid it wherever possible.
  • A System runs all the logic. Most of the time, it filters out entities based on their components, and only runs it's logic on the entities it's interested in. These filters are called Aspects. Some systems ignore entities, and just apply logic to the world itself.
  • An Aspect is a simple helper to filter entities based on their components.
  • The World organises all the above items together to make sure everything runs as it should.

Reexports

pub use aspect::Aspect;
pub use component::Component;
pub use component::ComponentList;
pub use component::EntityBuilder;
pub use component::EntityModifier;
pub use entity::Entity;
pub use entity::IndexedEntity;
pub use entity::EntityIter;
pub use system::System;
pub use system::Process;
pub use world::ComponentManager;
pub use world::ServiceManager;
pub use world::SystemManager;
pub use world::DataHelper;
pub use world::World;

Modules

aspect
component
entity

Entity identifier and manager types.

system

Types to process the world and entities.

world

Macros

aspect
components
process
systems

Structs

BuildData
EntityData
ModifyData