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

Overview

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


Demonstration of performance for rotation of 10K entities

  • device Nexus 5 (2014) android 6.0.1
  • fast_ecs version 0.1.0
  • all time 10.5 sec.
  • 10000 entities
  • update rotation - 0.85 sec.
  • update sprite - 3.6 sec.

update 10K sprites

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Main memory reference ...................... 100 ns             
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
Read 1 MB sequentially from SSD* ..... 1,000,000 ns  =   1 ms
Read 1 MB sequentially from disk .... 20,000,000 ns  =  20 ms
Send packet CA->Netherlands->CA .... 150,000,000 ns  = 150 ms

source

History of creation

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

You might also like...

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

中文文档 英文文档 问题集 原仓库不再维护,代码已经很老了 最近版本更新会很快,主要是增加新特性,涉及到混合栈的稳定性的问题应该不多,可放心升级,发现问题加 QQ 群号码:1014085473,我会尽快解决。 不打算好好看看源码的使用者可以放弃这个库了,因为很多设定是比较死的,而我本人不打算花时间写

Dec 29, 2022

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

flutter_thrio makes it easy and fast to add flutter to existing mobile applications, and provide a simple and consistent navigator APIs.

本仓库不再维护,可移步新仓库 https://github.com/flutter-thrio/flutter_thrio 中文文档 问题集 QQ 群号码:1014085473 The Navigator for iOS, Android, Flutter. Version 0.2.2 requir

Dec 5, 2022

An interesting and practical switch component.

An interesting and practical switch component.

FSwitch An interesting and practical switch component. Supports setting tips, slider decorations, shadows, and good interaction. Author:Newton(coorchi

Dec 13, 2022

A list component that refreshes and adds more data for Flutter.

Language: English | 中文简体 Dynamic List View A list component that can refreshes and adds more data for Flutter App. 🚀 github Installation Add this to

Sep 27, 2022

Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls into your app with only a few lines of code.

Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls into your app with only a few lines of code.

Call Kit (ZegoUIKitPrebuiltCall) Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls

Dec 26, 2022

A music player component for Flutter (i.e. Spotify, Apple Music, etc.) [AGPL/example/no longer maintaining]

A music player component for Flutter (i.e. Spotify, Apple Music, etc.) [AGPL/example/no longer maintaining]

This is an example I currently have no plans of putting this on Pub. Originally, I did, but I lost interest. However, I think this is a good example,

Dec 12, 2022

A radio component suitable for almost any radio scenario.

A radio component suitable for almost any radio scenario.

fradio A radio component suitable for almost any radio scenario. Supports excellent interactive special effects, as well as a simple multi-interactive

Nov 26, 2022

From then on, developers only need to master one Button component, which is enough.

From then on, developers only need to master one Button component, which is enough.

FButton From then on, developers only need to master one Button component, which is enough. Support corners, borders, icons, special effects, loading

Nov 22, 2022

Flutter component Gradient Progress Indicator

Gradient Progress Indicator Introduction This package shows a circular progress indicator with gradient colors, and it is possible insert texts inside

Dec 5, 2022
Owner
Stanislav
migrating to Dart
Stanislav
An atomic state management library for dart (and Flutter). Simple, fast and flexible.

nucleus An atomic dependency and state management toolkit. Design goals Simplicity - simple API with no surprises Performance - allow for millions of

Tim 12 Jan 2, 2023
Lightweight and blazing fast key-value database written in pure Dart.

Fast, Enjoyable & Secure NoSQL Database Hive is a lightweight and blazing fast key-value database written in pure Dart. Inspired by Bitcask. Documenta

HiveDB 3.4k Dec 30, 2022
Lightweight and blazing fast key-value database written in pure Dart.

Fast, Enjoyable & Secure NoSQL Database Hive is a lightweight and blazing fast key-value database written in pure Dart. Inspired by Bitcask. Documenta

HiveDB 3.4k Dec 30, 2022
Fast math TeX renderer for Flutter written in Dart.

CaTeX is a Flutter package that outputs TeX equations (like LaTeX, KaTeX, MathJax, etc.) inline using a widget and Flutter only - no plugins, no web v

simpleclub 56 Nov 14, 2022
Magpie-fly is a component library produced by 58 Group, which encapsulates a variety of common components to meet the needs of developers

[toc] magpie_fly Magpie-fly 是58集体出品组件库,封装了多种常用组件,以满足开发者需求。(Magpie-fly is a component library produced by 58 Group, which encapsulates a variety of com

Wuba 40 Mar 18, 2022
A build system for Dart written in Dart

These packages provide libraries for generating, compiling and serving Dart code. Getting started with build_runner General FAQ Windows FAQ FAQ for Bu

Dart 676 Dec 24, 2022
QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter. Need help? Please do not submit an issue for a "

Yakka 614 Jan 8, 2023
A fast, flexible, IoC library for Dart and Flutter

Qinject A fast, flexible, IoC library for Dart and Flutter Qinject helps you easily develop applications using DI (Dependency Injection) and Service L

null 4 Sep 9, 2022
The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion.

Fluid Slider Flutter The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion. About The component was

Wilton Neto 41 Sep 30, 2022
Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Rab Bar.

Gooey Tab Bar Flutter Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Tab Bar. About This component

Wilton Neto 216 Dec 14, 2022