• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

nidorx/ecs-lua: ECS Lua is a fast and easy to use ECS (Entity Component System) ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

nidorx/ecs-lua

开源软件地址(OpenSource Url):

https://github.com/nidorx/ecs-lua

开源编程语言(OpenSource Language):

Lua 100.0%

开源软件介绍(OpenSource Introduction):

https://nidorx.github.io/ecs-lua

Build Status

Read the Documentation

What is it?

ECS Lua is a fast and easy to use ECS (Entity Component System) engine for game development.

The basic idea of this pattern is to stop defining entities using a hierarchy of classes and start doing use of composition in a Data Oriented Programming paradigm. (More information on Wikipedia). Programming with an ECS can result in code that is more efficient and easier to extend over time.

How does it work?

ECS Lua pipeline

Talk is cheap. Show me the code!

local World, System, Query, Component = ECS.World, ECS.System, ECS.Query, ECS.Component

local Health = Component(100)
local Position = Component({ x = 0, y = 0})

local isInAcid = Query.Filter(function()
   return true  -- it's wet season
end)

local InAcidSystem = System("process", Query.All( Health, Position, isInAcid() ))

function InAcidSystem:Update()
   for i, entity in self:Result():Iterator() do
      local health = entity[Health]
      health.value = health.value - 0.01
   end
end

local world = World({ InAcidSystem })

world:Entity(Position({ x = 5.0 }), Health())

Features

ECS Lua has no external dependencies and is compatible and tested with Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, LuaJit and Roblox Luau

  • Game engine agnostic: It can be used in any engine that has the Lua scripting language.
  • Ergonomic: Focused on providing a simple yet efficient API
  • FSM: Finite State Machines in an easy and intuitive way
  • JobSystem: To running systems in parallel (through coroutines)
  • Reactive: Systems can be informed when an entity changes
  • Predictable:
    • The systems will work in the order they were registered or based on the priority set when registering them.
    • Reactive events do not generate a random callback when issued, they are executed at a predefined step.

Goal

To be a lightweight, simple, ergonomic and high-performance ECS library that can be easily extended. The ECS Lua does not strictly follow "pure ECS design".

Usage

Read our Full Documentation to learn how to use ECS Lua.

Get involved

All kinds of contributions are welcome!


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
tanvirtin/monokai.nvim: Monokai theme for Neovim written in Lua.发布时间:2022-08-16
下一篇:
Karlend/midnight_lua: Some luas for midnight.im发布时间:2022-08-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap