Emesary: Difference between revisions

Jump to navigation Jump to search
→‎Status: more broken code lines
(→‎Multiplayer bridge: more broken code lines)
(→‎Status: more broken code lines)
Line 53: Line 53:
     new: func(_ident="none", _name="", _kind=0, _secondary_kind=0)
     new: func(_ident="none", _name="", _kind=0, _secondary_kind=0)
     {
     {
         var new_class = PropertySyncNotificationBase.new(_ident, _name,  
         var new_class = PropertySyncNotificationBase.new(_ident, _name, _kind, _secondary_kind);
_kind, _secondary_kind);


         new_class.addIntProperty("consumables/fuel/total-fuel-lbs", 1);
         new_class.addIntProperty("consumables/fuel/total-fuel-lbs", 1);
         new_class.addIntProperty("controls/fuel/dump-valve", 1);
         new_class.addIntProperty("controls/fuel/dump-valve", 1);
new_class.addIntProperty("engines/engine[0]/augmentation-burner", 1);
        new_class.addIntProperty("engines/engine[0]/augmentation-burner", 1);
         new_class.addIntProperty("engines/engine[0]/n1", 1);
         new_class.addIntProperty("engines/engine[0]/n1", 1);
         new_class.addIntProperty("engines/engine[0]/n2", 1);
         new_class.addIntProperty("engines/engine[0]/n2", 1);
Line 72: Line 71:
# I've separated out the transmitter that will be used to send the  
# I've separated out the transmitter that will be used to send the  
properties to enable better control.
properties to enable better control.
var routedNotifications =  
var routedNotifications = [notifications.PropertySyncNotification.new(nil), notifications.GeoEventNotification.new(nil)];
[notifications.PropertySyncNotification.new(nil),  
notifications.GeoEventNotification.new(nil)];
var bridgedTransmitter = emesary.Transmitter.new("outgoingBridge");
var bridgedTransmitter = emesary.Transmitter.new("outgoingBridge");
var outgoingBridge =  
var outgoingBridge = emesary_mp_bridge.OutgoingMPBridge.new("F-14mp",routedNotifications, 19, "", bridgedTransmitter);
emesary_mp_bridge.OutgoingMPBridge.new("F-14mp",routedNotifications, 19,  
var incomingBridge = emesary_mp_bridge.IncomingMPBridge.startMPBridge(routedNotifications);
"", bridgedTransmitter);
var f14_aircraft_notification = notifications.PropertySyncNotification.new("F-14"~getprop("/sim/multiplay/callsign"));
var incomingBridge =  
</syntaxhighlight>
emesary_mp_bridge.IncomingMPBridge.startMPBridge(routedNotifications);
var f14_aircraft_notification =  
notifications.PropertySyncNotification.new("F-14"~getprop("/sim/multiplay/callsign"));</syntaxhighlight>


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. 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
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. 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
185

edits

Navigation menu