lophnai [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=31539 Fila: A Framework for ECS and Prototype-Oriented Programming <p>Hi, everyone!</p> <p>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.</p> <p>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:</p> <p>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!) </p> <p>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.</p> <p>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).</p> <p>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.</p> <p>Github: <a href="https://github.com/sicusa/fila">https://github.com/sicusa/fila</a></p> https://www.lexaloffle.com/bbs/?tid=35346 https://www.lexaloffle.com/bbs/?tid=35346 Sat, 14 Sep 2019 08:32:03 UTC