



Search — Entity-Component-System 0.1 documentation

### Navigation

* [index](genindex.html "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](index.html) »

Search

======

 Please activate JavaScript to enable the search

 functionality.

 

 From here you can search these documents. Enter your search

 words into the box below and click "search". Note that the search

 function will automatically search for all of the words. Pages

 containing fewer words won't appear in the result list.

 

### Navigation

* [index](genindex.html "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





Index — Entity-Component-System 0.1 documentation

### Navigation

* [index](# "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](index.html) »

Index

=====

[**A**](#A)

 | [**C**](#C)

 | [**D**](#D)

 | [**E**](#E)

 | [**N**](#N)

 | [**P**](#P)

 | [**R**](#R)

 | [**S**](#S)

 | [**U**](#U)

A

-

|  |  |

| --- | --- |

| 

[add\_component() (ecs.managers.EntityManager method)](api.html#ecs.managers.EntityManager.add_component)

 | 

[add\_system() (ecs.managers.SystemManager method)](api.html#ecs.managers.SystemManager.add_system)

 |

C

-

|  |  |

| --- | --- |

| 

[Component (class in ecs.models)](api.html#ecs.models.Component)

[component\_for\_entity() (ecs.managers.EntityManager method)](api.html#ecs.managers.EntityManager.component_for_entity)

 | 

[create\_entity() (ecs.managers.EntityManager method)](api.html#ecs.managers.EntityManager.create_entity)

 |

D

-

|  |  |

| --- | --- |

| 

[database (ecs.managers.EntityManager attribute)](api.html#ecs.managers.EntityManager.database)

 | 

[DuplicateSystemTypeError](api.html#ecs.exceptions.DuplicateSystemTypeError)

 |

E

-

|  |  |

| --- | --- |

| 

[ecs.\_\_init\_\_ (module)](api.html#module-ecs.__init__)

[ecs.exceptions (module)](api.html#module-ecs.exceptions)

[ecs.managers (module)](api.html#module-ecs.managers)

 | 

[ecs.models (module)](api.html#module-ecs.models)

[Entity (class in ecs.models)](api.html#ecs.models.Entity)

[EntityManager (class in ecs.managers)](api.html#ecs.managers.EntityManager)

 |

N

-

|  |

| --- |

| 

[NonexistentComponentTypeForEntity](api.html#ecs.exceptions.NonexistentComponentTypeForEntity)

 |

P

-

|  |

| --- |

| 

[pairs\_for\_type() (ecs.managers.EntityManager method)](api.html#ecs.managers.EntityManager.pairs_for_type)

 |

R

-

|  |  |

| --- | --- |

| 

[remove\_component() (ecs.managers.EntityManager method)](api.html#ecs.managers.EntityManager.remove_component)

[remove\_entity() (ecs.managers.EntityManager method)](api.html#ecs.managers.EntityManager.remove_entity)

 | 

[remove\_system() (ecs.managers.SystemManager method)](api.html#ecs.managers.SystemManager.remove_system)

 |

S

-

|  |  |

| --- | --- |

| 

[System (class in ecs.models)](api.html#ecs.models.System)

[SystemManager (class in ecs.managers)](api.html#ecs.managers.SystemManager)

 | 

[systems (ecs.managers.SystemManager attribute)](api.html#ecs.managers.SystemManager.systems)

 |

U

-

|  |

| --- |

| 

[update() (ecs.managers.SystemManager method)](api.html#ecs.managers.SystemManager.update)

[(ecs.models.System method)](api.html#ecs.models.System.update)

 |

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](# "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





API Documentation — Entity-Component-System 0.1 documentation

### Navigation

* [index](genindex.html "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [previous](index.html "Entity-Component-System") |

* [Entity-Component-System 0.1 documentation](index.html) »

API Documentation[¶](#api-documentation "Permalink to this headline")

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

ecs Package[¶](#module-ecs.__init__ "Permalink to this headline")

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

An entity system in Python.

[exceptions](http://docs.python.org/library/exceptions.html#exceptions "(in Python v2.7)") Module[¶](#module-ecs.exceptions "Permalink to this headline")

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

Exceptions that may be raised.

*exception* ecs.exceptions.DuplicateSystemTypeError(*system\_type*)[[source]](_modules/ecs/exceptions.html#DuplicateSystemTypeError)[¶](#ecs.exceptions.DuplicateSystemTypeError "Permalink to this definition")

Bases: exceptions.Exception

Error indicating that the system type already exists in the system

manager.

| Parameters: | **system\_type** (type) – type of the system |

*exception* ecs.exceptions.NonexistentComponentTypeForEntity(*entity\_instance*, *component\_type*)[[source]](_modules/ecs/exceptions.html#NonexistentComponentTypeForEntity)[¶](#ecs.exceptions.NonexistentComponentTypeForEntity "Permalink to this definition")

Bases: exceptions.Exception

Error indicating that a component type does not exist for a certain

entity.

| Parameters: | * **entity** (Entity) – entity without component type

* **component\_type** (type) – component type not in entity

 |

managers Module[¶](#module-ecs.managers "Permalink to this headline")

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

Entity and System Managers.

*class* ecs.managers.EntityManager[[source]](_modules/ecs/managers.html#EntityManager)[¶](#ecs.managers.EntityManager "Permalink to this definition")

Provide database-like access to components based on an entity key.

add\_component(*entity\_id*, *component\_instance*)[[source]](_modules/ecs/managers.html#EntityManager.add_component)[¶](#ecs.managers.EntityManager.add_component "Permalink to this definition")

Add a component to the database and associates it with the given

entity\_id. entity\_id can be an [ecs.models.Entity](#ecs.models.Entity "ecs.models.Entity")

object or a plain int.

| Parameters: | * **entity\_id** (int or [ecs.models.Entity](#ecs.models.Entity "ecs.models.Entity")) – GUID of the entity

* **component\_instance** ([ecs.models.Component](#ecs.models.Component "ecs.models.Component")) – component to add to the entity

 |

component\_for\_entity(*entity\_id*, *component\_type*)[[source]](_modules/ecs/managers.html#EntityManager.component_for_entity)[¶](#ecs.managers.EntityManager.component_for_entity "Permalink to this definition")

Return the instance of component\_type for the entity\_id

from the database.

| Parameters: | * **entity\_id** (int) – entity GUID

* **component\_type** (type) – a type of created component

 |

| Returns: | list of (entity\_id, component\_instance) tuples |

| Return type: | tuple of (int, [ecs.models.Component](#ecs.models.Component "ecs.models.Component")) |

| Raises : | NonexistentComponentTypeForEntity when component\_type does not exist on entity\_instance |

create\_entity()[[source]](_modules/ecs/managers.html#EntityManager.create_entity)[¶](#ecs.managers.EntityManager.create_entity "Permalink to this definition")

Return a new entity instance with the current lowest GUID value.

Does not store a reference to it, and does not make any entries in the

database referencing it.

| Returns: | the new entity |

| Return type: | [ecs.models.Entity](#ecs.models.Entity "ecs.models.Entity") |

database[[source]](_modules/ecs/managers.html#EntityManager.database)[¶](#ecs.managers.EntityManager.database "Permalink to this definition")

Get this manager’s database. Direct modification is not

permitted.

| Returns: | the database |

| Return type: | [dict](http://docs.python.org/library/stdtypes.html#dict "(in Python v2.7)") |

pairs\_for\_type(*component\_type*)[[source]](_modules/ecs/managers.html#EntityManager.pairs_for_type)[¶](#ecs.managers.EntityManager.pairs_for_type "Permalink to this definition")

Return a list of (entity\_id, component\_instance) tuples for all

entities in the database possessing a component of component\_type.

Return an empty list if there are no components of this type in the

database. Can use in a loop like this, where Renderable is a

component type:

```

for entity, renderable\_component in entity\_manager.pairs\_for\_type(Renderable):

    pass # do something

```

| Parameters: | **component\_type** (type) – a type of created component |

| Returns: | list of (entity\_id, component\_instance) tuples |

| Return type: | tuple of (int, [ecs.models.Component](#ecs.models.Component "ecs.models.Component")) |

remove\_component(*entity\_id*, *component\_type*)[[source]](_modules/ecs/managers.html#EntityManager.remove_component)[¶](#ecs.managers.EntityManager.remove_component "Permalink to this definition")

Remove the component of component\_type associated with

entity\_id from the database. Doesn’t do any kind of data-teardown.

It is up to the system calling this code to do that. In the future,

a callback system may be used to implement type-specific destructors.

| Parameters: | * **entity\_id** (int) – GUID of the entity

* **component\_type** ([ecs.models.Component](#ecs.models.Component "ecs.models.Component")) – component to remove from the entity

 |

remove\_entity(*entity\_id*)[[source]](_modules/ecs/managers.html#EntityManager.remove_entity)[¶](#ecs.managers.EntityManager.remove_entity "Permalink to this definition")

Remove all components from the database that are associated with

entity\_id, with the side-effect that the entity is also no longer

in the database.

| Parameters: | **entity\_id** (int) – entity GUID |

*class* ecs.managers.SystemManager[[source]](_modules/ecs/managers.html#SystemManager)[¶](#ecs.managers.SystemManager "Permalink to this definition")

A container and manager for [ecs.models.System](#ecs.models.System "ecs.models.System") objects.

add\_system(*system\_instance*)[[source]](_modules/ecs/managers.html#SystemManager.add_system)[¶](#ecs.managers.SystemManager.add_system "Permalink to this definition")

Add a [ecs.models.System](#ecs.models.System "ecs.models.System") instance to the manager.

| Parameters: | **system\_instance** ([ecs.models.System](#ecs.models.System "ecs.models.System")) – instance of a system |

remove\_system(*system\_type*)[[source]](_modules/ecs/managers.html#SystemManager.remove_system)[¶](#ecs.managers.SystemManager.remove_system "Permalink to this definition")

Tell the manager to no longer run the system of this type.

| Parameters: | **system\_type** (type) – type of system to remove |

systems[[source]](_modules/ecs/managers.html#SystemManager.systems)[¶](#ecs.managers.SystemManager.systems "Permalink to this definition")

Get this manager’s list of systems.

| Returns: | system list |

| Return type: | list of [ecs.models.System](#ecs.models.System "ecs.models.System") |

update(*dt*)[[source]](_modules/ecs/managers.html#SystemManager.update)[¶](#ecs.managers.SystemManager.update "Permalink to this definition")

Run all systems in order, for this frame.

| Parameters: | **dt** (float) – delta time, or elapsed time for this frame |

models Module[¶](#module-ecs.models "Permalink to this headline")

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

Entity, Component, and System classes.

*class* ecs.models.Component[[source]](_modules/ecs/models.html#Component)[¶](#ecs.models.Component "Permalink to this definition")

Class from which all components should derive.

*class* ecs.models.Entity(*guid*)[[source]](_modules/ecs/models.html#Entity)[¶](#ecs.models.Entity "Permalink to this definition")

Encapsulation of a GUID to use in the entity database.

| Parameters: | **guid** (int) – globally unique identifier |

*class* ecs.models.System[[source]](_modules/ecs/models.html#System)[¶](#ecs.models.System "Permalink to this definition")

An object that represents an operation on a set of objects from the game

database. The [update()](#ecs.models.System.update "ecs.models.System.update") method must be implemented.

update(*dt*)[[source]](_modules/ecs/models.html#System.update)[¶](#ecs.models.System.update "Permalink to this definition")

Run the system for this frame. This method is called by the system

manager, and is where the functionality of the system is implemented.

| Parameters: | **dt** (float) – delta time, or elapsed time for this frame |

### [Table Of Contents](index.html)

* [API Documentation](#)

	+ [ecs Package](#module-ecs.__init__)

	+ [exceptions Module](#module-ecs.exceptions)

	+ [managers Module](#module-ecs.managers)

	+ [models Module](#module-ecs.models)

#### Previous topic

[Entity-Component-System](index.html "previous chapter")

### This Page

* [Show Source](_sources/api.txt)

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](genindex.html "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [previous](index.html "Entity-Component-System") |

* [Entity-Component-System 0.1 documentation](index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





Entity-Component-System — Entity-Component-System 0.1 documentation

### Navigation

* [index](genindex.html "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [next](api.html "API Documentation") |

* [Entity-Component-System 0.1 documentation](#) »

Entity-Component-System[¶](#entity-component-system "Permalink to this headline")

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

* [API Documentation](api.html)

	+ [ecs Package](api.html#module-ecs.__init__)

	+ [exceptions Module](api.html#module-ecs.exceptions)

	+ [managers Module](api.html#module-ecs.managers)

	+ [models Module](api.html#module-ecs.models)

#### Next topic

[API Documentation](api.html "next chapter")

### This Page

* [Show Source](_sources/index.txt)

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](genindex.html "General Index")

* [modules](py-modindex.html "Python Module Index") |

* [next](api.html "API Documentation") |

* [Entity-Component-System 0.1 documentation](#) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





Python Module Index — Entity-Component-System 0.1 documentation

### Navigation

* [index](genindex.html "General Index")

* [modules](# "Python Module Index") |

* [Entity-Component-System 0.1 documentation](index.html) »

Python Module Index

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

[**e**](#cap-e)

|  |  |  |

| --- | --- | --- |

|  |  |  |

|  | **e** |  |

| - | ecs |  |

|  | [ecs.\_\_init\_\_](api.html#module-ecs.__init__) |  |

|  | [ecs.exceptions](api.html#module-ecs.exceptions) |  |

|  | [ecs.managers](api.html#module-ecs.managers) |  |

|  | [ecs.models](api.html#module-ecs.models) |  |

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](genindex.html "General Index")

* [modules](# "Python Module Index") |

* [Entity-Component-System 0.1 documentation](index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





Overview: module code — Entity-Component-System 0.1 documentation

### Navigation

* [index](../genindex.html "General Index")

* [modules](../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../index.html) »

All modules for which code is available

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

* [ecs.exceptions](ecs/exceptions.html)

* [ecs.managers](ecs/managers.html)

* [ecs.models](ecs/models.html)

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](../genindex.html "General Index")

* [modules](../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





ecs.managers — Entity-Component-System 0.1 documentation

### Navigation

* [index](../../genindex.html "General Index")

* [modules](../../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../../index.html) »

* [Module code](../index.html) »

Source code for ecs.managers

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

```

"""Entity and System Managers."""

from ecs.exceptions import (

    NonexistentComponentTypeForEntity, DuplicateSystemTypeError)

from ecs.models import Entity

[[docs]](../../api.html#ecs.managers.EntityManager)class EntityManager(object):

 """Provide database-like access to components based on an entity key."""

 def \_\_init\_\_(self):

 self.\_database = {}

 self.\_next\_guid = 0

 @property

[[docs]](../../api.html#ecs.managers.EntityManager.database) def database(self):

 """Get this manager's database. Direct modification is not

 permitted.

 :return: the database

 :rtype: :class:`dict`

 """

 return self.\_database

[[docs]](../../api.html#ecs.managers.EntityManager.create_entity) def create\_entity(self):

 """Return a new entity instance with the current lowest GUID value.

 Does not store a reference to it, and does not make any entries in the

 database referencing it.

 :return: the new entity

 :rtype: :class:`ecs.models.Entity`

 """

 entity = Entity(self.\_next\_guid)

 self.\_next\_guid += 1

 return entity

[[docs]](../../api.html#ecs.managers.EntityManager.add_component) def add\_component(self, entity\_id, component\_instance):

 """Add a component to the database and associates it with the given

 ``entity\_id``. ``entity\_id`` can be an :class:`ecs.models.Entity`

 object or a plain :class:`int`.

 :param entity\_id: GUID of the entity

 :type entity\_id: :class:`int` or :class:`ecs.models.Entity`

 :param component\_instance: component to add to the entity

 :type component\_instance: :class:`ecs.models.Component`

 """

 component\_type = type(component\_instance)

 if component\_type not in self.\_database:

 self.\_database[component\_type] = {}

 self.\_database[component\_type][entity\_id] = component\_instance

[[docs]](../../api.html#ecs.managers.EntityManager.remove_component) def remove\_component(self, entity\_id, component\_type):

 """Remove the component of ``component\_type`` associated with

 ``entity\_id`` from the database. Doesn't do any kind of data-teardown.

 It is up to the system calling this code to do that. In the future,

 a callback system may be used to implement type-specific destructors.

 :param entity\_id: GUID of the entity

 :type entity\_id: :class:`int`

 :param component\_type: component to remove from the entity

 :type component\_type: :class:`ecs.models.Component`

 """

 try:

 del self.\_database[component\_type][entity\_id]

 if self.\_database[component\_type] == {}:

 del self.\_database[component\_type]

 except KeyError:

 pass

[[docs]](../../api.html#ecs.managers.EntityManager.pairs_for_type) def pairs\_for\_type(self, component\_type):

 """Return a list of ``(entity\_id, component\_instance)`` tuples for all

 entities in the database possessing a component of ``component\_type``.

 Return an empty list if there are no components of this type in the

 database. Can use in a loop like this, where ``Renderable`` is a

 component type:

 .. code-block:: python

 for entity, renderable\_component in \

entity\_manager.pairs\_for\_type(Renderable):

 pass # do something

 :param component\_type: a type of created component

 :type component\_type: :class:`type`

 :return: list of ``(entity\_id, component\_instance)`` tuples

 :rtype: :class:`tuple` of (:class:`int`, :class:`ecs.models.Component`)

 """

 try:

 return self.\_database[component\_type].items()

 except KeyError:

 return []

[[docs]](../../api.html#ecs.managers.EntityManager.component_for_entity) def component\_for\_entity(self, entity\_id, component\_type):

 """Return the instance of ``component\_type`` for the ``entity\_id``

 from the database.

 :param entity\_id: entity GUID

 :type entity\_id: :class:`int`

 :param component\_type: a type of created component

 :type component\_type: :class:`type`

 :return: list of ``(entity\_id, component\_instance)`` tuples

 :rtype: :class:`tuple` of (:class:`int`, :class:`ecs.models.Component`)

 :raises: :exc:`NonexistentComponentTypeForEntity` when \

 ``component\_type`` does not exist on ``entity\_instance``

 """

 try:

 return self.\_database[component\_type][entity\_id]

 except KeyError:

 raise NonexistentComponentTypeForEntity(

 entity\_id, component\_type)

[[docs]](../../api.html#ecs.managers.EntityManager.remove_entity) def remove\_entity(self, entity\_id):

 """Remove all components from the database that are associated with

 ``entity\_id``, with the side-effect that the entity is also no longer

 in the database.

 :param entity\_id: entity GUID

 :type entity\_id: :class:`int`

 """

 # Don't use iterkeys(), otherwise we will get a RuntimeError about

 # mutating the length of the dictionary at runtime.

 for comp\_type in self.\_database.keys():

 try:

 del self.\_database[comp\_type][entity\_id]

 if self.\_database[comp\_type] == {}:

 del self.\_database[comp\_type]

 except KeyError:

 pass

[[docs]](../../api.html#ecs.managers.SystemManager)class SystemManager(object):

 """A container and manager for :class:`ecs.models.System` objects."""

 def \_\_init\_\_(self):

 self.\_systems = []

 self.\_system\_types = {}

 # Allow getting the list of systems but not directly setting it.

 @property

[[docs]](../../api.html#ecs.managers.SystemManager.systems) def systems(self):

 """Get this manager's list of systems.

 :return: system list

 :rtype: :class:`list` of :class:`ecs.models.System`

 """

 return self.\_systems

[[docs]](../../api.html#ecs.managers.SystemManager.add_system) def add\_system(self, system\_instance):

 """Add a :class:`ecs.models.System` instance to the manager.

 :param system\_instance: instance of a system

 :type system\_instance: :class:`ecs.models.System`

 """

 system\_type = type(system\_instance)

 if system\_type in self.\_system\_types:

 raise DuplicateSystemTypeError(system\_type)

 self.\_system\_types[system\_type] = system\_instance

 self.\_systems.append(system\_instance)

[[docs]](../../api.html#ecs.managers.SystemManager.remove_system) def remove\_system(self, system\_type):

 """Tell the manager to no longer run the system of this type.

 :param system\_type: type of system to remove

 :type system\_type: :class:`type`

 """

 self.\_systems.remove(self.\_system\_types[system\_type])

 del self.\_system\_types[system\_type]

[[docs]](../../api.html#ecs.managers.SystemManager.update) def update(self, dt):

 """Run all systems in order, for this frame.

 :param dt: delta time, or elapsed time for this frame

 :type dt: :class:`float`

 """

 # Iterating over a list of systems instead of values in a dictionary is

 # noticeably faster. We maintain a list in addition to a dictionary

 # specifically for this purpose.

 for system in self.\_systems:

 system.update(dt)

```

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](../../genindex.html "General Index")

* [modules](../../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../../index.html) »

* [Module code](../index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





ecs.models — Entity-Component-System 0.1 documentation

### Navigation

* [index](../../genindex.html "General Index")

* [modules](../../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../../index.html) »

* [Module code](../index.html) »

Source code for ecs.models

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

```

"""Entity, Component, and System classes."""

from \_\_future\_\_ import print\_function

from abc import ABCMeta, abstractmethod

[[docs]](../../api.html#ecs.models.Entity)class Entity(object):

 """Encapsulation of a GUID to use in the entity database."""

 def \_\_init\_\_(self, guid):

 """:param guid: globally unique identifier

 :type guid: :class:`int`

 """

 self.\_guid = guid

 def \_\_str\_\_(self):

 """Stringify.

 :return: GUID as a string

 :rtype: :class:`str`

 """

 return str(self.\_guid)

 def \_\_hash\_\_(self):

 """Hash function for this object.

 :return: the hash value

 :rtype: :class:`int`

 """

 return self.\_guid

 def \_\_eq\_\_(self, other):

 """Equality method.

 :param other: other entity

 :type other: :class:`Entity`

 :return: ``True`` if equal

 :rtype: :class:`bool`

 """

 return self.\_guid == hash(other)

[[docs]](../../api.html#ecs.models.Component)class Component(object):

 """Class from which all components should derive."""

 pass

[[docs]](../../api.html#ecs.models.System)class System(object):

 """An object that represents an operation on a set of objects from the game

 database. The :meth:`update` method must be implemented.

 """

 \_\_metaclass\_\_ = ABCMeta

 @abstractmethod

[[docs]](../../api.html#ecs.models.System.update) def update(self, dt):

 """Run the system for this frame. This method is called by the system

 manager, and is where the functionality of the system is implemented.

 :param dt: delta time, or elapsed time for this frame

 :type dt: :class:`float`

 """

 print("System's update() method was called "

 "with time delta of {}".format(dt))

```

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](../../genindex.html "General Index")

* [modules](../../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../../index.html) »

* [Module code](../index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





ecs.exceptions — Entity-Component-System 0.1 documentation

### Navigation

* [index](../../genindex.html "General Index")

* [modules](../../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../../index.html) »

* [Module code](../index.html) »

Source code for ecs.exceptions

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

```

"""Exceptions that may be raised."""

[[docs]](../../api.html#ecs.exceptions.NonexistentComponentTypeForEntity)class NonexistentComponentTypeForEntity(Exception):

 """Error indicating that a component type does not exist for a certain

 entity."""

 def \_\_init\_\_(self, entity\_instance, component\_type):

 """:param entity: entity without component type

 :type entity: :class:`Entity`

 :param component\_type: component type not in entity

 :type component\_type: :class:`type`

 """

 self.entity\_instance = entity\_instance

 self.component\_type = component\_type

 def \_\_str\_\_(self):

 return "Nonexistent component type: `{0}' for entity: `{1}'".format(

 self.component\_type.\_\_name\_\_, self.entity\_instance)

[[docs]](../../api.html#ecs.exceptions.DuplicateSystemTypeError)class DuplicateSystemTypeError(Exception):

 """Error indicating that the system type already exists in the system

 manager."""

 def \_\_init\_\_(self, system\_type):

 """:param system\_type: type of the system

 :type system\_type: :class:`type`

 """

 self.system\_type = system\_type

 def \_\_str\_\_(self):

 return "Duplicate system type: `{0}'".format(self.system\_type.\_\_name\_\_)

```

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](../../genindex.html "General Index")

* [modules](../../py-modindex.html "Python Module Index") |

* [Entity-Component-System 0.1 documentation](../../index.html) »

* [Module code](../index.html) »

 © Copyright 2013 Kevin Ward, Sean Fisk.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 

