This is kind of a broad question, but for my own understanding I decided I would throw it out there.
Can anyone recommend designs, or maybe even generally accepted design patterns for situations where one would want various objects that are aware of each other?
To use a people/community simulation as an analogy, what would be the best pattern to apply when you have X people objects where X can grow/shrink dynamically, and have each person object hold an opinion of or relationship with the other objects?
Thinking outside of the programming syntax, I could just have a X by X grid that represents each person's relationship with each other (likes, dislikes, hasn't met, etc). I thought of basically implementing that in code as a separate object from each person object that was updated every time a new one was created, but it seemed like a completely un-elegant solution. Does anyone have any advice here?
Secondly, if I have collections of people each with "inventories" or items that they are carrying, I thought that I could create each person's inventory as a List member of the class; this linked-list would grow and shrink as the objects that the person has grow and shrink.
The people objects could easily be queried for their objects they are carrying, but I can't figure out an efficient way to make vice-versa possible as well; that is, I want to be able to query an item and find which people have that item.
I did read this Q-A: Game Objects Talking To Each Other ..but I'm not sure if it is completely applicable to my case.
Can anyone offer any advice?
Thanks!
--R