Sign in to follow this  
Dan Milward

Entity Component System (ECS)

Recommended Posts

What is an ECS?


An ECS allows game objects to perform custom operations without any additional manager code.


In an ECS, all objects in a game world are represented as entities; their properties are represented as components; and the game has systems to update entities and components.


Yes. So why am I posting this?

Because we've just overhauled entities in kiwi.js and written up quite a big post on it. Take a squiz... let me know what you think :)



Share this post

Link to post
Share on other sites

While you have implemented a good composition over inheritance paradigm here this line bothers me a little


and the game has systems to update entities


Because in your architecture the logic has been moved from systems to components.





Component: the raw data for one aspect of the object (...)

System: "Each System runs continuously (as though each System had its own private thread) and performs global actions on every Entity that possesses a Component of the same aspect as that System."



And by the aspect we can understand a mask made out of components  - for example - system Movable has a mask reflecting Velocity and Position (components).

Then it loops through all the entities and if they have Velocity and Position components - the logic from that system (Movable) is applied.


Anyway - take my point with a pinch of salt as I don't have enough experience with this approach to tell if it will scale well (especially in terms of decoupling).



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.