VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Loading a Scenario

When you call loadScenario(), your remote controller application does the following:

  1. If the object map file associated with the scenario indicates that the scenario uses multiple simulation engines, it takes the order of battle and plan files specified by the scenario file, and breaks them up into smaller files, each containing the object or plan information necessary for a particular simulation engine.
  2. It sends those files to the appropriate simulation engines, through dedicated TCP sockets.
  3. The loadScenario() function sends a message to all back-ends, indicating that they should load the scenario that they have just received. So when loadScenario() returns, all necessary data has been sent to the remote VR-Forces applications, but they may still be in the process of loading those files and initializing. Therefore, you usually do not want to immediately start issuing other commands through the remote controller.

The figure illustrates the load scenario process for multiple back-ends and shows that back-ends may load scenario files at different rates.

loadscenariotimelinetwobackends.png
Load Scenario Timeline: Two Back-ends

To find out when the various back-ends have completed loading the scenario and initializing, you can register for callbacks through the DtVrfRemoteController. You can use add/removeBackendLoadedCallback() to register or unregister callbacks that you would like to have executed each time a remote VR-Forces application has indicated that it has finished loading the scenario. Or, you can use add/removeScenarioLoadedCallback() for callbacks that you want to have called only when the scenario has been completely loaded by all participating back-ends.

Note
These callbacks are used by the front-end that loads a scenario. Other front-ends can find out if a back-end has loaded a scenario with the DtBackend::isLoaded() member function.

The loadScenario() member function takes two optional arguments that indicate what you want to happen if all back-ends called for by the Object Map File are not available. The DtVrfController knows (through its DtVrfBackendListener) the simulation addresses of all VR-Forces applications that are currently running. By default, partial loads are allowed, meaning that loadScenario() will ignore missing back-ends, and just ask those applications that are available to load their portions of the scenario. If a value of false is passed as the allowPartial argument, then loadScenario() will fail (returning false without asking any back-ends to load anything) unless all expected simulation engines are present. If partial loads are allowed, and if a non-NULL DtList pointer is passed as the missingBackends argument, the DtList will be filled with pointers to the DtSimulationAddresses of the missing applications.


Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)