How to model interentity membership in entity-component architecture?
Posted
by
croxis
on Game Development
See other posts from Game Development
or by croxis
Published on 2012-04-11T02:03:42Z
Indexed on
2012/04/11
5:45 UTC
Read the original article
Hit count: 275
component-based
|entity-system
I'm falling in love with simple grace of entity-component design, although I still have issues breaking from MVC and OOP practices. Some of my game entities have membership relationships with each other (ex: a player is a member of a city, a city is a member of a nation), and I am unsure on the best way to implement it.
My initial reaction is to have a a MemberOfCity component that points to the appropriate city component, but components are suppose to have no references to each other. My other option is to have a System do it, but that would require the system to persist data outside of a component.
Is there a clean way to do this in an entity-component design, or am I trying to use a hammer on a screw and should use a hybrid/another approach?
© Game Development or respective owner