Two post in one day.
I worked a lot about the messaging system of myUniverse.
What is a messaging system?
It is a piece of software(s) involved in communications between elements.
John Wetherill from Sun Developer Network defines it like that :
In its essence, a messaging system allows separate, uncoupled applications to reliably communicate asynchronously. The messaging system architecture generally replaces the client/server model with a peer-to-peer relationship between individual components, where each peer can send and receive messages to and from other peers.
Messaging systems provide a host of powerful advantages over other, more conventional distributed computing models. Primarily, they encourage “loose coupling” between message consumers and message producers. There is a high degree of anonymity between producer and consumer: to the message consumer, it doesn’t matter who produced the message, where the producer lives on the network, or when the message was produced.
This permits dynamic, reliable, and flexible systems to be built, whereby entire ensembles of sub-applications can be modified without affecting the rest of the system.
Other advantages of messaging systems include high scalability (commercial implementations boast the ability to support tens of thousands of clients and tens of thousands of operations per second), easy integration into heterogeneous networks, and reliability due to lack of a single point of failure.
It is a nice definition.
Why myUniverse requires that ?
From medium to big size projects, we often need to propagate informations from objects to other objects.
At this current point, but it wouldn’t change too much especially for this part, I’m using a central core we could call the brain.
That brain is responsible in creating/removing objects, altering them, moving them (not exactly, because some distributed intelligence occurs too), track them etc.
How could I do without a little standard/protocol for this particular purpose ?
It would be very complex, no, impossible is much more right.
What type of messages ?
I won’t describe the whole system, but I have to say I wanted & ant to keep it as simple as possible!
A nice example is the masterclock.
myUniverse will have one masterclock, related to a defined tempo, which will send the current measure position to any objects containing a self-contained sequencer.
Those messages will inform all workers of the current global & universal time of the system. This will be the Great Clock of that 3D-universe.
That way, all objects will know the global sequencer position and will be able to trigger a note if there is a not in the current time position.
Here is how could be done the master clock.
Those a very bit used to use Max6 won’t be schocked or frightened, it is very simple. (at least that part is, which isn’t the case of the whole mode, dudes)
Basically, the system works like that.
The challenge is to use global hubs/dispatchers in each objects with both:
– local specific busses,
– global busses
In the first case, it can be illustrated by a point to point communication : the core inform this particular object.
In the second one, it looks like a broadcast communication : the core informs all objects which have that connection to the broadcast channel.
I’ll take care of handling wisely the broadcast, because of time critical stuff, but especially because some objects will have te ability to switch on & off their responsiveness to some broadcast message.
So it means at some point, they could receive the masterclock information even if a couple have their sequencers inactivated.
Subscriptions/unsubscription could be required here. I’ll see that later