Entity communication: Message queue vs Publish/Subscribe vs Signal/Slots
Posted
by
deft_code
on Game Development
See other posts from Game Development
or by deft_code
Published on 2010-07-22T07:01:07Z
Indexed on
2011/01/17
19:59 UTC
Read the original article
Hit count: 217
How do game engine entities communicate?
Two use cases:
- How would
entity_A
send atake-damage
message toentity_B
? - How would
entity_A
queryentity_B
's HP?
Here's what I've encountered so far:
- Message queue
entity_A
creates atake-damage
message and posts it toentity_B
's message queue.entity_A
creates aquery-hp
message and posts it toentity_B
.entity_B
in return creates anresponse-hp
message and posts it toentity_A
.
- Publish/Subscribe
entity_B
subscribes totake-damage
messages (possibly with some preemptive filtering so only relevant message are delivered).entity_A
producestake-damage
message that referencesentity_B
.entity_A
subscribes toupdate-hp
messages (possibly filtered). Every frameentity_B
broadcastsupdate-hp
messages.
- Signal/Slots
- ???
entity_A
connects anupdate-hp
slot toentity_B
'supdate-hp
signal.
- 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?
© Game Development or respective owner