Hello!
so i recently received an interview task that was a review or a decoupled message system, correct me if im wrong, but i think thats what appears on the bottom right of the screen in BG3?
“player took X amount of damage”
“player failed a survival check”
i really liked how neat the idea was and began implementing a version of it for a project of mine, but now i think im over-engineering it.
My idea was to have a message queue with envelopes that have a sender, a recipient, and then the message value (with templates and polymorphism we can create for example DamageMessage, HealMessage and add the amount of points to be reduced or added) that way the NPC and the player codes don’t have to directly interact, neat!
i began thinking i could implement a SpeechMessage and have the text that an NPC spits out also enter the queue and it could be delivered to the dialog system and directly appear on the screen without the NPC directly communicating with the dialog system.
or even for changing the camera focus, NPC sends message to camera to change the focus and set it onto them.
the options seem endless but i feel like in the process of simlifying communication between systems i made the message system complex.
so i pass the question onto you, when do you think its best to use a message queue, what are the downsides, any links or documentation would be great too!