Skip to main content

The teeniest, tiniest ECS system

Project description

tinyecs - The teeniesst, tiniest ESC system

After reading part 2 and 3 of these articles:

https://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

I decided to implement an ECS myself, well aware that esper is a solid and long existing implementation, but I wanted to see how to implement it myself.

The base premise is: No OO and entities have no data.

So an entity is only a unique identifier. Components can be anything that can hold data, e.g. dataclasses

Workflow:

1. entity = create_entity()
2. add_component(entity, cid, component}
   ...
3. add_system(fkt, *cids)
   ...
4. in game loop run_all_systems(dt)

alternatively run_system(fkt, *cids)

If a system needs to modify components of other entities, these entities e.g. the player, need special eids so they can be queried from the registry.

use comps_of_eid(eid, *comps) for that. This way, a bullet component can substract health from a player entity.

Basic components are in the tinyecs.components package.

As of now, please look into the demos folder and read the documentation in the module. A longer howto will be added soon.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinyecs-0.2.3.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tinyecs-0.2.3-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file tinyecs-0.2.3.tar.gz.

File metadata

  • Download URL: tinyecs-0.2.3.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tinyecs-0.2.3.tar.gz
Algorithm Hash digest
SHA256 7cdf74bb99dbd763ab7a43e3779265b15ecae4e4ee859c35df97b1706fc666f7
MD5 754697bded1b43a99c9fae8884a53077
BLAKE2b-256 ad4b89580959533b6b7a46478331098fc72836ffee067011ec627ec5d66d4a58

See more details on using hashes here.

File details

Details for the file tinyecs-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: tinyecs-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tinyecs-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5bb99fef51bf3182aba6f2c484b16ebb56e262c347a4a58fc80dbe7ce056b56d
MD5 b124b494143ace8c7e3587bff043ee26
BLAKE2b-256 5e3fed0e7f0b40cf5efa869f30f4d39e24ab3eaec66c54ff0e815eb76dae0fbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page