Entity Class Naming Change
Further on from this I've gone on to attempt to conquer the Entity Parsing for the new ECS
Entity Parsing from XML
Here is the basic process I have implemented for creating entities.
- When I get an <Entity> start tag I create a new entity.
- When I hit a new component within this <Entity> tag I then use the component store which creates that component by it's name and adds it to the passed in Entity.
- The component store also returns a "BaseComponent" which I then use the overridden "Load" function to pass in all the values from the attributes list. Which sets the component up exactly as it was stored in the xml.
I was going to try and have the Load function deal with the xml but instead I thought it would just be easier to just use a stringstream and this could then just use the ">>" and "<<" operators for both the Load and Save Functions.
I will have to be careful that the Load and Save functions always remain in sync otherwise there could be a lot of data corruption going on.
I really like this approach as it means that the class deals with it's own initialisation and nothing else needs to know about it.
So what's next?
Once I have done this I will then think about exactly what components I need to implement, and also to implement all this "Component Store" and Entity Parsing functionality for my ECS Systems.