|
VR-Engage
2.2
|
The VR-Engage backend process (vrEngageSim.exe) builds upon VR-Forces, MAK's simulation engine. This architecture provides access to entity modeling, physics simulation, terrain interaction, and network interoperability. This section covers how VR-Engage extends VR-Forces when developing backend components that model vehicle dynamics, weapon systems, sensor behavior, and other simulation logic.
The backend process hosts the authoritative simulation logic that determines entity behavior, physics response, and system state. While the frontend handles user input and visualization, the backend calculates vehicle dynamics, weapon effects, sensor performance, and damage assessment. This separation produces consistent simulation results across distributed exercises and allows the same physics to drive both player-controlled and AI-controlled entities.
This section describes the backend architecture and extension patterns that VR-Engage uses to build on VR-Forces.
This documentation assumes familiarity with VR-Forces toolkit development. Developers should understand VR-Forces entity modeling, the simulation component system, and plugin architecture before extending VR-Engage's backend. The VR-Forces Developer's Guide provides comprehensive coverage of these topics.
VR-Engage backend development requires these VR-Forces concepts:
Entity and Component Model: VR-Forces entities consist of simulation objects with attached components that implement behavior. Components derive from DtSimComponent and participate in the simulation tick cycle. VR-Engage extends this model with player-control-aware components.
System Definitions: VR-Forces uses .sysdef files to configure entity systems including weapons, sensors, and actuators. These Lisp-format files define component types, parameters, and interconnections. VR-Engage adds system definition templates for player-controlled variants.
Joystick Function System: VR-Forces provides a joystick function mechanism for mapping control inputs to entity behaviors. VR-Engage uses this system to route frontend input to backend actuators.
Plugin Architecture: VR-Forces simulation plugins register component factories and extend entity behavior through documented entry points (DtInitializeVrfPlugin, DtPostInitializeVrfPlugin). VR-Engage backend plugins follow the same pattern.
Object State Repository: VR-Forces maintains entity state through the object state repository, which VR-Engage components read and write to synchronize with frontend displays.
VR-Engage extends VR-Forces in several ways to support player-controlled entities. These extension patterns indicate where to find appropriate base classes and integration points.
Player Control Detection: VR-Engage components distinguish between CGF-controlled and player-controlled operation. The DtVreSimComponent template class provides isPlayerControlled() to check control state, allowing components to adjust behavior based on control authority.
Frontend Message Integration: While VR-Forces entities respond to tasks and plans, VR-Engage entities also respond to real-time input from frontend processes. The message routing infrastructure delivers frontend commands to appropriate backend components.
Actuator Coexistence: VR-Engage entities can transition between player and CGF control during runtime. This requires coordinating VR-Engage actuators with VR-Forces CGF actuators to prevent conflicting commands.
Multi-Session Support: VR-Engage supports multiple players controlling different roles on the same entity. The backend routes inputs from multiple frontend sessions to appropriate subsystems based on role authority.
State Synchronization: VR-Engage components publish state changes to connected frontends in addition to the standard DIS/HLA network publication. This dual publication keeps frontend displays synchronized with backend simulation state.
The backend process hosts the authoritative simulation state for player-controlled entities. While the frontend handles visualization and user input, the backend calculates physics, processes damage, evaluates sensor detection, and publishes entity state to the distributed simulation network. This separation maintains simulation fidelity regardless of frontend frame rate fluctuations.
flowchart TB
subgraph Frontend["Frontend Process (vrEngage.exe)"]
Input["Input Manager"]
Visual["Visualization"]
UI["User Interface"]
end
subgraph Backend["Backend Process (vrEngageSim.exe)"]
subgraph VRF["VR-Forces Engine"]
EntityMgr["Entity Manager"]
Physics["Physics Engine"]
Terrain["Terrain System"]
Network["Network Publisher"]
end
subgraph VRE["VR-Engage Extensions"]
VreManager["VrfModelManager"]
Components["VRE Components"]
Actuators["Actuator Components"]
Sensors["Sensor Components"]
end
end
Input -->|Commands| VreManager
VreManager --> Components
Components --> Actuators
Components --> Sensors
Actuators --> Physics
Sensors --> EntityMgr
Physics --> Network
Network -->|State Updates| Visual
The VR-Engage extension layer wraps VR-Forces functionality, providing a simplified interface for common operations while preserving access to the full VR-Forces API when needed. This layered approach addresses typical use cases while supporting customization.
Backend simulation logic operates within the VR-Forces framework, extending entity models with VR-Engage-specific behavior. The simulation architecture layers VR-Engage components on top of VR-Forces entity management, with each layer providing specific capabilities.
flowchart TB
subgraph VREComponents["VR-Engage Components"]
Actuators2["Actuator Components"]
Sensors2["Sensor Components"]
Weapons["Weapon Components"]
Systems["System Components"]
end
subgraph VRFEntity["VR-Forces Entity"]
VrfModel2["DtSimObject"]
StateRepo["State Repository"]
PhysicsModel["Physics Model"]
end
subgraph PhysicsEngines["Physics Engine"]
Vortex["Vortex Dynamics"]
RTDynamics["RTDynamics"]
Custom["Custom Physics"]
end
subgraph TerrainSys["Terrain System"]
TerrainDB["Terrain Database"]
Collision["Collision Detection"]
end
Actuators2 --> VrfModel2
Sensors2 --> VrfModel2
Weapons --> VrfModel2
Systems --> VrfModel2
VrfModel2 --> StateRepo
VrfModel2 --> PhysicsModel
PhysicsModel --> Vortex
PhysicsModel --> RTDynamics
PhysicsModel --> Custom
PhysicsModel --> Collision
Collision --> TerrainDB
Each VR-Engage entity uses standard VR-Forces entity management with VR-Engage simulation components attached via system definition files. Components execute during the simulation tick cycle, processing input commands from the frontend and updating entity state that gets published to the network.
VR-Engage backend functionality is implemented through VR-Forces plugins that register simulation components with the CGF engine. VR-Engage extends VR-Forces through composition rather than a traditional class hierarchy, adding player-control-aware components to standard VR-Forces entities.
The VR-Engage simulation plugin registers components through the standard VR-Forces plugin mechanism. The DtInitializeVrfPlugin entry point registers VR-Engage component factories with the CGF engine:
This plugin architecture allows VR-Engage to add player control capabilities to any VR-Forces entity without modifying VR-Forces core code.
VR-Engage entities use the standard VR-Forces entity model. Player control is added through VR-Engage components attached via system definition files. The DtVreSimComponent template class provides the foundation for all VR-Engage backend components, adding player control detection to standard VR-Forces components.
Player control state is stored in the entity's extended data within the VR-Forces object state repository. Components check for player control by looking for role entries in the extended data map:
This approach integrates with VR-Forces entity management, allowing the same entity to transition between player and CGF control without requiring different entity classes.
Backend components fall into two primary categories: actuators that modify entity state, and sensors that observe the simulation environment. Both types derive from base classes that integrate with the VR-Forces component system.
Actuators in VR-Engage extend VR-Forces actuator components using the DtVreSimComponent template. This template adds player control detection and VR-Engage message handling to standard VR-Forces components.
VR-Engage provides several actuator components that extend VR-Forces base classes:
| VR-Engage Component | Base Class | Purpose |
|---|---|---|
DtVreTurretActuator | DtTurretActuatorComponent | Turret control with player input |
DtVreRotaryWingActuatorComponent | DtRotaryWingActuatorComponent | Helicopter flight control |
DtControlSurfacesActuator | DtActuatorComponent | Fixed-wing control surfaces |
DtVreHumanMovementActuator | DtHumanMovementActuator | Human entity movement |
The following example demonstrates extending a VR-Forces actuator with VR-Engage functionality. This pattern applies to any component that responds to player control.
VR-Engage sensor components also use the DtVreSimComponent template to extend VR-Forces sensor classes. Sensors like DtVreGimbalController extend VR-Forces sensor controllers with player-controlled aiming:
VR-Engage supports multiple physics backends through an abstraction layer.
Vortex Dynamics: CM Labs' Vortex provides detailed ground vehicle dynamics with realistic suspension, tire models, and terrain interaction. Vortex works well where accurate physics response matters for training fidelity.
RTDynamics (RTD): MAK's RTDynamics provides flight dynamics for fixed-wing and rotary-wing aircraft using performance data tables derived from real aircraft specifications. The performance-based approach produces realistic flight behavior without requiring full aerodynamic modeling, making RTD suitable for training simulations where consistent, repeatable behavior is more important than aerodynamic fidelity.
VR-Forces Internal Kinematics Model: The default model provides basic entity movement and collision detection, suitable for entities that do not require detailed dynamics simulation such as dismounted infantry.
Vortex mechanisms are configured through .vxmechanism files created in the Vortex Editor. These binary files define vehicle geometry, mass properties, rigid bodies, constraints, and collision geometry.
VR-Engage actuators interact with Vortex mechanisms through the VR-Forces integration layer. The mechanism file path is specified in the entity's system definition:
RTDynamics integrates with VR-Forces through flight model plugins that read RTD performance data files. These files define aircraft performance envelopes including maximum speeds at various altitudes, climb and descent rates, turn performance, and fuel consumption. VR-Engage actuators send control inputs (throttle, control surfaces, collective pitch) to the RTD model, which calculates the resulting aircraft state.
Because RTD uses performance tables rather than aerodynamic coefficients, new aircraft models can be created from publicly available performance specifications.
VR-Engage entities support transitions between player and CGF control, and can be controlled by multiple players simultaneously. This section covers control authority management, input routing, and joystick controller architecture.
VR-Engage entities can operate under both CGF (Computer Generated Forces) control and player control. This coexistence requires managing actuator authority to prevent conflicting commands.
An entity's control mode determines which system—player or CGF—issues commands affecting entity state. Only the system designated by the current control mode can modify entity position, orientation, weapon state, and other simulation properties. Without this distinction, simultaneous commands from both player input and CGF behavior scripts would conflict, causing erratic entity behavior.
Control mode operates at the entity level between players and CGF, not between individual players. Multiple players can simultaneously control the same entity, each operating different subsystems (driver controlling propulsion while gunner controls turret). The role-based input routing described in Multi-player entity support handles coordination between players on the same entity. Control mode determines whether any player has control versus CGF having control.
When a player engages an entity, the system transitions from CGF mode to player mode. During this transition, the system suspends CGF behavior execution, disables CGF actuators, and activates VR-Engage actuators. The reverse occurs when the last player disengages from the entity.
stateDiagram-v2
[*] --> CGFControl: Entity Created
CGFControl --> TransferringToPlayer: Player Engages
TransferringToPlayer --> PlayerControl: Transfer Complete
PlayerControl --> TransferringToCGF: Last Player Disengages
TransferringToCGF --> CGFControl: Transfer Complete
PlayerControl --> PlayerControl: Player Input
CGFControl --> CGFControl: CGF Tasks/Plans
When a player disengages from an entity, control transfers back to CGF and the entity attempts to resume its previous behavior. The transition preserves entity state, and CGF continues from the entity's current position and orientation.
VR-Engage supports multiple concurrent players operating the same entity, enabling crew simulation where different players control different roles (driver, gunner, commander). The backend coordinates inputs from multiple frontends and resolves conflicts when necessary.
When multiple players control the same entity, the backend must determine which player's inputs affect which subsystems. Role-based input routing solves this by associating each role with specific actuators. The driver role routes inputs to propulsion and steering actuators, while the gunner role routes inputs to turret and weapon actuators. This association is configured in system definition files through joystick function groups.
Each joystick function belongs to a function group (such as "driver" or "gunner"). When the backend receives a joystick message, it checks the function group to determine which actuator should receive the input. If a player sends an input for a function group their role does not control, the input has no effect.
flowchart TB
subgraph Frontend1["Frontend 1 (Driver)"]
Driver["Driver Role"]
end
subgraph Frontend2["Frontend 2 (Gunner)"]
Gunner["Gunner Role"]
end
subgraph Frontend3["Frontend 3 (Commander)"]
Commander["Commander Role"]
end
subgraph Backend["Backend Process"]
InputRouter["Input Router"]
subgraph Actuators["Actuator Components"]
PropAct["Propulsion Actuator"]
SteerAct["Steering Actuator"]
TurretAct["Turret Actuator"]
WeaponAct["Weapon Actuator"]
end
end
Driver -->|Throttle, Steering, Brake| InputRouter
Gunner -->|Turret, Fire| InputRouter
Commander -->|Override, Designate| InputRouter
InputRouter -->|driver group| PropAct
InputRouter -->|driver group| SteerAct
InputRouter -->|gunner group| TurretAct
InputRouter -->|gunner group| WeaponAct
Typical function group assignments:
Function groups are defined in system definition files. The following excerpt shows how a throttle function is assigned to the "driver" group:
Each role's frontend configuration defines which joystick functions that role can send. The driver role maps input devices to throttle and steering functions, while the gunner role maps input devices to turret and fire functions. The function group in the system definition connects these frontend actions to the correct backend actuator.
When multiple players operate the same entity, the backend maintains authoritative state and synchronizes changes to all connected frontends. State updates include timestamps to maintain consistency across sessions.
Joystick controllers route player input to backend actuators through the VR-Forces port system. This section covers the backend components that receive joystick input and deliver it to actuators—the controller classes, port wiring, and system definition configuration. For the JoystickMessage structure and frontend message creation, see Inter-Process Communication.
When the frontend sends a JoystickMessage, the backend receives it through DtVrfRemoteControlConnector. The connector routes the message into the VR-Forces joystick infrastructure, which dispatches it to the appropriate controller component. The controller updates output ports that actuators read during their simulation tick.
sequenceDiagram
participant Remote as DtVrfRemoteControlConnector
participant JoySrc as DtJoystickSource
participant Controller as DtVreJoystickController
participant Ports as Output Ports
participant Actuator as Actuator Component
Remote->>JoySrc: joystickFunction()
JoySrc->>Controller: calcAndSetPortValues()
Controller->>Ports: Set Output Values
Actuator->>Ports: Read Input Values
Actuator->>Actuator: Apply Control
Joystick controllers implement DtJoystickControllerInterface and receive routed input through the calcAndSetPortValues() method. The DtVreJoystickController base class provides infrastructure for VR-Engage-specific controllers:
The controller's calcAndSetPortValues() implementation looks up output ports by function name and sets their values. Actuator components wire their input ports to these outputs through system definition connections.
VR-Engage provides specialized joystick controllers for different entity types and roles:
| Controller | Entity Type | Key Functions |
|---|---|---|
DtVreJoystickController | Generic vehicles | throttle, steering, brake |
DtVreTurretJoystickController | Weapon turrets | azimuth, elevation, aimMode |
DtFixedWingJoyFlightController | Fixed-wing aircraft | pitch, roll, yaw, throttle |
DtRotaryWingJoyFlightController | Rotary-wing aircraft | cyclic, collective, pedals |
DtHumanJoystickMovementController | Dismounted infantry | walk, run, strafe, turn |
DtHumanJoystickCombatController | Dismounted infantry | aim, fire, weaponSelect |
Specialized controllers add role-specific logic. For example, DtVreTurretJoystickController handles turret rate limits and stabilization modes, while flight controllers apply control surface mixing and trim.
Joystick controllers communicate with actuators through the VR-Forces port system. Controllers create output ports for each joystick function; actuators create input ports for control values they consume. System definitions wire these ports together by matching port names.
Output ports (controller side):
joystick-controls configuration in system definitionInput ports (actuator side):
tick() to get current control valuesJoystick controllers and their port connections are configured in system definition (.sysdef) files. The configuration specifies which joystick functions the controller handles:
The joystick-controls block defines output ports that the controller creates. Each control specifies:
| Field | Purpose |
|---|---|
function-name | Name matching the function field in JoystickMessage |
port-type | "analog" for double values, "boolean" for on/off |
default-value | Initial value before any input received |
Actuators read joystick input through their input ports during each simulation tick:
The newData() method returns true when the port has received a new value since the last check, allowing actuators to respond only to actual input changes rather than polling the same value repeatedly.
VR-Engage weapon systems are managed through the backend using VR-Forces weapon components. The weapon architecture coordinates frontend controls with backend ballistics, ammunition tracking, and fire interactions published to the distributed simulation network.
Weapon systems in VR-Engage consist of frontend control logic that handles player input and backend components that manage weapon state, ammunition, and fire interactions.
flowchart TB
subgraph Frontend["Frontend Process"]
GunnerLogic["DtGunnerControlLogic"]
WeaponResource["DtWeaponResourceLogic"]
WeaponPose["DtWeaponPoseUpdater"]
end
subgraph Backend["Backend Process"]
WeaponStatus["DtWeaponsStatusController"]
WeaponController["Weapon Controller Component"]
FireTask["Fire Task"]
end
subgraph Messages["VRE Messages"]
ConfigRequest["WeaponConfigRequest"]
ConfigResponse["WeaponConfigResponse"]
SelectWeapon["WeaponConfigSelectWeapon"]
AmmoUpdate["WeaponAmmoUpdate"]
WeaponGeom["WeaponGeometry"]
end
GunnerLogic -->|Fire Command| WeaponController
GunnerLogic -->|Select Weapon| SelectWeapon
SelectWeapon --> WeaponStatus
WeaponResource -->|Request Config| ConfigRequest
ConfigRequest --> WeaponStatus
WeaponStatus -->|Respond| ConfigResponse
ConfigResponse --> WeaponResource
WeaponStatus -->|Ammo Changes| AmmoUpdate
AmmoUpdate --> WeaponResource
WeaponPose -->|Aim Position| WeaponGeom
WeaponGeom --> WeaponController
WeaponController --> FireTask
The DtWeaponsStatusController component manages weapon configuration and state on the backend.
The frontend queries weapon configuration through the VR-Engage message system. The DtWeaponsStatusController responds to WeaponConfigRequest messages with information about available weapons, ammunition types, and display ordering via WeaponConfigResponse messages.
The weapon configuration workflow:
WeaponConfigRequest with entity IDDtWeaponsStatusController receives request and builds configuration responseWeaponConfigResponse with weapon categories, ranges, and ammunition dataDtWeaponResourceLogic receives response and updates UIMessage definitions are generated from Lua specifications in libsrc/framework/vreMessages/. The WeaponConfigResponse includes fields for weapon name, category, range limits, and munition type.
Weapon systems are defined in .sysdef files that specify components, connections, and joystick control mappings. The system definition determines how player input flows through weapon components.
The DtGunnerControlLogic component on the frontend handles player input for weapon systems. It processes turret slew commands, fire actions, and weapon selection through configurable input mappings.
This section covers entity configuration files that bridge frontend and backend, and the VR-Engage extension libraries available for backend development.
VR-Engage configuration spans both frontend and backend, with .entity files serving as the connection point. Entity files are primarily a backend concept—they define the VR-Forces entity type, physics model, and system definitions that determine which simulation components are attached. However, entity files also reference frontend role configurations, creating the link between backend simulation and frontend player interface.
Within an entity file, role references point to frontend role Lua files that define component groups, input mappings, and display layouts. Parameter overrides in the entity file can customize role behavior for specific entity types without modifying the base role definition. This separation allows the same role (such as "driver") to work across different vehicle types while permitting entity-specific adjustments.
For comprehensive coverage of role configuration including inheritance, parameter overrides, and component groups, see Role Configuration.
System definitions (.sysdef files) configure backend components using Lisp format. These files specify joystick controllers, actuators, and sensors that execute in the backend simulation:
System definitions attach to entities through .entity files and determine which backend components participate in the simulation. The joystick controls defined here correspond to input actions mapped in frontend role configuration.
VR-Engage backend development involves several libraries that extend VR-Forces functionality.
The vreVrfmodel library (libsrc/vrfExtensions/vreVrfmodel/) contains the core VR-Engage entity model extensions. This library provides the primary classes for player-controlled entity behavior.
Key headers:
vreSimComponent.h - Base template for VR-Engage simulation componentsvreJoystickController.h - Joystick input routing to entity systems weaponsStatusController.h - Weapon configuration and ammunition trackingvreTurretActuator.h - Turret control for player-aimed weaponsThe vreManager library (libsrc/vrfExtensions/vreManager/) coordinates VR-Engage entities within the VR-Forces simulation. It manages entity registration, message routing, and lifecycle events.
Key headers:
vrfModelManager.h - Central entity coordinatorvreTableView.h - Entity state table accessThe vreMessageManager library (libsrc/framework/vreMessageManager/) provides the messaging infrastructure for frontend-backend communication. Backend components use this library to receive commands and publish state.
Key headers:
vreMessage.h - Base message classvreMessageManager.h - Message routing and subscriptionBackend plugins link against VR-Engage and VR-Forces libraries. Consult the example plugin projects in the examples/ directory for current CMake configuration patterns.
Key libraries for backend development:
vreVrfmodel - Core VR-Engage simulation componentsvreManager - Entity management and coordinationvreMessageManager - Frontend-backend messagingHeaders are organized under include/vrfExtensions/ with subdirectories matching library names.
VR-Engage backend headers are organized under include/vrfExtensions/:
| Directory | Purpose |
|---|---|
vreVrfmodel/ | Entity model components, actuators, controllers |
vreManager/ | Entity management and coordination |
vreVrfobjcore/ | Object core extensions (projectiles, munitions) |
When developing backend components, include headers using the library directory prefix:
See also