{"id":20313550,"url":"https://github.com/66origin/node-necs","last_synced_at":"2025-04-11T17:12:09.823Z","repository":{"id":44218757,"uuid":"194705802","full_name":"66Origin/node-necs","owner":"66Origin","description":"Tiny, battle-tested, easy to use ECS for small data-sets","archived":false,"fork":false,"pushed_at":"2023-01-05T04:53:24.000Z","size":420,"stargazers_count":8,"open_issues_count":8,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T13:11:12.721Z","etag":null,"topics":["battle-tested","component","ecs","entity","game","node","simple","system","unity","video"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/66Origin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-01T16:13:12.000Z","updated_at":"2021-11-22T15:47:46.000Z","dependencies_parsed_at":"2023-02-03T10:31:25.458Z","dependency_job_id":null,"html_url":"https://github.com/66Origin/node-necs","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/66Origin%2Fnode-necs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/66Origin%2Fnode-necs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/66Origin%2Fnode-necs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/66Origin%2Fnode-necs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/66Origin","download_url":"https://codeload.github.com/66Origin/node-necs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248447559,"owners_count":21105137,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["battle-tested","component","ecs","entity","game","node","simple","system","unity","video"],"created_at":"2024-11-14T18:11:45.756Z","updated_at":"2025-04-11T17:12:09.794Z","avatar_url":"https://github.com/66Origin.png","language":"JavaScript","readme":"# Not an ECS\n\n`NECS` is not an `ECS`.\n\nIt take some principles from the `ECS` pattern but break some of its rules.\n\n**In short:**\n\n- Entity, Components and Systems.\n- Components are not pure data, they can have 'code' and can replace systems in some cases.\n- There is an entity tree: each entity can have child entities. That means there is one 'super entity' which own all\nentities from your world.\n- On calling `update()` to an entity, all its childs and component will have `earlyUpdate()` and `lateUpdate()` called.\n\nIt is like the `GameObject` (entity) and `MonoBehaviour` (components) from Unity.\n\n**Core design principles:**\n\n- Small and easy to read/edit.\n- It does only one small thing.\n- As it is not super-evolved, it may not fit your needs. It will not be efficient for big datasets.\n- Battle tested and production tested.\n- Fail-fast. Every function call is type and error checked and throw errors: no silent error that will blow somewhere sometime.\n- We use `lodash` but do require only the functions we need and we do not use chains. It drastically lower the memory footprint.\n- Sub-classing components is supported. One limitation: you must not insert many components sharing a common super class (excepted for AComponent).\nThis limitation is not strictly checked in code due to limitations from Javascript. Making components as mixins may fix the limitation on a later update.\n\n# Use cases\n\nIt fits cases when you need efficient entity hierarchy for small data set, fast prototyping and easy to maintain production code.\n\n# Examples\n\nWhat you could easily implement:\n```javascript\nconst world = Entity.createWorld();\nworld.add(SystemComponent); // This entity is now able to run systems\nworld.systems.add(DrawSystem); // DrawSystem draw each sprites on-screen\n\nconst wall = world.createChild('wall'); // Create an entity in your world. It represent nothing yet\nwall.add(SpriteComponent, 'wall.png'); // Your entity will now be drawed on-screen using 'wall.png'\nwall.sprite.position.x = 10;\nwall.sprite.position.y = 10;\n\nconst player = world.createChild('player');\nplayer.add(SpriteComponent, 'player.png');\n\nworld.update(); // wall and player are now drawn on screen\n\nwall.sprite.visible = false;\n\nworld.update(); // only player is now drawn on screen\n```\n\n- [Super simple example](examples/simple/index.js)\n- [Game of life reimplemented](examples/game_of_life/index.js)\n\n# Documentation\n\nEverything is documented in the code. It is small enough so you can read the documentation there.\n\n[You can also access documentation generated from code in doc/doc.md](doc/doc.md).\n\n# Tests\n\n    npm run test\n\nTests are available in the `test` folder. They are easy to read but boring, take a look if you want\nto understand better how it works.\n\n# License\n\nThis work is dual-licensed under Apache 2.0 and GPL 2.0 (or any later version).\nYou can choose between one of them if you use this work.\n\n`SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F66origin%2Fnode-necs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F66origin%2Fnode-necs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F66origin%2Fnode-necs/lists"}