{ "info": { "author": "Tim Fischer", "author_email": "tim.fischer98@hotmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython" ], "description": "# pyecs\n_An implementation of the Entity-Component-System pattern._\n\n[![PyPI](https://img.shields.io/pypi/v/pyecs)](https://pypi.org/project/pyecs)\n[![PyPI - Status](https://img.shields.io/pypi/status/pyecs)](https://pypi.org/project/pyecs)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyecs)](https://pypi.org/project/pyecs)\n[![PyPI - License](https://img.shields.io/pypi/l/pyecs)](https://opensource.org/licenses/MIT)\n\n[![Build Status](https://travis-ci.org/tim-fi/pyecs.svg?branch=master)](https://travis-ci.org/tim-fi/pyecs)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\n## Install\nThis project is available on [PyPI](https://pypi.org/project/pyecs) so you can simply install it via\n```sh\npip install pyecs\n```\n\n## Example\n```python\nfrom dataclasses import dataclass\nfrom typing import Tuple\n\nfrom pyecs import ECSController, Component, preconfigure_system, register_system\n\n# 1. build your components\n@dataclass\nclass Transform(Component, identifier=\"transform\"):\n position: Tuple[float, float] = (0.0, 0.0)\n\n\n@dataclass\nclass Rigidbody(Component, identifier=\"rigidbody\"):\n velocity: Tuple[float, float] = (0.0, 0.0)\n acceleration: Tuple[float, float] = (0.0, 0.0)\n\n\n# 2. define some systems\n@preconfigure_system((Transform, Rigidbody))\ndef physics(delta_t, data, entities):\n for entity in entities:\n entity.rigidbody.velocity = (\n entity.rigidbody.velocity[0] + entity.rigidbody.acceleration[0] * delta_t,\n entity.rigidbody.velocity[1] + entity.rigidbody.acceleration[1] * delta_t,\n )\n entity.transform.position = (\n entity.transform.position[0] + entity.rigidbody.velocity[0] * delta_t,\n entity.transform.position[1] + entity.rigidbody.velocity[1] * delta_t,\n )\n\n@preconfigure_system((Transform,))\ndef introspect_position(delta_t, data, entities):\n for entity in entities:\n print(f\"Entity {entity.uuid}: position = {entity.transform.position}\")\n\n\nif __name__ == \"__main__\":\n # 3. setup controller\n controller = ECSController()\n register_system(controller, physics)\n register_system(controller, introspect_position)\n\n # 4. add some entities\n controller.add_entity(\n Transform(), Rigidbody(acceleration=(1.0, 0.0))\n )\n controller.add_entity(\n Transform(), Rigidbody(acceleration=(0.0, 1.0))\n )\n controller.add_entity(\n Transform(), Rigidbody(acceleration=(1.0, 1.0))\n )\n\n # 5. run everything\n controller.run()\n```\n\n\n## Dev Setup\nSimply install [pipenv](https://docs.pipenv.org/en/latest/) and run the following line:\n```sh\npipenv install --dev\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tim-fi/pyecs", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyecs", "package_url": "https://pypi.org/project/pyecs/", "platform": "", "project_url": "https://pypi.org/project/pyecs/", "project_urls": { "Homepage": "https://github.com/tim-fi/pyecs", "Source": "https://github.com/tim-fi/pyecs" }, "release_url": "https://pypi.org/project/pyecs/0.2/", "requires_dist": null, "requires_python": ">=3.7", "summary": "An implementation of the Entity-Component-System pattern.", "version": "0.2" }, "last_serial": 5786822, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "1f0483de37d49e3845ff28b718c78e62", "sha256": "a7c0e9d41632bdf58af228a2744ebdf7921fe0df216330a85081a5bd5ab87e76" }, "downloads": -1, "filename": "pyecs-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1f0483de37d49e3845ff28b718c78e62", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 7198, "upload_time": "2019-09-04T10:38:54", "url": "https://files.pythonhosted.org/packages/50/5a/82108307de63d84a2f442e46463b3b8b5b79e216a4bc17a561b9f714bda7/pyecs-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fc089c12d47748cbb0b07e7f053513cc", "sha256": "4fa50485231b50d20c9c20deb1edd89ab364c6c281960d977b1be0522b082bf3" }, "downloads": -1, "filename": "pyecs-0.1.tar.gz", "has_sig": false, "md5_digest": "fc089c12d47748cbb0b07e7f053513cc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 7804, "upload_time": "2019-09-04T10:38:57", "url": "https://files.pythonhosted.org/packages/55/f8/8fb2e1dd9107ce74f7307ae946284f532dccb98fb14ec465b6e1ae39b8ad/pyecs-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "2be9f0abba7edae9cab08754e6723613", "sha256": "379bdba761837a6ec7e102e554cf4c3d4d6a1cbaa38bb36a7bc1b95c9dc12382" }, "downloads": -1, "filename": "pyecs-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2be9f0abba7edae9cab08754e6723613", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7", "size": 8379, "upload_time": "2019-09-05T14:26:44", "url": "https://files.pythonhosted.org/packages/6c/8f/261698f158675231ce4fbcd4f68bc30b9e832da40534f23ac16915fc81b5/pyecs-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "77cda7161a88a17278acf675713f136e", "sha256": "c617bec37e91f4b8202daeee013e0e0c8bbd1b2d0183200ccbfd1e53fd7e24f2" }, "downloads": -1, "filename": "pyecs-0.2.tar.gz", "has_sig": false, "md5_digest": "77cda7161a88a17278acf675713f136e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 8116, "upload_time": "2019-09-05T14:26:45", "url": "https://files.pythonhosted.org/packages/99/56/66da2c8fc7f398d40d6f87d902c9ec423c8ff52bae2d7b0409857ac8740e/pyecs-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2be9f0abba7edae9cab08754e6723613", "sha256": "379bdba761837a6ec7e102e554cf4c3d4d6a1cbaa38bb36a7bc1b95c9dc12382" }, "downloads": -1, "filename": "pyecs-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2be9f0abba7edae9cab08754e6723613", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.7", "size": 8379, "upload_time": "2019-09-05T14:26:44", "url": "https://files.pythonhosted.org/packages/6c/8f/261698f158675231ce4fbcd4f68bc30b9e832da40534f23ac16915fc81b5/pyecs-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "77cda7161a88a17278acf675713f136e", "sha256": "c617bec37e91f4b8202daeee013e0e0c8bbd1b2d0183200ccbfd1e53fd7e24f2" }, "downloads": -1, "filename": "pyecs-0.2.tar.gz", "has_sig": false, "md5_digest": "77cda7161a88a17278acf675713f136e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7", "size": 8116, "upload_time": "2019-09-05T14:26:45", "url": "https://files.pythonhosted.org/packages/99/56/66da2c8fc7f398d40d6f87d902c9ec423c8ff52bae2d7b0409857ac8740e/pyecs-0.2.tar.gz" } ] }