hxE - Entity System for Haxe!

669 views
Skip to first unread message

PSvils

unread,
May 6, 2013, 6:47:33 AM5/6/13
to haxe...@googlegroups.com
Hey everyone!

I published an Entity System I've been working on and using in my own projects to haxelib / github! - https://github.com/PDeveloper/hxE

It's based on the Artemis ES: http://gamadu.com/artemis/

Read up on Entity systems! (There are 5 parts to the below link) http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

A sample is included, so check that out to see the entity system in action! :) Let me know what you guys think/bugs/questions, etc.

P.

Message has been deleted

PSvils

unread,
May 6, 2013, 6:51:34 AM5/6/13
to haxe...@googlegroups.com
Also haxelib installable:
haxelib install hxE

j...@justinfront.net

unread,
May 6, 2013, 7:40:04 AM5/6/13
to haxe...@googlegroups.com
PSvils 

The example in your repository is 2D would you have a different component for 3D, a 3D game would have both 2D and 3D components? would you be able to mix an entity system with a 3D engine like away, or a particle engine like flint etc....  That article is quite a bit of reading so the concepts are far from settled in my head, and it's a sunny day so only looked briefly but interesting.  I will have to come back and read and think, but do you plan to show some mini games maybe a js one so we can see how it might perform and how it may look like in a larger context?

Best Justin

On 6 May 2013, at 11:51, PSvils wrote:

Also haxelib installable:
haxelib install hxE

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dan Korostelev

unread,
May 6, 2013, 7:47:46 AM5/6/13
to haxe...@googlegroups.com
Hey, sorry for such a shameless plug, but you may want to look at the example game made with my port of Ash framework (https://github.com/nadako/Ash-HaXe). It's another entity system (ported from AS3), but the concepts used is basically the same (entities, components, systems that work with a set of components (called nodes in Ash)), so you can wrap your head around ES easier. You can also read this great article by Ash original author: http://www.richardlord.net/blog/what-is-an-entity-framework. It describes how is old-school game loop transformed to entity-component-system based one.

понедельник, 6 мая 2013 г., 15:40:04 UTC+4 пользователь JLM написал:

PSvils

unread,
May 6, 2013, 8:26:16 AM5/6/13
to haxe...@googlegroups.com
I would make a Transform3dComponent, since it's just easier. And of course you can mix the entity system with other engines! My current game engine uses NAPE physics for example:
I have a NAPEComponent, which stores a reference to the nape.phys.Body.
The physics system requires an NAPEComponent and a Transform2dComponent, and overrides the onEntityAdded(), onBeginProcessing() function, as well as processEntity(). onBeginProcessing simply calles the space.step() function, and processEntity copies over values from the Body to the Transform component.
onEntityAdded() simply adds the components body to the space (which is owned by the system).

I imagine most other things would work similarily! The Entity System concept is different from traditional OOP stuff, so it can take some time to get used to, but I personally love entity systems now, and the result is much cleaner code.

P.

PSvils

unread,
May 6, 2013, 8:52:52 AM5/6/13
to haxe...@googlegroups.com
Haven't seen the Ash framework - I might recall hearing about it once though :)

Will check it out, but from what you describe, seems very similar to what I just made!

P.

AS3Boyan

unread,
May 7, 2013, 6:29:44 AM5/7/13
to haxe...@googlegroups.com
Guys, as I understand, there is some advantages of using entity systems, like easy way to change renderer, and other things. But to use such system, you will need to create it first, is it worth it?

If someone will make project using entity system, will it help him, to make another game? Can he use this base, that he created in another game?

And, maybe in such systems, performance a lil bit decreased, but it should be enough for many games.

Please tell me additional advantages/disadvantages of such systems?

PSvils

unread,
May 7, 2013, 6:52:08 AM5/7/13
to haxe...@googlegroups.com
Well, most base systems should be entirely reusable, like the rendering systems, physics systems, and for other projects you should be able to piece together things quite easily with previously made components and systems. Of course, sometimes you need to specialize certain systems for a specific purpose, but you get a lot of boilerplate stuff done faster.

In my current game engine, I make "plugins", which is basically a Plugin object which manages a set of systems that are meant to work together. And so I can copy paste whole pieces of functionality, like an item/inventory plugin, which is useful for any occasion that involves an entity absorbing another entity, and adding it to it's inventory.

Also, creating systems is very isolated, making it much easier to think about what is going on. In the renderer in the sample for example, all you're thinking about is adding entities to the container, and then updating the graphics. When working on it, that's all you are worrying about, and not about breaking other bits of the application.

In terms of performance, I haven't done much benchmarking, but I doubt that the entity system should end up being the bottle neck. If you use ComponentTypeSlots, like the sample does, then component access should be extremely fast in any case!

P.

AS3Boyan

unread,
May 7, 2013, 10:40:05 AM5/7/13
to haxe...@googlegroups.com
Thank you for detailed answer! So looks like it can speed up development process a lot and can reduce count of bugs, and even make code more readable!

Rob Fell

unread,
May 7, 2013, 12:58:05 PM5/7/13
to haxe...@googlegroups.com
Separation of Concerns is the priority for sure.  Component / entity systems are one abstraction closer to the magical "build game now" button.  Some entity systems abstract towards self awareness - i.e. "game can rearrange itself on the fly" concepts.  Entity systems lend themselves well to expressive scripting and visual IDEs.

PSvils

unread,
Sep 24, 2013, 4:58:10 AM9/24/13
to haxe...@googlegroups.com
hxE has been updated!

The new version is much more optimized!
First off, I threw out all Map<Int, Entity>, and just use an Array<Entity>, which by my tests, increases performance by at least 2 times.
Second of all, when using ComponentTypeSlot objects for component access, there is no internal type casting anymore, which should work much faster.

And third of all, I introduce the concept of "Contexts". There is a new sample, and also you can check the github wiki for a short overview of what they are/how they are used.

If you have any questions, then definitely ask away here :)

https://github.com/PDeveloper/hxE
( It's not available over haxelib yet, you'll have to use haxelib git (Have to reset my haxelib account somehow... )

P.
Reply all
Reply to author
Forward
0 new messages