Exporting...
This got me thinking, I should be using the Entity Component System(ECS) for all of this data realistically, and I will also be wanting to edit values of the Data Components from within the Level Editor as this will make entity creation much better. In my current system for ECS there isn't any way of getting a Data Component for an Entity without doing a dynamic cast based on some sort of ID which could potentially go wrong. So I started looking at different solutions for ECS since my first initial implementation. I came across this post: ECS, Component, Entities and Systems, which suggests the use of the Curiously Recurring Template Pattern(CRTP) for the ECS.
First Attempt
Second Attempt
the updates will also be Component Priority dependant rather than Entity Creation dependant. This approach will also give me better opportunity to perform multi-threading when the time comes, each pool could use worker threads to update chunks of the Components.
One thing I am likely to change is the wording I previously used, in most descriptions of an ECS the words System and Component are used where as mine uses Component and Data Component which really confuses things as:
Component = Data Component
System = Component
For the sake of anyone wanting to use the Engine and reading up on Component Systems it seems more appropriate to use the most common terminology.
Okay so finally a demo of what access to the new Components will look like:
auto posComponent = entity->GetComponent<PositionComponent>();
also as I have used Variadic templates so the adding of Components to entities is clean and simple:
entity->AddComponent<PositionComponent>( x, y, z );
Okay so there is still a lot of work to be done but I'm hoping to get this all nailed pretty soon so I can really start using the ECS.
Cheers :)