DEV Community


Posted on

Similarity between Entity-Component System and Redux

I am a front end engineer who develops mobile applications and Web applications.

My interest is how the data is mapped to the UI. In React, UI component is the function that maps data to the VDOM. What is difficult is how to manage data.

We using Redux and managing the whole data as Single State Tree and Single Source of Truth. SST is strongly centralized and anti separation of concerns. However, we will be able to take control of things instead.


We can say the application is the thing that has functions that map state into the view and functions that maps previous state to next state.

I recently learned about Unity's Entity-Component System (ECS). ECS is constructed from Entity, Component and System with Group. Entity is similar to a GameObject, but it does not have a function, it only has data. Component is just data. System is the feature that collects entities and do something with its components. Group is interesting, it shows the entity with the specified component, and it is similar to the idea of duck typing. For example in A-Frame, Box Entity = Position + Geometry + Material.


I initialy thout ECS was like a GameComponent alternative or something. A few days later, I noticed that ECS is similar to Redux!


So Entity and Component is State. System is Reducer and side effects. Group is the selector. Scene Graph is now SST!

This is wonderful. It is interesting that solutions originating from two completely different domains are moving towards similar solutions. One creates Redux from the complexity of the data, while one created ECS from the complexity of the scene. I'm looking forward to how Redux's ideas are made use of Unity and how ECS ideas can be utilized on the Web. Especially, it seems interesting to use Group 's way of thinking.

Top comments (2)

set001 profile image
Konstantin Kostuik

Very interesting idea. I'm gonna to experiment with this and implement simple game.

ryohey profile image

That’s nice!