{"id":13525078,"url":"https://github.com/bakpakin/tiny-ecs","last_synced_at":"2025-04-04T11:11:59.466Z","repository":{"id":29095771,"uuid":"32625028","full_name":"bakpakin/tiny-ecs","owner":"bakpakin","description":"ECS for Lua ","archived":false,"fork":false,"pushed_at":"2023-03-15T01:27:58.000Z","size":4543,"stargazers_count":714,"open_issues_count":7,"forks_count":60,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-28T10:06:48.921Z","etag":null,"topics":["entity-component","entity-component-system","love2d","lua"],"latest_commit_sha":null,"homepage":"http://bakpakin.github.io/tiny-ecs/doc/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bakpakin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-03-21T08:16:25.000Z","updated_at":"2025-03-27T18:41:02.000Z","dependencies_parsed_at":"2024-01-03T04:02:33.958Z","dependency_job_id":null,"html_url":"https://github.com/bakpakin/tiny-ecs","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakpakin%2Ftiny-ecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakpakin%2Ftiny-ecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakpakin%2Ftiny-ecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bakpakin%2Ftiny-ecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bakpakin","download_url":"https://codeload.github.com/bakpakin/tiny-ecs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"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":["entity-component","entity-component-system","love2d","lua"],"created_at":"2024-08-01T06:01:15.759Z","updated_at":"2025-04-04T11:11:59.445Z","avatar_url":"https://github.com/bakpakin.png","language":"Lua","readme":"# tiny-ecs #\n\n## NOTE\n\nAlthough there have been almost no commits in several years, this\nproject is not abandoned. tiny-ecs is, for most intents and\npurposes, finished, and no bugs have been brought to my attention in a while.\nNew issues on GitHub will be addressed.\n\n[![Build Status](https://travis-ci.org/bakpakin/tiny-ecs.png?branch=master)](https://travis-ci.org/bakpakin/tiny-ecs)[![License](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE)\n\nTiny-ecs is an Entity Component System for Lua that's simple, flexible, and useful.\nBecause of Lua's tabular nature, Entity Component Systems are a natural choice\nfor simulating large and complex systems. For more explanation on Entity\nComponent Systems, here is some\n[basic info](http://en.wikipedia.org/wiki/Entity_component_system \"Wikipedia\").\n\nTiny-ecs also works well with object-oriented programming in Lua because\nSystems and Entities do not use metatables. This means you can subclass your\nSystems and Entities and use existing Lua class frameworks with tiny-ecs, no problem.\nFor an example on how to use tiny-ecs with object-oriented Lua, take a look at the\ndemo branch, specifically the systems and entities subdirectories.\n\n## Overview ##\nTiny-ecs has four important types: Worlds, Filters, Systems, and Entities.\nEntities, however, can be any Lua table, and Filters are just functions that\ntake an Entity as a parameter.\n\n### Entities ###\nEntities are simply Lua tables of data that gets processed by Systems. Entities\nshould contain primarily data rather than code, as it is the System's job to\ndo logic on data. Henceforth, a key-value pair in an Entity will\nbe referred to as a Component.\n\n### Worlds ###\nWorlds are the outermost containers in tiny-ecs that contain both Systems\nand Entities. In typical use, only one World is used at a time.\n\n### Systems ###\nSystems in tiny-ecs describe how to update Entities. Systems select certain Entities\nusing a Filter, and then only update those select Entities. Some Systems don't\nupdate Entities, and instead just act as function callbacks every update. Tiny-ecs\nprovides functions for creating Systems easily, as well as creating Systems that\ncan be used in an object oriented fashion.\n\n### Filters ###\nFilters are used to select Entities. Filters can be any Lua function, but\ntiny-ecs provides some functions for generating common ones, like selecting\nonly Entities that have all required components.\n\n## Example ##\n```lua\nlocal tiny = require(\"tiny\")\n\nlocal talkingSystem = tiny.processingSystem()\ntalkingSystem.filter = tiny.requireAll(\"name\", \"mass\", \"phrase\")\nfunction talkingSystem:process(e, dt)\n    e.mass = e.mass + dt * 3\n    print((\"%s who weighs %d pounds, says %q.\"):format(e.name, e.mass, e.phrase))\nend\n\nlocal joe = {\n    name = \"Joe\",\n    phrase = \"I'm a plumber.\",\n    mass = 150,\n    hairColor = \"brown\"\n}\n\nlocal world = tiny.world(talkingSystem, joe)\n\nfor i = 1, 20 do\n    world:update(1)\nend\n```\n\n## Use It ##\nCopy paste tiny.lua into your source folder. For stability and consistent API,\nplease use a tagged release or use LuaRocks.\n\n## Luarocks ##\nTiny-ecs is also on [LuaRocks](https://luarocks.org/) and can be installed with\n`luarocks install tiny-ecs`.\n\n## Demo ##\nCheck out the [demo](https://github.com/bakpakin/tiny-ecs/tree/demo-commandokibbles), a game\noriginally written for Ludum Dare 32 with the theme 'An Unconventional Weapon'. The demo uses\n[LÖVE](https://love2d.org/), an amazing game framework for Lua.\n\n## Testing ##\nTiny-ecs uses [busted](http://olivinelabs.com/busted/) for testing. Install and run\n`busted` from the command line to test.\n\n## Documentation ##\nSee API [here](http://bakpakin.github.io/tiny-ecs/doc/).\nFor the most up-to-date documentation, read the source code, or generate the HTML\nlocally with [LDoc](http://stevedonovan.github.io/ldoc/).\nSee the original forum thread [here](https://love2d.org/forums/viewtopic.php?f=5\u0026t=79937\u0026p=182589).\n","funding_links":[],"categories":["Game Development","Lua","Entity","[ECS Libraries](#contents)","Libraries"],"sub_categories":["Programming Frameworks \u0026 Languages","Programming Language"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakpakin%2Ftiny-ecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbakpakin%2Ftiny-ecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbakpakin%2Ftiny-ecs/lists"}