Giter Club home page Giter Club logo

crystal-ecs's Introduction

crystal-ecs

This is a simple Entity Component System (ECS) for the Crystal language.

It allows you to define Entities with arbitrary behaviours and/or properties, and to lookup Entities later which have any given combination of behaviours and properties.

A common use-case is in game engines, where you might want to define, say, animals, and have one thread find all birds and perform bird-like behaviour, even if, say, a person has been temporarily transformed into a bird, and is not defined in terms of a Bird class hierarchy.

A more complex example might be to create a new spell, action, or special move in a game engine, which turns off all lights fueled by kerosene. This might involve querying all entities that share the Lightsource and FueledBy Components, querying which FueledBy components are kerosene, and calling the switch_off method on the associated lightsource components.

Installation

Add this to your application's shard.yml:

dependencies:
  ecs:
    github: lee-b/crystal-ecs

Usage

See the included demo

Development

Improvements welcome.

Contributing

  1. Fork it (https://github.com/your-github-user/ecs/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • lee-b Lee Braiden - creator, maintainer

crystal-ecs's People

Watchers

 avatar  avatar  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.