Log In  

Hi, everyone!

A few months ago I started trying to combine the flexibility and conciseness of both ECS (Entity-Component-System) paradigm and prototype-oriented programming (of which Lua is famous). After several iterations, the framework, which is named Fila, began to take shape and even gradually surpass my initial expectations. So after spending quite a few time writing the demo, I think it's time to share it to all of you.

To be short, Fila is not a framework built based on some foundation of software development such as OOP. It's designed to be the foundation, just like OOP, ECS and prototype-oriented programming. As a result, you don't need to know any of them to be able to understand Fila. What needed is a completely (or partially, maybe) renewed perspective of how the data and logic could be organized. This is where Fila looks really different from other programming paradigms:

If you are familiar with OOP - In Fila there is no class, every object (named fila) can be a class, or properly speaking, a template for its child instances. (Lua developers should be quite familiar about it - this is what metatable does!)

if you are familiar with ECS - in Fila there is no system, every fila can be a system, or properly speaking, can match and inject desired logic (rules) to its child instances.

When I was writing the demo of Fila, I was amazed by how elegant and intuitional it was to model the real world we are living (thus the game world). The only problem is that for PICO-8, taking up 2471 tokens for a mere framework is simply too much...So if performance is not your major concern (maybe also secondary XD), feel free to delete all the lines of code started from '-- Event Bus' and only use normal groups to inject your logic, which will save you total amount of 1049 tokens (you will understand what I am saying once you read the demo code in the 0 tab of the cart. And trust me! It's really fun to read).

All feedbacks and contributions are welcomed. Furthermore, since English is not my mother tongue, if you find any grammatical mistakes or typos in the repo, feel free to make a pull request.

Github: https://github.com/sicusa/fila

P#67655 2019-09-14 08:32 ( Edited 2019-09-14 08:58)

What exactly is a "knot"? And why is it named that way? From what I can tell, it's just a field you can add to an object. So why is there an abstraction over it? Why not just let people set fields on the objects directly, like bird.can_fly = true?

P#67826 2019-09-17 20:27

Hi tesselode!

A knot is an abstraction over component. In ECS paradigm, aside from extending the data an entity carries, components can be used as 'keywords' to select entities we care about (for example, to select all the entities that have 'velocity' and 'mass' components).

Fila Framework extends this matching and selecting mechanism with the power of prototype-oriented programming. A fila can be derived from another fila and inherits all its knots (components). Parent fila can select its children (see fast group and reactive group section in the demo).

Therefore, unlike ECS in which we have seperated concepts for data (Entity) and logic (System), Fila unifies both of them.

P#67856 2019-09-18 12:12

I still don't understand why you have to have functions for setting and accessing knots. Why not just let people define the fields directly on the table for each fila?

P#67893 2019-09-19 09:40

Hi tesselode.

Besides setting and accessing knots, there are many other important functions for fila. For example, functions for creating and fetching groups, functions for adding and removing listeners, functions for resetting, lifting and detaching, and so on. So it would be risky to allow people define knots on the fila table directly, since they may accidentally overwrite these functions.

P#67895 2019-09-19 14:16 ( Edited 2019-09-19 16:24)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-06-03 10:25 | 0.011s | 2097k | Q:17