Tag Info

New answers tagged

2

Templates could work: template <typename ComponentType> static Component * CreateComponent () { return new ComponentType(); } However, that means all components must be created based on compile time data. Honestly, at that point you may as well just do myGameObject->AddComponent(new MeshComponent()); instead of bothering with a factory, ...


0

One of the main goals of ECS is to have classes as decoupled as possible, mainly components and systems. In this sense, I wouldn't make a component subscribe itself to the systems it needs to, because then suddendly you will find that you have components hooked up to Systems, and if you remove a system, you have to alter the respective components. Take as ...


0

Assuming that there are only going to be a small number of FSM classes (one for movement, one for AI, etc.) then I would make each state a component (or part of a component). For example, if an entity has Walking, Climbing, Melee and Ranged components, in these components will be encoded the Walking, Climbing, Patrolling, and Attacking states of two ...



Top 50 recent answers are included