Library globals

Class globals . notifications . PropertySyncNotificationBase

View source

PropertySyncNotificationBase is a wrapper class for allow properties to be synchronized between
modules. This can replace (or augment) the properties that are normally transmitted by multiplayer
It is reasonably efficient with the MP2017.2

Usage example - this can all go into one Nasal module somewhere.
-----------
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);
return new_class;
}
};

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"));
-----------

That's all that is required to ship properties between multiplayer modules via emesary.
property /sim/multiplay/transmit-filter-property-base can be set to 1 to turn off all of the standard properties and only send generics.
this will give a packet size of 280 bytes; leaving lots of space for notifications.
The F-14 packet size is around 53 bytes on 2017.2 compared to over 1100 bytes with the traditional method.
property /sim/multiplay/transmit-filter-property-base can be set to a number greater than 1 (e.g. 12000) to only transmit properties
where the ID is greater than the value in the property. This can further reduce packet size by only transmitting the emesary bridge data

The other advantage with this method of transferring data is that the model is in full control of what is
sent, and also when it is sent. This works on a per notification basis so less important properties could be
transmitted on a less frequent schedule; however this will require an instance of the notification for each one.

PropertySyncNotificationBase is a shortcut notification; as it doesn't need to received and all
of the properties are simply set when the notification is unpacked over MP.
So although the notification will be transmitted

Functions

new