Making more complicated systems(entity-component-system model question)
Posted
by
winch
on Game Development
See other posts from Game Development
or by winch
Published on 2013-10-26T16:23:31Z
Indexed on
2013/10/26
22:17 UTC
Read the original article
Hit count: 294
component-based
|entity
I'm using a model where entities are collections of components and components are just data. All the logic goes into systems which operate on components. Making basic systems(for Rendering and handling collision) was easy. But how do I do more compilcated systems? For example, in a CollisionSystem I can check if entity A collides with entity B. I have this code in CollisionSystem for checking if B damages A:
if(collides(a, b)) {
HealthComponent* hc = a->get<HealthComponent();
hc.reduceHealth(b->get<DamageComponent>()->getDamage());
But I feel that this code shouldn't belong to Collision system. Where should code like this be and which additional systems should I create to make this code generic?
© Game Development or respective owner