All Projects → bakpakin → Tiny Ecs

bakpakin / Tiny Ecs

Licence: mit
ECS for Lua

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Tiny Ecs

Lovetoys
🍌 a full-featured Entity-Component-System framework for making games with lua
Stars: ✭ 252 (-31.89%)
Mutual labels:  love2d, entity-component-system
Apecs
a fast, type driven, extensible ECS for game development
Stars: ✭ 292 (-21.08%)
Mutual labels:  entity-component-system
Adria-DX12
Graphics engine written in C++/DirectX12
Stars: ✭ 18 (-95.14%)
Mutual labels:  entity-component-system
Shipyard
Entity Component System focused on usability and speed.
Stars: ✭ 247 (-33.24%)
Mutual labels:  entity-component-system
IwEngine
This is an engine that I initially started building after taking a game coding class in high school. I didn't like Unity so tried to make something more code focused that was personally easier to use.
Stars: ✭ 97 (-73.78%)
Mutual labels:  entity-component-system
Esper
An ECS (Entity Component System) for Python
Stars: ✭ 269 (-27.3%)
Mutual labels:  entity-component-system
Brady
A camera library with parallax scrolling and aspect ratios for LÖVE.
Stars: ✭ 50 (-86.49%)
Mutual labels:  love2d
Godex
Godex is a Godot Engine ECS library.
Stars: ✭ 307 (-17.03%)
Mutual labels:  entity-component-system
Defaultecs
Entity Component System framework aiming for syntax and usage simplicity with maximum performance for game development.
Stars: ✭ 286 (-22.7%)
Mutual labels:  entity-component-system
Windfield
Physics module for LÖVE
Stars: ✭ 254 (-31.35%)
Mutual labels:  love2d
zay-es
Zay-ES is a Java-based high-performance entity-component-system.
Stars: ✭ 43 (-88.38%)
Mutual labels:  entity-component-system
clove
A helper library for LÖVE which allows to loads huge amount of assets super-easily 👊
Stars: ✭ 18 (-95.14%)
Mutual labels:  love2d
Love Nuklear
Lightweight immediate mode GUI for LÖVE games
Stars: ✭ 281 (-24.05%)
Mutual labels:  love2d
Live2LOVE
LÖVE library to show Live2D Cubism models (WIP)
Stars: ✭ 22 (-94.05%)
Mutual labels:  love2d
Gdk For Unity
SpatialOS GDK for Unity
Stars: ✭ 296 (-20%)
Mutual labels:  entity-component-system
UnityDOTS-Thesis
Bachelor's degree thesis on Unity DOTS architecture
Stars: ✭ 14 (-96.22%)
Mutual labels:  entity-component-system
animX
An animation library for Love2D with unique features
Stars: ✭ 17 (-95.41%)
Mutual labels:  love2d
Noobhub
🌐🔥 Network multiplayer and messaging for CoronaSDK, Moai, Gideros, LÖVE & Defold
Stars: ✭ 259 (-30%)
Mutual labels:  love2d
Ecs
C++ single-header entity component system library
Stars: ✭ 345 (-6.76%)
Mutual labels:  entity-component-system
Dod Playground
Sample OOP/ECS/DOD project (C++) for an internal Unity lecture in 2018
Stars: ✭ 299 (-19.19%)
Mutual labels:  entity-component-system

tiny-ecs

NOTE

Although there have been almost no commits in several years, this project is not abandoned. tiny-ecs is, for most intents and purposes, finished, and no bugs have been brought to my attention in a while. New issues on GitHub will be addressed.

Build StatusLicense

Tiny-ecs is an Entity Component System for Lua that's simple, flexible, and useful. Because of Lua's tabular nature, Entity Component Systems are a natural choice for simulating large and complex systems. For more explanation on Entity Component Systems, here is some basic info.

Tiny-ecs also works well with object-oriented programming in Lua because Systems and Entities do not use metatables. This means you can subclass your Systems and Entities and use existing Lua class frameworks with tiny-ecs, no problem. For an example on how to use tiny-ecs with object-oriented Lua, take a look at the demo branch, specifically the systems and entities subdirectories.

Overview

Tiny-ecs has four important types: Worlds, Filters, Systems, and Entities. Entities, however, can be any Lua table, and Filters are just functions that take an Entity as a parameter.

Entities

Entities are simply Lua tables of data that gets processed by Systems. Entities should contain primarily data rather than code, as it is the System's job to do logic on data. Henceforth, a key-value pair in an Entity will be referred to as a Component.

Worlds

Worlds are the outermost containers in tiny-ecs that contain both Systems and Entities. In typical use, only one World is used at a time.

Systems

Systems in tiny-ecs describe how to update Entities. Systems select certain Entities using a Filter, and then only update those select Entities. Some Systems don't update Entities, and instead just act as function callbacks every update. Tiny-ecs provides functions for creating Systems easily, as well as creating Systems that can be used in an object oriented fashion.

Filters

Filters are used to select Entities. Filters can be any Lua function, but tiny-ecs provides some functions for generating common ones, like selecting only Entities that have all required components.

Example

local tiny = require("tiny")

local talkingSystem = tiny.processingSystem()
talkingSystem.filter = tiny.requireAll("name", "mass", "phrase")
function talkingSystem:process(e, dt)
    e.mass = e.mass + dt * 3
    print(("%s who weighs %d pounds, says %q."):format(e.name, e.mass, e.phrase))
end

local joe = {
    name = "Joe",
    phrase = "I'm a plumber.",
    mass = 150,
    hairColor = "brown"
}

local world = tiny.world(talkingSystem, joe)

for i = 1, 20 do
    world:update(1)
end

Use It

Copy paste tiny.lua into your source folder. For stability and consistent API, please use a tagged release or use LuaRocks.

Luarocks

Tiny-ecs is also on LuaRocks and can be installed with luarocks install tiny-ecs.

Demo

Check out the demo, a game originally written for Ludum Dare 32 with the theme 'An Unconventional Weapon'. The demo uses LÖVE, an amazing game framework for Lua.

Testing

Tiny-ecs uses busted for testing. Install and run busted from the command line to test.

Documentation

See API here. For the most up-to-date documentation, read the source code, or generate the HTML locally with LDoc. See the original forum thread here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].