FEZ. Frankenstein Entity Zystem.
FEZ. Frankenstein Entity Zystem.
In component based programming, entities are made up of components, the entity itself is just a number that identifies a collection of components.
The components hold the data and do the logic.
In the FEZ, there are four kinds of components:
- Attributes
- Behaviours
- Controllers
- Renderers
Attributes hold data about an object and nothing else, they mainly consist of getters and setters to the data. Some attributes might do validation to the data or perform transformations. The point of the attribute is to separate data from logic.
Behaviours perform logic code, usually using the data from the entities attributes. Behaviours belong to an entity and that entity is passed to it's update method.
Controllers don't belong to any entity, you need to update controllers explicitly. Controllers have an updateEntity method which is by default run for every entity. Controllers can set a filter so they only perform logic on entities with the given components.
Renderers are the same as controllers, we just use this term to separate logic from rendering.
Components can invoke methods in other components directily, but the best practise is to use events. FEZ comes with a class called EventDispatcher, components can 'subscribe/listen' to events and 'publish/send' events, this reduces coupling between components.
Take a look at the example on github: https://github.com/perky/FEZ
If you're new to entity systems take a look at this blog http://t-machine.org/index.php/2007/11/ ... nt-part-2/
Last edited by ljdp on Fri May 18, 2012 7:16 pm, edited 2 times in total.
Re: Lua Entity System
I really like the idea of component based design, but did not yet encounter a game project big enough to apply it to. You library certainly makes it easier to try it sometimes. Good work!
Only two comments (not to be taken too seriously):
Only two comments (not to be taken too seriously):
- Lua-Entity-System sounds too serious. It deserves a catchier name. Maybe Frankenstein? Or a clever acronym?
- The code looks quite enterprisesy. Are you by any chance a Java developer?
Re: Lua Entity System
I've dabbled in a bit of java but no, it's inspired by a java component libartemis.vrld wrote:I really like the idea of component based design, but did not yet encounter a game project big enough to apply it to. You library certainly makes it easier to try it sometimes. Good work!
Only two comments (not to be taken too seriously):
- Lua-Entity-System sounds too serious. It deserves a catchier name. Maybe Frankenstein? Or a clever acronym?
- The code looks quite enterprisesy. Are you by any chance a Java developer?
I guess I could give it a funner name, but I like things that do exactly what they say on the tin.
Re: Lua Entity System
Lua Entity System
yes, i know i'm trying too hard lawl
yes, i know i'm trying too hard lawl
Re: Lua Entity System
I vote to keep the name Lua Entity System. This looks pretty solid; however, I find it strange that PlayerCollisionController obtains a reference to the player by filtering out entities without ShapeCircle components. I think it would be more straightforward to make the player entity global or pass it by reference.
Re: Lua Entity System
kclanc wrote:I vote to keep the name Lua Entity System. This looks pretty solid; however, I find it strange that PlayerCollisionController obtains a reference to the player by filtering out entities without ShapeCircle components. I think it would be more straightforward to make the player entity global or pass it by reference.
Code: Select all
self:addComponentFilters( Collidable, ShapeCircle, Transform )
Approaching it this way makes it simple if you want to have multiple players if you implemented multiplayer etc..
Re: Lua Entity System
OR any other component? Wouldn't that include everything? It's plausible that something other than a player would have Collidable, ShapeCircle, and Transform components, right? Wouldn't this cause a problem?
Re: Lua Entity System
The example on github needs more work, but essentially you would have a Player attribute and only player entities would have this attribute.kclanc wrote:OR any other component? Wouldn't that include everything? It's plausible that something other than a player would have Collidable, ShapeCircle, and Transform components, right? Wouldn't this cause a problem?
So you can just
Code: Select all
setComponentFilter( Player )
See this link for a more detailed description on entity systems http://t-machine.org/index.php/2007/11/ ... nt-part-2/
Re: Lua Entity System
You might want to consider programming this using metatables; the added flexibility would likely be beneficial for something like this. For example, you could require the programmer to explicitly list all of a component's dependencies. That said, I read article you linked to as well as all of the other posts in the series. I have to say: they seemed a bit psuedo-scientific to me.
Who is online
Users browsing this forum: No registered users and 0 guests