![]() |
VR-Forces Developer's Guide
|
The VR-Forces back-end can function as a dynamic terrain server.
It processes events and commands that can cause changes to the terrain, and publishes these changes to the network as persistent objects via a custom DIS PDU or HLA object class. Normally a single back-end will manage and publish all dynamic terrain changes for the entire simulation, but it is possible to configure different back-ends to control the dynamic terrain for different regions of the terrain.
User applications can also process these dynamic terrain changes for their own purposes, or send control messages to the VR-Forces back-end to request changes to the terrain.
There are two ways of receiving dynamic terrain updates from the VR-Forces back-end. The easier method requires the use of the VR-Forces Remote Control toolkit. The toolkit includes a DtReflectedDynamicTerrainList which functions like other VR-Link reflected list classes. It handles subscribing to network updates and decoding data into a local state repository for easier access. For specific details on this class, please consult the VR-Forces Class Documentation as well as the VR-Link documentation for a general understanding of the VR-Link API.
If your application cannot use the VR-Link API, you can write your own code to read and process the VR-Forces custom HLA object class or DIS PDU. Please refer to the MAK One Interoperability Guide for more details on the Dynamic Terrain object model. An understanding of the either the HLA or DIS standard is required to receive and process these updates.
Each published dynamic terrain object includes one or multiple terrain geometries that define the areas of the terrain that are being changed. For each terrain geometry, a list of key/value pairs are specified. These key/value pairs are ASCII strings that define the type of change and the new state. This could, for example, identify a new state for switch nodes in that area of the terrain, or tell VR-Forces how to programmatically change the terrain. The exact values keys and values used will depend on the terrain and how VR-Forces is configured. The most commonly used keys and values are listed in the MAK One Interoperability Guide.
To change the dynamic terrain state, you must communicate the desired change to the VR-Forces back-end which is functioning as the dynamic terrain server. This can be done using a series of sim commands available in the VR-Forces Remote Control toolkit. To send a dynamic terrain change sim command you must create DtIfExecuteSimCommand interface content message and send this via the DtVrfRemoteController. Here is a small code example.
The dynamic terrain will also be affected by any detonations that are published to the network. The back-end will determine if the detonation causes any damage to the terrain and will publish dynamic terrain updates accordingly.
Below is a description of each of the dynamic terrain commands available. For specific details, please consult the VR-Forces Class Documentation.
Commands VR-Forces to add new changes to the dynamic terrain in the specified area. A list of changes, represented as key/value pairs of strings, must be specified, indicating how the terrain is to be changed.
Commands VR-Forces to reset dynamic terrain changes of specific types within the designated area back to their default states. Changes are specified as a list of strings that match the keys to the key/value pairs used in the DtAddDynamicTerrainChangesCommand.
Commands VR-Forces to reset any dynamic terrain changes that are the result of damage due to munition detonations within the designated area. This can also be achieved using the DtResetDynamicTerrainChangesCommand with the proper keys representing terrain damage types, but this command is simpler to use and will automatically adapt if new types of terrain damage are configured.
Commands VR-Forces to switch the state of one or multiple dynamic terrain features along a specified chord. The command may specify a list of dynamic terrain change types that can be switched, or instead a list of dynamic terrain changes types that should not be switched. This can be useful for certain types of changes, for example opening a door immediately in front of an entity.
An application can learn about changes to the default terrain state by listening to the DynamicTerrain HLA object updates or DIS PDUs. Sometimes, however, it might be useful for an application to understand what types of changes are possible in a specified area. For instance, it may be useful to query the VR-Forces back-end to understand if there are any openable doors in a particular area. These kinds of requests can be performed using the interface content message DtIfRequestDynamicTerrainInformation. This is a simple request that will request information about all possible dynamic terrain changes available in a defined area of the terrain. VR-Forces will then respond with a DtIfDynamicTerrainInformationResponse message containing this information. For specific details on these classes, please consult the VR-Forces Class Documentation.