Emesary: Difference between revisions

Jump to navigation Jump to search
740 bytes removed ,  18 April 2020
minor word fixes; remove repeated links and stanzas; paragraph adjustments; proper capitalization of Emesary
(+lead section: Moving up the intro section and removing the heading, bolding the page title and rearranging the paragraphs. Also moving up another paragraph. I should not have to skim through half the article to figure out what it is about.)
(minor word fixes; remove repeated links and stanzas; paragraph adjustments; proper capitalization of Emesary)
Line 4: Line 4:
{{Nasal Navigation}}
{{Nasal Navigation}}


'''Emesary''' is a simple and efficient class based interobject communication system to allow decoupled disparate parts of a system to function together without knowing about each. It allows decoupling and removal of dependencies by using notifications to cause actions or to query values.  
Richard Harrison has finished porting his Emesary system to [[Nasal]] and it's now part of the base package. '''Emesary''' is a simple and efficient class-based inter-object communication system to allow decoupled disparate parts of a system to function together without knowing about each. It allows decoupling and removal of dependencies by using notifications to cause actions or to query values.


There are many possible applications for Emesary within the system. It solves the problem of how to connect generic instruments to aircraft that have different implementations and properties that need to be used. Richard has been looking at how to abstract out the interface to the MFD and [[NavDisplay]].  
There are many possible applications for Emesary within the system. It solves the problem of how to connect generic instruments to aircraft that have different implementations and properties that need to be used. Richard has been looking at how to abstract out the interface to the MFD and [[NavDisplay]].  


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.
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). (documentation is possibly slightly out of date for the most recent developments that are in Richard's fgdata)
Richard has gotten the transmission of properties working using a new notification type.<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>  
Line 16: Line 18:
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>
Richard has finished porting his Emesary system to [[Nasal]] and it's now part of the base package.


There is a set of notes at [http://chateau-logic.com/content/emesary-nasal-implementation-flightgear] that explains the whole thing with a worked example (ACLS).  
There is a set of notes at [http://chateau-logic.com/content/emesary-nasal-implementation-flightgear] that explains the whole thing with a worked example (ACLS).  
Line 24: Line 23:
This is in Richard's git repository in his commit, together with the changes to the AI carriers to add ACLS (carrier ILS): https://sourceforge.net/u/r-harrison/fgdata/ci/54165c213f03638a4cb02c848c4f2b234c537f66/  
This is in Richard's git repository in his commit, together with the changes to the AI carriers to add ACLS (carrier ILS): https://sourceforge.net/u/r-harrison/fgdata/ci/54165c213f03638a4cb02c848c4f2b234c537f66/  


Richard has plans to extend this to be able to transmit over {{Abbr|mp|Multiplayer}} (probably layered ontop of mp-broadcast). It would also probably work quite well with the [[High-Level_Architecture#Federate_Object_Model|HLA FOM]] to give us a way for models to communicate with other models.<ref> {{cite web
Richard has plans to extend this to be able to transmit over {{Abbr|mp|Multiplayer}} (probably layered on top of mp-broadcast). It would also probably work quite well with the [[High-Level_Architecture#Federate_Object_Model|HLA FOM]] to give us a way for models to communicate with other models.<ref> {{cite web
   | url    = http://sourceforge.net/p/flightgear/mailman/message/34985731/
   | url    = http://sourceforge.net/p/flightgear/mailman/message/34985731/
   | title  = <nowiki>[Flightgear-devel] Message passing interface for Nasal</nowiki>
   | title  = <nowiki>[Flightgear-devel] Message passing interface for Nasal</nowiki>
Line 85: Line 84:
notifications.PropertySyncNotification.new("F-14"~getprop("/sim/multiplay/callsign"));</syntaxhighlight>
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, 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
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
   |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>  
Line 95: Line 94:


== Work in progress ==
== Work in progress ==
What Richard Harrison is working on now is how to make (possibly multiple) slaves communicate back to a master craft, initially the F-14 backseat. The design goal is that the same code should work for both the master and the slave, and that there should not need to be any extra logic. At the highest level this would be (master craft): 1. Inside the model bindings a notification is raised, or a property changed that will cause a notification to be raised. 2. The model receives the notification and the appropriate property is changed. 3. The property changed will be sent over Emesary to all slaves. Slaves will not transmit this data back to the master as there is no outgoing bridge configured to do this. For the slave aircraft 1. Inside the model bindings a notification is raised, or a property changed that will cause a notification to be raised. 2. The notification is bridged over MP and received by the master craft.<ref>{{cite web
What Richard is working on now is how to make (possibly multiple) slaves communicate back to a master craft, initially the F-14 backseat. The design goal is that the same code should work for both the master and the slave, and that there should not need to be any extra logic. At the highest level this would be (master craft): 1. Inside the model bindings a notification is raised, or a property changed that will cause a notification to be raised. 2. The model receives the notification and the appropriate property is changed. 3. The property changed will be sent over Emesary to all slaves. Slaves will not transmit this data back to the master as there is no outgoing bridge configured to do this. For the slave aircraft 1. Inside the model bindings a notification is raised, or a property changed that will cause a notification to be raised. 2. The notification is bridged over MP and received by the master craft.<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>  
Line 104: Line 103:
   }}</ref>
   }}</ref>


ALS landing lights visible on the runway from outside views are with FG since 2016.3 or so - same with the technology of lights external to the aircraft specified via relative geometry (used e.g. to illuminate the Shuttle from the ground floodlights during night landings or SRB separation at night). The latter can also  be used for scenery to player or  MP to MP illumination, and Richard is toying with the idea of using the emesary MP bridge for the job.<ref>{{cite web
ALS landing lights visible on the runway from outside views are with FG since 2016.3 or so - same with the technology of lights external to the aircraft specified via relative geometry (used e.g. to illuminate the Shuttle from the ground floodlights during night landings or SRB separation at night). The latter can also  be used for scenery to player or  MP to MP illumination, and Richard is toying with the idea of using the Emesary MP bridge for the job.<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=306389#p306389  
   |url    =  https://forum.flightgear.org/viewtopic.php?p=306389#p306389  
   |title  =  <nowiki> Re: The BK117-B2 </nowiki>  
   |title  =  <nowiki> Re: The BK117-B2 </nowiki>  
Line 112: Line 111:
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>
any lighting ''always'' requires some form communication between light source and effect assigned to the surface. In Rembrandt, lots of performance is burned to set this up fairly generally via additional passes and buffers. The ALS technique requires you to set this up specifically - so there has to be an information exchange between light and effect - which is what the light manager does for the Shuttle, and which is what emesary can do more generally between scenery object Nasal snippets and an aircraft.<ref>{{cite web
Any lighting ''always'' requires some form communication between light source and effect assigned to the surface. In Rembrandt, lots of performance is burned to set this up fairly generally via additional passes and buffers. The ALS technique requires you to set this up specifically - so there has to be an information exchange between light and effect - which is what the light manager does for the Shuttle, and which is what Emesary can do more generally between scenery object Nasal snippets and an aircraft.<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=306418#p306418  
   |url    =  https://forum.flightgear.org/viewtopic.php?p=306418#p306418  
   |title  =  <nowiki> Re: The BK117-B2 </nowiki>  
   |title  =  <nowiki> Re: The BK117-B2 </nowiki>  
Line 132: Line 131:


Most of the work that Richard did to the MP protocol - extending the number of properties available and improving the efficiency of transfer came out of the need for the OPRF aircraft to transmit more properties - but is something that has much wider applications. Equally Emesary developments are coming along nicely - we should soon (next few months) see Emesary used on the OPRF fleet to allow models to communicate with each other in a more structured way to provide chaff, flares, radar, missiles, bombs, link16, damage etc.
Most of the work that Richard did to the MP protocol - extending the number of properties available and improving the efficiency of transfer came out of the need for the OPRF aircraft to transmit more properties - but is something that has much wider applications. Equally Emesary developments are coming along nicely - we should soon (next few months) see Emesary used on the OPRF fleet to allow models to communicate with each other in a more structured way to provide chaff, flares, radar, missiles, bombs, link16, damage etc.
<ref>{{cite web
<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=318872#p318872  
   |url    =  https://forum.flightgear.org/viewtopic.php?p=318872#p318872  
Line 141: Line 139:
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>


To work over MP properly the model needs to use the existing property transfer over MP (e.g. in sim/multiplay/generic/).  
To work over MP properly the model needs to use the existing property transfer over MP (e.g. in sim/multiplay/generic/).  
Line 183: Line 180:
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>


Besides, there's the '''ownship''' assumption hard-coded all over the place - for example, right now subsystems like the replay (flight recorder) system only record and replay your "own" aircraft flight dynamics.  
Besides, there's the '''ownship''' assumption hard-coded all over the place - for example, right now subsystems like the replay (flight recorder) system only record and replay your "own" aircraft flight dynamics.  
Line 207: Line 203:


=== Loading the framework ===
=== Loading the framework ===
It's now part of the base package and available automatically
The Emesary framework is now part of the base package and available automatically. There is nothing special to be done to load it.
<syntaxhighlight lang="nasal">
</syntaxhighlight>


=== Setting up a transmitter ===
=== Setting up a transmitter ===
Line 219: Line 213:


=== Setting up a notification ===
=== Setting up a notification ===
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
var HelloNotification =
var HelloNotification =
Line 255: Line 248:


=== Registering a receiver ===
=== Registering a receiver ===
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
var receiver = HelloRecipient.new("my test receiver");
var receiver = HelloRecipient.new("my test receiver");
Line 267: Line 259:


== Multiplayer bridge ==
== Multiplayer bridge ==
Richard has now got the Emesary multiplayer bridge working ref: http://chateau-logic.com/content/emesary-multiplayer-bridge-flightgear <ref> {{cite web
Richard has the Emesary multiplayer bridge working ref: http://chateau-logic.com/content/emesary-multiplayer-bridge-flightgear <ref> {{cite web
   | url    = http://sourceforge.net/p/flightgear/mailman/message/35040437/
   | url    = http://sourceforge.net/p/flightgear/mailman/message/35040437/
   | title  = <nowiki>Re: [Flightgear-devel] Message passing interface for Nasal</nowiki>
   | title  = <nowiki>Re: [Flightgear-devel] Message passing interface for Nasal</nowiki>
Line 365: Line 357:
{{Main article|Advanced_weather#Connection_with_the_multiplayer_system}}
{{Main article|Advanced_weather#Connection_with_the_multiplayer_system}}


Richard's emesary framework would be ideal for this sort of thing. The changes AW side would be modest - basically a shift to a dedicated random number generator, a routine to build a tile based on incoming information, one to store and encode the meta-data of tiles already created and that'd basically be it.<ref>{{cite web
Richard's Emesary framework would be ideal for this sort of thing. The changes AW side would be modest - basically a shift to a dedicated random number generator, a routine to build a tile based on incoming information, one to store and encode the meta-data of tiles already created and that'd basically be it.<ref>{{cite web
   |url    =  https://sourceforge.net/p/flightgear/mailman/message/35491937/  
   |url    =  https://sourceforge.net/p/flightgear/mailman/message/35491937/  
   |title  =  <nowiki> Re: [Flightgear-devel] Traffic 2020: Towards a new Development
   |title  =  <nowiki> Re: [Flightgear-devel] Traffic 2020: Towards a new Development
Line 410: Line 402:
   |script_version = 0.40  
   |script_version = 0.40  
   }}</ref>
   }}</ref>
almost every system should be able to run completely independently of the frame rate. What of course would be mandatory is to sync properties at well defined time stamps, this is what the RTI takes care of. <ref>{{cite web
  |url    =  https://sourceforge.net/p/flightgear/mailman/message/34796183/
  |title  =  <nowiki> Re: [Flightgear-devel] Designing a thread-safe property tree API
(was Re: A FGPythonSys implementation: ...) </nowiki>
  |author =  <nowiki> Torsten Dreyer </nowiki>
  |date  =  Jan 26th, 2016
  |added  =  Jan 26th, 2016
  |script_version = 0.40
  }}</ref>


Instead of adding just-another-feature we need to strip it down to getting a fast and constand fps rendering engine. Everything else needs to run outside the main loop and has to interact with the core by, say HLA/RTI or whatever IPC we have.<ref>{{cite web
Instead of adding just-another-feature we need to strip it down to getting a fast and constand fps rendering engine. Everything else needs to run outside the main loop and has to interact with the core by, say HLA/RTI or whatever IPC we have.<ref>{{cite web
185

edits

Navigation menu