Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualcrancran

Posted 30 November 2012 - 08:42 PM

Generally the good implementations I've seen follow that basic pattern: there's a "game layer" and a "network layer" and they communicate via some form of message queueing. The details are going to vary by engine and other design considerations, but it sounds like you're on the right track.


A centralized queue would work when you're speaking about specific events like GameObjectUpdateEvent or ChatMessageEvent for example. Since I am only ever connected to a single world simulation server or chat server that is responsible for sending data to my client this makes sense.

But how would you handle network-specific event notifications such as connected, timeout, disconnected, etc? Using the event dispatch queue would be nice to keep things nicely decoupled but I also think it really breaks down when you are dealing with multiple connections unless the events have some identifier that specify which endpoint the network event is related to.

Another option would be to use some simple INetworkEventSink interface that could be registered for each object interested in network-specific events. But this would mean that some game layer objects would need access to network layer objects to register such a notification sink.

That is where I am having a hard time trying to connect the dots between the two layers.

#1crancran

Posted 30 November 2012 - 06:12 PM

Generally the good implementations I've seen follow that basic pattern: there's a "game layer" and a "network layer" and they communicate via some form of message queueing. The details are going to vary by engine and other design considerations, but it sounds like you're on the right track.


How would a message queue work with needing to send messages to multiple remote endpoints? Short of making each endpoint's events have unique types/names which is of course obvious, is there a bit cleaner generalized approach?

PARTNERS