Elysian Shadows
All posts with the tag: homebrew

Dynamic Component Registration

Originally posted in our Private Development Forums on 5.10.10.

So I have found the absolute [i]best[/i] way to solve the whole "run-time Component allocation" fiasco. I'm very pleased with myself. :D

[b]Problem[/b]:

Let me give you a description of our problem. Have a look here:

The cause of frustration may not be immediately apparent. When the entity is constructing itself, it must construct each of its own components. So what's wrong with that?

The Entity has no way of knowing every component type. The solution for the time being was to hard-code cases into the ugly switch statement so that we can manually initialize individual components at load-time. 

This solution is pretty undesirable, as this means that every time we create a new component, we must also add its case to the Entity's component construction list. Fuckin' gross.

Read More