Skip to content
Tim Fischer edited this page Aug 18, 2020 · 3 revisions

A simple implementation of the Entity-Component pattern.


Concepts

Controller

This is an object that holds and manages all entities and their components.

Entity

Entities are effectively just a UUID that points to a collection of components. The actual Entity objects used int PyECS are syntactic sugar that wrap a UUID and an ECController into one object. It exposes a simplified version of the interface exposed by the ECController that already "pre-fills" all the UUID parameters.

Component

Components are arbitrary objects that are distinguished by their classes __qualname__. Due to this any thing can be a component. For example simple python dataclasses, which make it easy to define simple data points. The usage of the __qualname__ attribute also allows for identical "top-level" class names, for example physics2D.RigidBody and physics3D.RigidBody. But be carefull with this, as this library does not enforce the component types!

Clone this wiki locally