Jump to content
  • Advertisement
Sign in to follow this  
HexDump

artemis entity system framework questions (All about FRP)

This topic is 2518 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement

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


Have layer A pass layer B the object when it moves layers.

But honestly I'd rethink my approach since that's not FRP. FRP you don't need to worry about it since there's no mutable state to deal with.

Share this post


Link to post
Share on other sites
When you are running the RenderSystem, do you truly need to know that an entity's Layer has changed or is it enough to just know what the current value is and act on it accordingly? It would seem that it would be enough to know what the current value is and handle it appropriately.

FRP is an interesting paradigm and I have toyed with the idea of implenting it my own game but haven't gotten much past the musing stage. If you are using FRP, you would need to have a stream that fires when the Layer changes that is received by the system that does the swapping.

You could implement this with a more traditional Observer Pattern type set up as well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!