Entity-Component-System (ECS) for UE4

Hey, folks!

In case you don’t know what ECS is about: wiki, much more](Entity Component Systems · GitHub).
The main advantage is extendibility: you literally can add or remove the features almost w/o thinking about architecture, it won’t break your game. It becomes really handy when you yet to know all the game’s features, mechanics, etc. However, it is not the only one.
Second cool “feature” is **Data-Oriented **approach, in short it means the processing data will be structured in CPU-friendly

Where ECS really shoots is MOBA-like games – e.g., «Overwatch» uses ECS]( (reachable 5-th of Febraury, 2018). However, ECS can be used mostly in any genre. There are still discussions about tough logic (multithreading, pseudo-AI, real-time physics, etc.), but I believe it isn’t a reason not to get common with ECS.

As far as I know Unity is going to add this approach to official build (if they haven’t added it), moreover, there is already Entitas and other stuff.
What is more important, there is nothing ready-to-use for UE4, however, there are tons of ECS-frameworks for C++ (Artemis, EntityX, Anax, SRombauts’, redxdev’s, EnTT, etc.).

Since one doesn’t want to just add another layer on top of the UE4, we are going to сreate a plug-in that works directly with the core Engine’s pipeline (if it will shoot of course).
For this, I see a several problems (i.e., tasks) for ECS-module-to-UE4 integration (step-by-step plan):

  • understand (grasp entirely) how ECS should work
  • either adapt existing C++ solution (I think of EnTT), or implement it from scratch
  • find the exact spot(s) where the module should touch UE4
  • provide a layer for UE4 C++ API (including code generation and stuff)
  • provide intuitive GUI for end-user (or end-developer), i.e., plug-in with all the ECS-managers
  • get the feedback, fix the bugs, improve the module, etc.

Problem: there is no ECS pipeline in UE4.
Solution: GUI plug-in for UE4.

Update [2018.02.17]
I’ve found UGameEngine to make custom Game Loop cycle, and UEditorEngine \ UUnrealEdEngine to work with Editor directly (however, I think new GUI plug-in can be made a bit more easily, like that).
The one thing I am not sure is if it it’s possible (i.e., easy enough to work around) to change DefaultEngine.ini from plug-in side.
Moreover, I’ve connected EnTT to UE4 – looks like it works pretty well.

Update [2018.03.25]
For some reason custom GameLoop doesn’t want to be compiled. If anyone has success in this subject, please, write here or PM. [HR][/HR]
If you have any advices, considerations, notes, or thoughts, please, share.


I’m a bit confuse. What is the different between an ECS and the current Unreal system?? I mean, you have Actors who could works like an Entiy class and you have components which can be added to your Actor class.

I’m not questioning the system, just want to be more informed.


Kanc is correct.

This is already in UE. Look up Actors and Components

Or See

@Kanc[/USER],[USER=“11900”]OptimisticMonkey , yes, we do have AActor class that can be Entity and persist in World. But…

First of all, there is no EntityManager, or AActorManager, or ActorPool (correct me if I’m wrong), and that is essential for ECS. Moreover, you cannot turn on or off some Components in ComponentManager without breaking your game build either, and this is one of the aspects for ECS as well, as I understand it.

Secondly, indeed, UE4 has Entity-Component, not Entity-Component-System, that is a different thing (please, double check what is ECS, we are not talking about OOP-hierarchy). Components in UE4 now can have logic, but in ECS they should only contain data, and nothing more.

Having these two points, we do not have ECS-pipeline in UE4. Though, we could create all of this on top of the current hierarchy, but I’m not sure if it would be real Data-Driven approach, or just an emulation of it.

Thanks man. I didn’t know that in an ECS the components should only contain data.

How is this project going?

@s.ta.c., there are 3 points where I’m stuck:

  • EnTT compilation
  • compilation of custom GameLoop
  • creating GUI extension for the [Ed]Editor (didn’t have much time to dig in properly).

I’m not sure I want to write wrappers for EnTT, however, it’s considered as option. I will try to get to the code again this Sunday.

I’ll be following your progress eagerly. Good luck.

Following this eagerly. Is the idea similar to Lumberyard’s approach (keeping UE4’s EC based architecture and adding ECS as an additional feature)?

Looking forward to this :slight_smile:

@MaxISoP, not sure how it works in Lumberyard (ex-CryEngine), but… My idea was that developers can use both EC and ECS, having the benefits from both of the [architectural] patterns.

@WHSolv Yeah it sounds awesome! I don’t know how much you have progressed so far but from what I know, it’s gonna be very hard to integrate EnTT into the current framework and take advantage of existing features… BUT I DO REALLY HOPE YOU CAN MAKE IT!!!

@MaxISoP, well, I know of two usages of EnTT in UE4 (though, both are wrapper-versions):

I’m currently working on understanding how they work.
And my new idea is: once having custom GameLoop works, to inherit from UObject, creating some kind of UEntity, and later than have AEntity (reproducing AActor’s functionality).

:DLooking forward to this

It’s not that I don’t like the idea anymore but I have other projects to complete. So I wouldn’t expect anything so far. Just telling.

@Snipe3000, from what I’ve heard Unity make their own version of ECS. What I mean is it isn’t the standard one in terms of internals. Can’t really say something more, will need to dig in.

I don’t think there is a “standard” ECS, but there are a bunch of different implementations and Unity is building their own. The EnTT creator has a good writeup on ECS for anyone that is interested. The “ECS back and forth” series even includes discussion on certain decisions Unity and other ECS libraries made (in Part 2 and more):

Yesterday’s Unreal conference had a session on ECS. It’s called Speeding up Game Logic in Unreal Engine.

@the_nikola, big thanks! I’ve missed it.

Here’s the link to the video for folks not to search for it: .