Giter Club home page Giter Club logo

becsy's Introduction

Becsy

Becsy is a (soon to be) multi-threaded Entity Component System (ECS) for TypeScript and JavaScript. It's inspired by ECSY and bitecs, and guided by ideas from Flecs.

ECS is an architectural pattern where computation is defined as a list of systems operating on a set of entities, each of which consists of a dynamic set of pure data components. Systems select the entities to process via means of persistent, efficient queries over the entities' component "shapes".

Jump right in to see some heavily annotated examples, and join us on Discord for help and fun discussions!

Project priorities

Becsy positions itself within the wider ecosystem of ECS frameworks with the following set of priorities:

  1. Multi-threaded: all apps developed with Becsy can be effectively run on multiple threads with minimal or no modifications from their single-threaded version. I believe that multi-threading is the only way to scale performance and that ECS is the ideal architecture for making multi-threading effortless and practical in JavaScript.
  2. Ergonomic: the API is powerful, expressive, and safe, rather than minimal or low-level. I believe that developers choose TypeScript / JavaScript because it's a high level language, where they can express ideas quickly and succinctly. If they need to prioritize performance they'll pick a language and ECS implementation better suited to that objective.
  3. Performant: the point above notwithstanding, Becsy does its best not to unnecessarily leave potential performance on the table. I believe that a good ECS should be usable for more than just toy apps.

The priorities above are ordered from most to least important. This means that I'll sacrifice ergonomics if required to support multi-threading, and accept decreased performance in favor of a better API.

Features

From ECSY we take:

  • a friendly object-oriented API for both JS and TS clients
  • multiple queries per system
  • reactive queries (rather than event callbacks)
  • explicit mutation tracking
  • references to native JS objects in components

From bitecs we take:

  • extensive use of ArrayBuffer for performance
  • a sparse array architecture
  • Node and browser compatibility with no dependencies

Then we add:

  • native TypeScript implementation, for a type-friendly design and the best typings
  • selectable component storage strategies, to adjust the performance/memory trade-off
  • entity references that can be traversed in either direction, with strong referential integrity
  • declarative system ordering based on data dependencies
  • coroutines for more natural multi-stage workflows
  • weak references to native JS objects, for better integration with other frameworks

Still to come:

  • examples and docs
  • multithreaded system execution
  • built-in support for representing state machines (per Sander Mertens)
  • an optional but nicely integrated networked data replication system

becsy's People

Contributors

endel avatar getkey avatar marionebl avatar pkaminski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.