Emesary: Difference between revisions

Jump to navigation Jump to search
3,078 bytes added ,  18 June 2017
Line 17: Line 17:


At the highest level Emesary is a way of communicating information between objects that are otherwise unrelated and possibly separated by a physical (machine, network, process) boundary. http://chateau-logic.com/content/emesary-nasal-implementation-flightgear Two (or more) systems can be connected together by using a bridge; the bridge that Richard implemented uses the generic string properties to transmit the messages transparently (to both the sender and recipient). http://chateau-logic.com/content/emesary-multiplayer-bridge-flightgear (documentation is possibly slightly out of date for the most recent developments that are in my fgdata) Richard Harrison has got the transmission of properties working ; using a new notification type.<ref>{{cite web
At the highest level Emesary is a way of communicating information between objects that are otherwise unrelated and possibly separated by a physical (machine, network, process) boundary. http://chateau-logic.com/content/emesary-nasal-implementation-flightgear Two (or more) systems can be connected together by using a bridge; the bridge that Richard implemented uses the generic string properties to transmit the messages transparently (to both the sender and recipient). http://chateau-logic.com/content/emesary-multiplayer-bridge-flightgear (documentation is possibly slightly out of date for the most recent developments that are in my fgdata) Richard Harrison has got the transmission of properties working ; using a new notification type.<ref>{{cite web
  |url    =  https://sourceforge.net/p/flightgear/mailman/message/35894463/
  |title  =  <nowiki> [Flightgear-devel] Emesary / Multiplayer improvements </nowiki>
  |author =  <nowiki> Richard Harrison </nowiki>
  |date  =  Jun 14th, 2017
  |added  =  Jun 14th, 2017
  |script_version = 0.40
  }}</ref>
<syntaxhighlight lang="nasal">
  var PropertySyncNotification =
  {
    new: func(_ident="none", _name="", _kind=0, _secondary_kind=0)
    {
        var new_class = PropertySyncNotificationBase.new(_ident, _name,
_kind, _secondary_kind);
        new_class.addIntProperty("consumables/fuel/total-fuel-lbs", 1);
        new_class.addIntProperty("controls/fuel/dump-valve", 1);
new_class.addIntProperty("engines/engine[0]/augmentation-burner", 1);
        new_class.addIntProperty("engines/engine[0]/n1", 1);
        new_class.addIntProperty("engines/engine[0]/n2", 1);
        new_class.addNormProperty("surface-positions/wing-pos-norm", 2);
#... etc ...
        return new_class;
    }
};
#
# this section sets up the notifications that will be routed and the
transmitters that are used
# I've separated out the transmitter that will be used to send the
properties to enable better control.
var routedNotifications =
[notifications.PropertySyncNotification.new(nil),
notifications.GeoEventNotification.new(nil)];
var bridgedTransmitter = emesary.Transmitter.new("outgoingBridge");
var outgoingBridge =
emesary_mp_bridge.OutgoingMPBridge.new("F-14mp",routedNotifications, 19,
"", bridgedTransmitter);
var incomingBridge =
emesary_mp_bridge.IncomingMPBridge.startMPBridge(routedNotifications);
var f14_aircraft_notification =
notifications.PropertySyncNotification.new("F-14"~getprop("/sim/multiplay/callsign"));</syntaxhighligt>
That's all that is required to ship properties between multiplayer modules via emesary. There is a limit of 128 bytes on a string which limits the amount of outgoing messages. Outgoing notifications are queued and transmitted as space permits. The way the bridge works is to publish the notification, encoded into an MP string, for a period of time to allow for lagging clients and network issues. If a notification IsDistinct then the bridge will transfer just the last message received; otherwise the bridge will transfer all received notifications over MP, to allow for In this sense IsDistinct indicates that the contents of the notification are accurate and definitive (e.g. surface position), so the last value is the most accurate. Other notification (e.g. button 12 pushed will always need to be transferred). Obviously using this technique a variable number of properties can be transmitted, and importantly it's up to the modeller to decide what to transmit. There is a flag that I've temporarily added (sim/multiplay/transmit-only-generics) that doesn't transmit the standard properties, just chat and the generics (to make more space in the packet). There can be different types of notifications sent at a different schedule (so you could have a 10 second update of very slow moving items).<ref>{{cite web
   |url    =  https://sourceforge.net/p/flightgear/mailman/message/35894463/  
   |url    =  https://sourceforge.net/p/flightgear/mailman/message/35894463/  
   |title  =  <nowiki> [Flightgear-devel] Emesary / Multiplayer improvements </nowiki>  
   |title  =  <nowiki> [Flightgear-devel] Emesary / Multiplayer improvements </nowiki>  

Navigation menu