Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm integrating artemis entity system in my IOS engine. Everything is working nicely but there are some tasks that I'm finding difficult to achieve.

Artemis works around components and systems. Components are just data holders with no logic and systems are the ones that apply logic to components (they process components data and create new results).

In my game, the world is splitted in layers, and when an entity is added to the world the RenderSystem needs to know what layer it belongs to add its avatar to the visible world. First time the object is added to the world this is easy to accompllish: I can have a Layer property in the graphic component and when the entity containing this component is added to the world the RenderSystem (that owns the scene) adds it to the correct layer.

The problem comes when I want to move the object to another layer. I have come across 2 "solutions":

1) To have a system that watches for changes in the GraphicComponent layer member and when it changes, it does the layer swap.

2) To have some "dirty flags" in the gameobject to flag things that have changed in the components. Then systems can check this and do swhat they need.

Both of them seem pretty ugly and ineficient.

Summing up, it is difficult in FRP to do a direct call on a component to change it, because you allways need to have a system (that contains the logic) to do everything.

How would you handle this type of things in a system like artemis following the FRP paradigm?

Thanks in advance.

share|improve this question
By FRP are you referring to functional reactive programming? If so, I've never heard of anybody using that for games before so you might want to elaborate. If not, then what does the abbreviation mean? – Kylotan Dec 26 '11 at 18:42
Yes, sorry for the acronym. I was refering to functional active programming. Perhaps Artemis doesn't follow FRP to the letter, but I think it is closer to FRP than the ussual paradigm. – Notbad Dec 26 '11 at 22:07
Can't you just sort graphic components by layer before rendering them? – Den Dec 27 '11 at 16:13
If I did understand FRP correctly, this has to be done when processing the entity, so don't know how to do what you mean :/. Anyway I'm trying to resolve this problems with a little mix of FRP and OOP, because both aproaches are good when used where they have to be used. – Notbad Dec 28 '11 at 15:53
as said in another thread: this is not FRP. – lambdor Dec 29 '11 at 18:47
show 1 more comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.