Idea for messaging (handle message)

I posted on another thread: How to put the game on pause? regarding some confusion about pausing the game. This made me realize one design concern for the engine is that messages by default are silently ignored if there’s no handling logic for the object. It would make a lot of sense to me if the message function had to call some function to indicate that the message was handled by the object. Then, an error could be displayed if a message is sent to the wrong object as the default case. I’ve run into this issue quite a lot while developing my game, but wonder what others think about this kind of change.

A change that could dramatically impact live projects probably won’t ever happen. But being able to modify the standard behavior of all script functions in a project at once could be useful. Something I want that is kind of related to that topic is to be able to define script behavior that is guaranteed to happen first and something guaranteed to happen last during the life cycle.

Have you tried using a publish / subscribe model for messaging before?

https://github.com/britzl/ludobits/blob/master/ludobits/m/broadcast.lua is what I use.

5 Likes

I would like to add here another great module for handling messaging without maintaining URLs: Dispatcher by @dapetcu21 Critique Gaming:

6 Likes