fast_ecs 0.0.1 copy "fast_ecs: ^0.0.1" to clipboard
fast_ecs: ^0.0.1 copied to clipboard

Simple and fast Entity-Component-System (ECS) library written in Dart.

Pub Version

Fast ECS #

Simple and fast Entity-Component-System (ECS) library written in Dart.

CPU Flame Chart #

Demonstration of performance for rotation of 1024 entities

  • device Nexus 5 (2014) android 6.0.1
  • fast_ecs version 0.0.1
  • all Time 10500(ms)
  • 1024 entities

all RotationSystem

void update(double deltaTime, SetEntity entities) {
  for (var i = 0; i < entities.size; i++) {
    Entity entity = entities[i];
    TransformComponent transform = transformComponents[entity];
    VelocityComponent rotation = velocityComponents[entity];
    transform.rotation += rotation.velocity * deltaTime;
    transform.dirty = true;
  }
}

update RotationSystem

SpriteSystem

void updateSprite(TransformComponent transform, SpriteComponent sprite) {
  var textureRegion = sprite.textureRegion;
  if (transform.dirty && textureRegion != null) {
    var scos = cos(transform.rotation) * transform.scale;
    var ssin = sin(transform.rotation) * transform.scale;
    var tx = -scos * textureRegion.anchorX + ssin * textureRegion.anchorY;
    var ty = -ssin * textureRegion.anchorX - scos * textureRegion.anchorY;
    sprite.transformData.set(scos, ssin, tx, ty);
    transform.dirty = false;
  }
}

updateSprite

History of creation #

The source of inspiration was the resource A SIMPLE ENTITY COMPONENT SYSTEM (ECS) [C++]

4
likes
140
pub points
0%
popularity

Publisher

unverified uploader

Simple and fast Entity-Component-System (ECS) library written in Dart.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on fast_ecs