Role of an entity state in a component based system?

Posted by Paul on Game Development See other posts from Game Development or by Paul
Published on 2011-06-15T18:50:34Z Indexed on 2011/06/22 16:31 UTC
Read the original article Hit count: 274

Component-based entity systems are all the rage these days; everyone seems to agree they are the way to go, but no one really has a definitive implementation of such a system. I was wondering, what role do entity states (walking-left, standing, jumping, etc) have in a CBS? Do they act like controllers (i.e. they handle events and change the entity's attributes based on those events)?

What about cases where a state would, for example, require that the entity enters no-clip mode? Should, that state, when it enters, maybe set the CollisionComponent of the entity to a null pointer or something? (Then, on exit, the state should restore the entity's CollisionComponent to its previous state.)

Also, I guess it's the current state's job to change the entity's state to something else, right?

© Game Development or respective owner

Related posts about architecture

Related posts about component-based