Skip to content
ConcordConcordConcord

Start using Concord

It's a feature complete ECS library for Lua

How a game is written

In Concord you start with an empty World.

World
local world = Concord.World()

You first define the shapes of the characteristics that exist in the World by defining Components.

Components
Concord.Component("position", function (component, x, y)
component.x = x
component.y = y
end)

Your World can have any number of Entities.

Entities
local Cat = world:newEntity()
local Rock = world:newEntity()

The characteristics that we previously defined can be given to Entities.

Give
Cat:give("position", 50, 50)

Finally there are Systems. These define filters that allow them to have a subset of all Entities.

Systems
local Movement = Concord.System("Movement", {movers = { "position" }})
world:addSystem(Movement)

Systems can also listen to events and iterate over those filtered lists.

Events
function Movement:move ()
for i, entity in ipairs(self.movers) do
entity.position.x = entity.position.x + 5
end
end

You fire those events from the World using emit.

Emit
world:emit("move")