Skip to main content

Timeline for Logic in Entity Components Systems

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Oct 24, 2012 at 15:14 history edited snake5 CC BY-SA 3.0
updated the code sample to better reflect the idea
Oct 24, 2012 at 14:32 comment added snake5 @Kikaimaru No, it isn't. Some of it just happens to be merged in there usually. And I don't understand what problems you're having with this approach. You're stating things that are generally up to the developer to decide on and thus irrelevant.
Oct 24, 2012 at 14:27 comment added Kikaimaru Well and? The points is that what you call "glue code" is called System in Artemis. So its not like you found easier way to do this, you just call it differently. But in your approach where logic is on components, your components needs to see code they really dont need (so changing your approach to rendering will be more complex then simply chaning one class - system), and in the rendering example, almost no code will be on component, since rendering is too complexe to be done like this - you will be left with some class that will like set vertexbuffer and call drawindexes...
Oct 24, 2012 at 14:12 comment added snake5 @Kikaimaru If you really want to implement something like that, all it takes is creating a simple function (it can be anywhere) that iterates through the data of available components.
Oct 24, 2012 at 13:53 comment added Kikaimaru All the data are in the component, but all the logic is in system. Thats what artemis' systems are used for.
Oct 24, 2012 at 13:45 comment added snake5 @Kikaimaru Yeah. That's inevitable in any system. It's called "glue code". And when I'm at it, I would like to keep the state where it is. In your example, the state is unnecessarily moved. In other words, you forgot about "MyData".
Oct 24, 2012 at 13:41 comment added Kikaimaru well you still need something that calls MyFunction, and logic of that calling is in most cases complex (like sorting, frustum culling etc.) and when you're at that, there is not much difference between writing RenderingSystem.MyComponentMyFunction() and calling that function on component
Oct 24, 2012 at 13:00 history answered snake5 CC BY-SA 3.0