Download

Feature suggestion: Complete Entity-Component-System for UE4

Hi everyone,

like my title already says, I’d love to have a fully implemented ECS in UE4.
I know a lot of things are already (at least somewhat) done that way, however there are still things that aren’t possible to handle in components (e.g. (and especially) input is handled/forwarded by the “PlayerController” framework-class and not available in components and networking is directly implemented in “Actor”) and thus it seems somehow unfinished and you still have to do the split between using UE4’s inheritance-based (framework) concept and component-based programming. Another thing is that the components are also kinda in a state where I’m not sure what I should think of them… Why do I need to have a static mesh component in order to be affected by physics (of course I could leave the mesh empty, but isn’t that the point to use components: To not “hide” stuff you don’t need by ignoring it, but rather by really not-having it). I know I am quite bitchy here, but a component based-workflow would have several benefits.
One of them is obviously the gain in flexibility; simply sticking objects together via components at runtime or using Blueprints as prefabs, while still being able to add/remove components later on (or at runtime) is great. Plus the option to inherit Blueprints (yeah I know, inheritance here… but I wouldn’t call inheriting a blueprint, with no actual behaviour in it, inheritance in a C++/Java/C#/etc. sense, but rather using a factory method from an entity whose factory method is already defined, and only extending it a bit) to create dynamic entity-hierachies instead of static class-hierachies.
Another one would be transparency. It’d give (UE4) beginners (and also experienced designers, exploring new areas) a huge advantage. They don’t have to dig their way through thousands of lines of C++ code to find the line they’re interested in. They’d simply think: I’m interested in networking, let’s look at the (maybe) “NetworkingComponent”. Together with some interfaces this would also make it a lot easier for people to alter already existing components/behaviour.

To be clear, I don’t want to abolish inheritance from UE4, though I’m not really a fan of it anymore. However everyone should be able to use what fit’s him best and since this is already perfectly implemented (and used by many professionals), I don’t see any reason to remove it. However, a clean starting point for people who are more familiar with an ECS and would like to use it only (yes, without ever having to use one of UE4’s derived classes) would be really, really awesome.
I definitely don’t want to start an engine war, but an ECS as Unity3D uses it would already be a good step in the right direction. For instance they have a “MeshComponent” for selecting a mesh, a “MeshRenderer” for rendering it, a “ColliderComponent” for collision and a “RigidbodyComponent” for physics, etc… . In UE4 if you have e.g. a “StaticMeshComponent” it already contains a transform and physics… I works but (as already mentioned above) it mixes up things that shouldn’t be mixed up… Of course some components are dependent on each other, but an explicit mentioned dependency (Unity has a “RequiresComponent” attribute), working with Tags or a clever event system would leave a component’s logic, that doesn’t belong in another, in it’s own realm.

I’m really curious if Epic already considered to implement an clean ECS. If yes, in what manner. If not, maybe why.

Thanks already for taking your time reading my suggestion and best regards,

Benjamin :slight_smile:

PS: Error spotting welcome :wink: . It’s a quite complex theme so I might misspelled the one ore another word…

Have actually implemented a full-featured ECS workflow for Unreal Engine. It’s fully interoperable with existing UE tools/workflows, has some nifty features like data inheritance. It’s available on the Marketplace now: Apparatus in Code Plugins - UE Marketplace