Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

I found a pretty ergonomic way to implement ECS in Fennel:

Entities are Lua tables, components keys/value pairs. Systems make use of the powerful pattern matching:

(fn draw [world]
  "System which draws textures."
  (each [_ entity (ipairs world)]
    (case entity
      {: x : y : texture}
      (draw-texture texture x y))))

The “framework” is just 40 lines of glue to allow removing entities inside systems.

Obviously this doesn’t give you the performance benefits for which ECS was originally designed, but it makes implementing some gameplay mechanics easier. I originally chose ECS because I knew it would be easy to maintain (the data/functionality split makes understanding codebases easier).