Jump to content

Entity Systems : have you used them in HTML5 game dev ?


Ezelia
 Share

Recommended Posts

while I'm experimenting ECS, I think the reason of lack of such engine is simply because Entities Systems are more a concept than a Framework.

 

looking for an ECS Engine/Framework is like looking for an POO Engine/Framework, it doesn't make sens :)

 

the base of my current ECS implementation is composed of 4 little files, those files are just helpers to make job easier.

I resolved all my performance issues with my "scheduler" approach, instead of having dumb loop I have a module (the scheduler) witch handles priorities and reduce iterations to only needed entities.

 

so IMHO, you'll still have to write it from scratch because event with ECS frameworks you'll have to write all data objects (components), assign them to entities and write game logic (subsystems) ... actually you are juste writing the whole game :)

 

Link to comment
Share on other sites

I don't know if i agree with your statement that it is the same as OOP, as with ECS the trick is to manage the internal references to optimize the processing speed. I have seen quite complicated implementations of that, although i don't think it'd make a difference in moderate use-cases, but i think this is the operative point in thinking of a general framework.

 

 

I agree that the work will be done by implementing the actual entities and components, but i still think it  makes sense to have a general library that handles the component entity system interaction in a good and fast way...

 

Well, maybe i will just invest the time to do it myself, but as i said i am not so knowledgeable i JS optimization, so i'd prefer to let some better suited person deal with that :)

Link to comment
Share on other sites

the point is, in javascript games you have two things to optimise, the objects you handle : ECS simplifies this since eveything is entity it makes it easier to handle them with object pools ...etc

the other thing is the rendering loop, and here, everything good for classic OOP games is good here too.

my approach to speedup things is that each subsystem maintain a list of entities it handles (and only those ones).
when I add a component to an entity, I check witch systems should manipulate that component and attache the entity to the subsystem.

 

so in my implementation, adding/removing component to entity is a little costy, but those operations are "rare" , rare here means I don't add/remove thosand of component in each rendering loop :D

so I end up with extremely fast subsystems loop, and a bigger renderer loop (since it'll handle the biggest entities list).

Link to comment
Share on other sites

Hey I like the topic since I first started learning and using CraftyJS but ... I hit performance problems too soon.

 

So I went and check how Entity Component Systems works and I found several implementations like:

 

JAVA - Artemis - http://gamadu.com/artemis/

 

AS3 - Ash - http://www.ashframework.org/

 

So what i decided to do was to make JS ports ... well TS ports as both implementation got a class structure and other interesting concepts which i found a bit harder making in pure javascript... 

 

So what i made is:

 

https://github.com/MikeMnD/AshTS

 

https://github.com/MikeMnD/ArtemisTS

 

Beside that I think Crafty way of doing things is not optimal and i like Ash concepts more.

 

Also i steped back from Entity Systems because they are far too complex for my first needs, and also because what i look in HTML5 game engine at the moment is:

 

1. Performance

2. Structure

3. As much Bug free as posible...

 

Also i like building engine/frameworks but I want to build games mainly :)

 

ECS is complex and maybe is the best option for bigger and complex games but for now i think performance and features are more important for game making community than scalable and superb strucutred games...

 

Well it's always the goals we want that define the way we do it. :)

 

I'll be happy if you(Ezelia) or someone else from this topic check my code (there is compiled JS which a pretty good) and than we can discuss concepts. :)

 

Great topic btw.

Link to comment
Share on other sites

hi Mike

I already tested Ash and since I'm using TS a lot I saw your port on github :)

actually Ash is the best one I tested, I was not able to make your TS port working (maybe because I updated to TS 0.9.1 witch also broke some of my projects), but I tested another js port https://github.com/brejep/ash-js

 

what I don't like about Ash are "nodes", they add a layer of complexity to the ECS imo, maybe I'm wrong, maybe they make things easier in some situations or maybe they make sens in AS3 but not necessary in JS.

I'm polishing my ECS implementation witch is also written in TS, but I'll need some documentation and some examples ... I'll share my code when I get something presentable :)

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

hi Mike

I already tested Ash and since I'm using TS a lot I saw your port on github :)

actually Ash is the best one I tested, I was not able to make your TS port working (maybe because I updated to TS 0.9.1 witch also broke some of my projects), but I tested another js port https://github.com/brejep/ash-js

 

what I don't like about Ash are "nodes", they add a layer of complexity to the ECS imo, maybe I'm wrong, maybe they make things easier in some situations or maybe they make sens in AS3 but not necessary in JS.

I'm polishing my ECS implementation witch is also written in TS, but I'll need some documentation and some examples ... I'll share my code when I get something presentable :)

 

I totally agree om you saying the nodes are basicly added complexity, do you have a github ink of your ECS system?

Link to comment
Share on other sites

  • 1 month later...

Hello all :)

just wanted to let you know that I open sourced my current implementation of ECS : https://github.com/Ezelia/eee

this is what I'm using for my current games.

I didn't want to release it without complete doc and real examples, but this can take me a while.
so I decided to release it with a minimal demo and a work in progress (very basic at this stage) documentation : https://github.com/Ezelia/eee/wiki


I'll update the documentation and add other demos to demonstrate features implemented : the current demo is only here to show you how to start, sorry for some bad practices :D .

the engine is developed in TypeScript, but is usable in pure JS (I'll post pure JS demo later).
you'll notice some "unnecessary" syntax some times, but they are here to profit from TypeScript type cheking and intellisens, it'll make sens to people who like this language :).

I'll make a separate topic when the full doc + examples are ready.



 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...