How do game engine entities communicate?
Two useI have two user cases:
- How would
entity_Asend atake-damagemessage toentity_B? - How would
entity_Aqueryentity_B's HP?
Here's what I've encountered so far:
entity_Acreates atake-damagemessage and posts it toentity_B's message queue.entity_Acreates aquery-hpmessage and posts it toentity_B.entity_Bin return creates anresponse-hpmessage and posts it toentity_A.
- Publish/Subscribe
entity_Bsubscribes totake-damagemessages (possibly with some preemptive filtering so only relevant message are delivered).entity_Aproducestake-damagemessage that referencesentity_B.entity_Asubscribes toupdate-hpmessages (possibly filtered). Every frameentity_Bbroadcastsupdate-hpmessages.
- Signal/Slots
- ???
entity_Aconnects anupdate-hpslot toentity_B'supdate-hpsignal.
- Something better?
Is there something better? Do I have a correct understanding of how these communication schemes would tie into a game engine's entity system?
How do entities in commercial game engines communicate?