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.6.tar.gz (17.2 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.6-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tinyecs-0.2.6.tar.gz
  • Upload date:
  • Size: 17.2 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.6.tar.gz
Algorithm Hash digest
SHA256 589d67701ec731d7498d6dea8e98fda407ecd33dcdfcc030abb24f075d4092e7
MD5 f2a6cb02d4e252dbf2123b0d2c4030dc
BLAKE2b-256 70c96d4eea266c86497a876eb7b83c06cdefc573075fec2b71f99cfc4ffd73bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tinyecs-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 18.3 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4ba5fecd6ff4a3a38ba8d0bdf2d1b66880a2c4c523f383f5d0ae568df7aaf3b8
MD5 b163cc75bd811538514c6247131db3fa
BLAKE2b-256 c5b56705b7e72cf464b365abf68482ffdc297c35894ba481b0c5a3bc37894854

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