Namespace globals notifications
--------------------------------------------------------------------------- Title : EMESARY flightgear standardised notifications File Type : Implementation File Description : Messages that are applicable across all models and do not specifically relate to a single system : - mostly needed when using the mutiplayer bridge Author : Richard Harrison (richard@zaretto.com) Creation Date : 06 April 2016 Version : 4.8 Copyright � 2016 Richard Harrison Released under GPL V2 ---------------------------------------------------------------------------*/
Classes
AircraftControlNotification
Transmit a generic control event. two parameters - the event Id and the event value which is a 4 byte length (+/- 1,891371.000)
GeoEventNotification
Use to transmit events that happen at a specific place; can be used to make models that are simulated locally (e.g. tankers) appear on other player's MP sessions.
PFDEventNotification
Use to transmit events that happen at a specific place; can be used to make models that are simulated locally (e.g. tankers) appear on other player's MP sessions.
PropertySyncNotificationBase
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
Variables
ArmamentInFlightNotification_Id
Combat notifications; e.g. OPRF Emesary MP communications
PFDEventNotification_Id
event ID 19 reserved for armaments and stores (model defined).
PropertySyncNotificationBase_Id
Ideally for notifications bridged over MP the message ID should be system unique. with that in mind 0-16 are reserved for model use; and may well be marked as not bridgeable however the most important thing is that as these notifications ID's are used the wiki page http://wiki.flightgear.org/Emesary_Notifications