All Projects → Aenyhm → entitas-python

Aenyhm / entitas-python

Licence: MIT license
Entitas ECS implementation in Python.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to entitas-python

SpaceWar-ECS
A space war game made with ECS and JobSystem in Unity.
Stars: ✭ 26 (-36.59%)
Mutual labels:  ecs, entity, entitas
Entia
Entia is a free, open-source, data-oriented, highly performant, parallelizable and extensible Entity-Component-System (ECS) framework written in C# especially for game development.
Stars: ✭ 28 (-31.71%)
Mutual labels:  system, ecs, entity
Entitas Csharp
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Stars: ✭ 5,393 (+13053.66%)
Mutual labels:  ecs, entity, entitas
uecs
Micro ECS
Stars: ✭ 30 (-26.83%)
Mutual labels:  system, ecs, entity
URSA
[DEPRECATED] integrated ECS framework for Unity
Stars: ✭ 30 (-26.83%)
Mutual labels:  system, ecs, entity
Entitycomponentsystemsamples
No description or website provided.
Stars: ✭ 4,218 (+10187.8%)
Mutual labels:  system, ecs, entity
Ecs Snake
Simple snake game powered by ecs framework.
Stars: ✭ 41 (+0%)
Mutual labels:  system, ecs, entity
Geotic
Entity Component System library for javascript
Stars: ✭ 97 (+136.59%)
Mutual labels:  system, ecs, entity
entity-system-js
ensy - A very simple Entity System for JavaScript
Stars: ✭ 90 (+119.51%)
Mutual labels:  ecs, entity
Entitas-Redux
An entity-component framework for Unity with code generation and visual debugging
Stars: ✭ 84 (+104.88%)
Mutual labels:  ecs, entity
Entitas-lua
No description or website provided.
Stars: ✭ 29 (-29.27%)
Mutual labels:  ecs, entitas
Kengine
Entity-Component-System (ECS) with a focus on ease-of-use, runtime extensibility and compile-time type safety and clarity.
Stars: ✭ 417 (+917.07%)
Mutual labels:  ecs, entity
Actors.unity
🚀Actors is a framework empowering developers to make better games faster on Unity.
Stars: ✭ 437 (+965.85%)
Mutual labels:  ecs, entity
ECS-Phyllotaxis
Learning ECS - 100k Cubes in Phyllotaxis pattern
Stars: ✭ 17 (-58.54%)
Mutual labels:  ecs, entity
ecs
A dependency free, lightweight, fast Entity-Component System (ECS) implementation in Swift
Stars: ✭ 79 (+92.68%)
Mutual labels:  ecs, entity
EntitasGenericAddon
Addon to Entitas that allows using generic methods instead of code generator and uses type inference to insure compile time correctness
Stars: ✭ 17 (-58.54%)
Mutual labels:  ecs, entitas
Htframework
Unity HTFramework, a rapid development framework of client to the unity.
Stars: ✭ 179 (+336.59%)
Mutual labels:  ecs, entity
Entitas Cpp
Entitas++ is a fast Entity Component System (ECS) C++11 port of Entitas C#
Stars: ✭ 229 (+458.54%)
Mutual labels:  ecs, entity
masterclass-codeexamples
Code examples used in Get into DevOps: The Masterclass
Stars: ✭ 35 (-14.63%)
Mutual labels:  ecs
HexMapMadeInUnity2019ECS
Auto Create Map System Made with Unity 2019 ECS
Stars: ✭ 54 (+31.71%)
Mutual labels:  ecs

Entitas for Python

https://travis-ci.org/Aenyhm/entitas-python.svg?branch=master

entitas-python is a port of Entitas ECS for C# and Unity.

Overview

Components

Position = namedtuple('Position', 'x y')
Health = namedtuple('Health', 'value')
Movable = namedtuple('Movable', '')

Entity

entity.add(Position, 3, 7)
entity.add(Health, 100)
entity.add(Movable)

entity.replace(Position, 10, 100)
entity.replace(Health, entity.get(Health).value - 1)

entity.remove(Position)

has_pos = entity.has(Position)
movable = entity.has(Movable)

Context

context = Context()
entity = context.create_entity()
entity.add(Movable)

entities = context.entities
for e in entities:
    # do something

Group

context.get_group(Matcher(Position)).entities

def move(entity, new_comp):
    # do something

context.get_group(Matcher(Position)).on_entity_added += move

Entity Collector

group = context.get_group(Matcher(Position))
collector = Collector()
collector.add(group, GroupEvent.added)

# later

for e in collector.collected_entities:
   # do something with all the entities
   # that have been collected to this point of time

collector.clear_collected_entities()

# stop observing
collector.deactivate()

Entity Index

Person = namedtuple('Person', 'name age')
group = context.get_group(Matcher(Person))

# get a set of 42-year-old Person
index = EntityIndex(Person, group, 'age')
context.add_entity_index(index)
entities = context.get_entity_index(Person).get_entities(42)

# get the Person named "John"
primary_index = PrimaryEntityIndex(Person, group, 'name')
context.add_entity_index(primary_index)
entity = context.get_entity_index(Person).get_entity('John')

Processors

class RenderDisplay(ExecuteProcessor):

    def execute(self):
        pygame.display.update()


# Initialize, Cleanup and TearDown are also available.


class Move(ReactiveProcessor):

    def __init__(self, context):
        super().__init__(context)
        self._context = context

    def get_trigger(self):
        return {Matcher(Position): GroupEvent.ADDED}

    def filter(self, entity):
        return entity.has(Position, Movable)

    def react(self, entities):
        for entity in entities:
            # use entity.get(Position).x & entity.get(Position).y

Setup example

context = Context()

processors = Processors()
processors.add(StartGame(context))
processors.add(InputProcessors(context))
processors.add(RenderDisplay())
processors.add(DestroyEntity(context))

processors.initialize()
processors.activate_reactive_processors()

# main loop
running = True
while running:
    processors.execute()
    processors.cleanup()

    if EmitInput.quit:
        break

processors.clear_reactive_processors()
processors.tear_down()

quit()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].