



essence 0.0.1 documentation

Welcome to essence’s documentation![¶](#welcome-to-essence-s-documentation "Permalink to this headline")

========================================================================================================

[`essence`](index.html#module-essence "essence") is an Entity-Component-System framework for Python.

Example[¶](#example "Permalink to this headline")

-------------------------------------------------

from essence import World, Component, System

class Position(Component):

def \_\_init\_\_(self, x, y):

self.x = x

self.y = y

class Physics(System):

> 

> 

> def update(self, world):

> 

> for e in world.entities\_with(Position):

> e.get(Position).y -= 1

> 

> 

> 

> 

if \_\_name\_\_ == ‘\_\_main\_\_’:

world = World()

world.systems.append(Physics())

player = world.create\_entity()

player.add(Position(1, 1))

while True:

world.update()

[``](#id1)[`](#id3)

What is an Entity-Component-System?[¶](#what-is-an-entity-component-system "Permalink to this headline")

--------------------------------------------------------------------------------------------------------

An Entity-Component-System (or ECS) is an architectural pattern

commonly used in games. Rather than model the world as a deep class hierarchy

it instead divides the world into:

Components

Which hold the data for particular aspect of a thing in the game world,

for example a position or an animation or the ‘Health’ counter.

Entities

Which collect a group of Components together and represent a concrete thing

in the game world, for example the player character or an asteroid from

asteroids.

Systems

Which operate on a group of entities to implement a behavior, for example

a ‘PhysicsSystem’ which updates the position component based on the

velocity component and whether the entity has collided with any other

entities.

Where to find out more about ECSs[¶](#where-to-find-out-more-about-ecss "Permalink to this headline")

-----------------------------------------------------------------------------------------------------

* [Wikipedia Article](https://en.wikipedia.org/wiki/Entity_component_system/)

Contents:

Indices and tables[¶](#indices-and-tables "Permalink to this headline")

=======================================================================

* [Index](genindex.html)

* [Module Index](py-modindex.html)

* [Search Page](search.html)

### About essence

 Essence is an Entity-Component-System framework for Python.

### Useful Links

* [essence @ readthedocs](http://essence.readthedocs.org/en/latest/?badge=latest)

* [essence @ PyPI](http://pypi.python.org/pypi/essence)

* [essence @ GitHub](http://github.com/chromy/essence)

* [Issue Tracker](http://github.com/chromy/essence/issues)

 ©2015, Hector Dearman.

 

 |

 Powered by [Sphinx 1.3.1](http://sphinx-doc.org/)

 & [Alabaster 0.7.6](https://github.com/bitprophet/alabaster)

