Started a Blog Series how to use an Entity System

Hi there

I just want to share this with you. I started a beginners how to use an entity system with a simple game example.
The idea is that you can copy paste the code and read some explanations why and the like.

I have three articles and one in the pipeline. I think there will be some more.
Here the linke to my blog http://fprintf.logdown.com/ and this articles are online
Entity Component System Part 1 « fprintf
Entity Component System Part 2 « fprintf
Entity Component System Part 3 « fprintf
Entity Component System Part 4 « fprintf
Entity Component System Part 5 « fprintf
Entity Component System Part 6 « fprintf

EDIT: A slight adjusted version of this case study can be found on the wiki of the famous Zay ES in the case study section: Zay Es Case Studies · jMonkeyEngine-Contributions/zay-es Wiki · GitHub

I will send updates in this topic…
This may or may not help.

Have a nice day.

18 Likes

Very well written, I always thought ESes were a lot like scene graphs. Now I see how completely wrong I was… One question though, I don’t think you mentioned it, but are there any performance gains compared to the classic way of doing things?

1 Like

There can be. But much of the time the structure off the app is so different that it’s hard to decide why. Rethinking processes into data-oriented approaches often has a performance benefit. Not as much in Java (definitely performance boosts in natively compiled languages with respect to cache-coherency, etc)… but there are still some benefits.

And the fact that multithreading is free and lock-free can be a big boon also.

4 Likes

I was reading your blog on this. Excellent. But, when I got to part III, I think your site got “JMonkeyed”! :smile: Seems like under too much load.

Anyway, this is an extremely well written set of articles on this topic. Thank you kindly.

1 Like

Very great. I got to know about Zay-ES framework. Thanks :grinning:
So for your Systems you extended AbstractAppState and for your Components (which are classes with just variables and setters and getters ) you implemented EntityComponent . Am i right?

The next thing I get is how ZayES approach is different from JME’s controllers.
Actually in JME when we add one controller to some spatials it create new instance of same controller for each spatial and the update method for each spatial is triggered from main loop of game. [and every spatial has an ArrayList which contains its systems (controllers).]
But with Zay-ES the approach is different than controllers [actually we have no controller and just use AbstractAppState for systems.]. So for every system we just have one instance of that system (extension of AbstractAppState) and in its update method we loop through all the entities which have that system and do our logic … . Am I right ?

And finally there is also this great article which explain Component Based Architecture (CBA) vs OOP and some implementation of CBA . ES is just one of those implementation and actually the best one.
You can take a look at it : http://www.raywenderlich.com/24878/introduction-to-component-based-architecture-in-games

Thanks

2 Likes

Yes I think you got the idea pretty well. And exactly I implement EntityComponents. In the next article I will show the famous decay system and its usage. On it.

2 Likes

I also observed this today that lodown do have some performance problems :frowning:

1 Like

Note: while I haven’t read the articles yet (hope to soon), if you would like to host these on the Zay-ES wiki in github then I can probably make that happen (give permissions, etc.). :smile:

Else I will settle for linking to them.

1 Like

Thanks for all the nice words :smile:

1 Like

would love to see them on Zay ES side. Maybe there we should do it in a more serious format lesser in a story. Maybe.
I’m not finished yet. I also would like to hear what you think of my example as you did all that once explain it to me :smile:

1 Like

If you send me your github user I will see about setting up wiki permissions.

Maybe not… if we put them in a more story-oriented section then it could be fine. I haven’t read them, though… so maybe they are crazy and I will change my mind. :slight_smile: But it doesn’t sound like an issue on the surface.

1 Like

ia97lies is as well my github username. Ok have a look. I think to port them to Zay ES is probably only copy past as it is all in markdown. You can change/correct it any time either :smile:
Be aware I’m not finished yet. I think 3 more at least will follow to bring that penny’s dropped effect it had to me.

1 Like

I was thinking maybe we can have a user stories section for stuff like this. As we tease out useful advice then we can build more ‘documentation-like’ pages that have that direct advice perhaps with forward/back links to the stories about why.

1 Like

Sent you an invite.

1 Like

yeah I like that idea. I would make it similar to the jme beginners section actually. so my blog articles should have good names on zay es side. in the blog I tried some funny ones, well I thought they are :wink:

I will look tomorrow at your invited now I need some sleep first.

1 Like

Still waiting for you to accept your invitation so I can give you the right permissions.

1 Like

ok done. was too tired yesterday. we have not the same timezone though :smile:

1 Like

You have access to the zay-es repo now. Please use it wisely. :slight_smile:

2 Likes

Update: I published my 4th article

As well I started to work on the Zay ES Wiki currently just copy pasted my markdowns from the blog. But I will polish a little more and make them more a wiki text than a blog like article.

4 Likes

“I think the purpose of this action listener is cleaer : …”

“Radius” seems strange in the speed constructor. maybe a copy/missed? :smile:

public Speed(float radius) {
    this.speed = radius;
}

Little problem with the bulletAppState snippet :

From that point the markup is messed up.

Keep up the good work !

1 Like