UE4 Vs. Entity Component System

A common pattern-type used in game development is the Entity Component System. Further details of this system can be found here.

UE4 wouldn’t be the first engine to use this system, Crysis and Unity both implement this pattern to varying degrees. On the surface it looks like UE4 does too. Was this a conscious decision at Epic or did things just pan out that way? If it was (a conscious decision) then how does UE4’s implementation compare to the various textbook versions? How are
the fundamental problems with the pattern solved (ie: greater than linear complexity).

PS: I’m no great expert on the subject, nor will most people be who are passing through this thread, so please take the time to teach us a thing or two in your explanation.

I’m not from Epic, so I post this here as a comment, but having used Unity, UE3 and UE4 and can say that Unity is way more Component based than Unreal is at it’s core, BUT Unreal is clearly heading this way.

Unreal 4 will still make you herit from the game base class, like PlayerController, GameMode, HUD, Character, etc which are often themselves child of other classes. Character which is a Pawn which is an Actor which is an Object (I may be forgetting some, I do not have the code in from of me right now).

However, at one point during the UE3 life cycle, Epic seem to have decided to slowly diverge from that model to include the Component object. I remember reading a post about the creation of the “component” in Unreal, I’m not sure if it was new from UE2 to UE3 or if it was "creeping in " UE3, but it was kinda “new” to Unreal (at least from what I remember).

Now, UE4 is a step forward in the Component system, since each Actor that is not a “core” class of the game, is built from components. For example, we now have the SceneComponent that has the Transform information of an object, rather than it being included in Object like it was in UE3.

The Blueprint system is a lot more relatable to Prefab in Unity, with the ability to add the number of Components you want and a clear view of what they are and which is child of which.

I hope this was at least a bit helpful!

Mick

First of all it is not a very common used pattern, while people using it do their best efforts to spread its usage.

Unreal like Unity is a EC (notice missing the “S”) Entity-Component based Game Engine, the difference with the well-known ECS pattern is that logic is still present in components in UE4, I think it is actually possible use a full ECS approach with UE4 (even if not natively supported), the main problem would be for networked code, for which at some point you’ll need to pass from an Actor, but apart that you can threat certain Actors as components (pure data) and certain actors as systems (pure logic) without too much issues in UE4. However be aware that I saw no major experimentations with UE4 and ECS pattern so there could be some subtle issue that you will it along the way if you decide to do ECS with UE4.

UE5 may be full ECS. UE4 4.26 had the unreal sequencer fully remade in ecs. There is a post about it and their engineers say that ECS is far better for performance than OOP. It is complicated to understand so you can search for ecs tutorials on youtube. At the end of the day, it is a design pattern and can be implemented 100s of different ways.

Article: Performance at scale: Sequencer in Unreal Engine 4.26 - Unreal Engine