-6
\$\begingroup\$

In component-based entity system, should game objects be reference counted? What about components? Tell me please your pro and contra.

\$\endgroup\$
  • \$\begingroup\$ There should at least be a manager which creates and removes entities and its components. In the framework I've been working on Entity objects are never destroyed. However they are pooled for reuse. Their components on the other hand are destroyed. Also in my case an Entity is pretty much an "id" that holds everything together. The id is also the index at which the entity resides in my manager. \$\endgroup\$ – Sidar Aug 17 '12 at 13:20
  • \$\begingroup\$ This is asking for a discussion. See the FAQ about what types of questions to ask here. \$\endgroup\$ – MichaelHouse Aug 17 '12 at 14:07
  • \$\begingroup\$ Well if component will hold data specific for a gameobject you want have more then one reference to it. But you could use pooling. \$\endgroup\$ – Kikaimaru Aug 17 '12 at 15:05
  • \$\begingroup\$ "Premature optimization is the root of all evil." If you manage your entities through a factory/manager, adding this later should be trivial. Write your game, not middleware! \$\endgroup\$ – 3Dave Aug 17 '12 at 15:50
0
\$\begingroup\$

I have a lot of minuses on this question, but I tried to use reference counting on my entities and components, and now I like this approach very very much. So if someone is interested, I stopped on using reference counting on these objects. I used this approach a bit and see now a lot of benefits and hope in future there won't be problems.

| improve this answer | |
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.