|
VR-Engage
2.3
|
The VR-Engage backend builds on VR-Forces. It owns simulation entities, physics, AI, weapons, sensors, and publication of authoritative entity state. Frontend components own player interaction and visualization; they request simulation changes through connectors and the backend's supported command paths.
Backend development uses the VR-Forces component, descriptor, factory, system-definition, and port APIs. Read the corresponding VR-Forces Developer's Guide before adding simulation components. System definitions configure controllers, sensors, actuators, and their connections. They do not use the frontend role Lua component format.
The VR-Forces loader selects simulation DLLs from DtVrfPluginRecord XML records. The VR-Engage record is appData/plugins/vreVrfSimPlugin.xml, installed into appData/plugins. It selects the protocol-independent simulation plugin for the configured application/platform/build. appsrc/vrEngageSim/vrfApp.cxx reads the records and creates the CGF plugin manager.
The exported DtInitializeVrfPlugin(DtCgf*) wrapper calls makVre::DtVreVrfSimPlugin::DtInitializeVreVrfPlugin(cgf). This function registers simulation components, descriptors, interface contents, Reader/Writer classes, state repositories, and set-data requests. It is not merely a component-factory callback. Post-initialization and unload have their own wrappers; unload accepts DtCgf*.
When overriding an existing VR-Engage component creator, call and check VR-Engage initialization before registering the replacement. Derive the component from its appropriate simulation base, not from a nonexistent plugin class. See Plugin Architecture for signatures, configuration, and the checked objectProxSensor structural reference.
Sources: include/vrfExtensions/vreVrfSimPlugin/vreVrfPlugin.h and libsrc/vrfExtensions/vreVrfSimPlugin/vreVrfPlugin.cxx.
| Class | Responsibility and source |
|---|---|
DtVreVrfApp | Backend application derived from DtVrfApp; configures CGF startup and VR-Engage services. appsrc/vrEngageSim/vreVrfApp.h and .cxx |
DtCgf | VR-Forces simulation engine and factory-manager access; the VR-Engage plugin receives this object |
makVre::DtVreSimComponent<ComponentBase> | Adds role-occupancy queries and entity-system naming to a selected VR-Forces component base. include/vrfExtensions/vreVrfmodel/vreSimComponent.h |
makVre::DtVreJoystickController | Creates output ports from joystick controls and routes function-group/function input to them. vreVrfmodel/vreJoystickController.h and corresponding source |
makVre::DtVreJoystickControllerInterface | Extends the VR-Forces joystick interface with controller-state persistence for ownership handoff. vreVrfmodel/vreJoystickControllerInterface.h and corresponding source |
makVre::DtWeaponsStatusController | Handles weapon configuration requests/selections and publishes ammunition/status updates. vreVrfmodel/weaponsStatusController.h and corresponding source |
makVre::DtVortexMovementActuator | Loads a Vortex mechanism, connects its interfaces, and coordinates physics with entity/role state. vreVrfVortex/vortexMovementActuator.h and corresponding source |
Header prefixes in the table are include paths beneath include/vrfExtensions. vreManager contains the Manager UI, station/assignment models, and status listener. It is not a backend DtVrfModelManager entity coordinator. Likewise, DtOwnshipControlConnector runs in the frontend connector layer; it sends remote-control requests rather than owning backend simulation.
Backend components use VR-Forces inheritance and composition. DtVreSimComponent<ComponentBase> preserves the selected base's constructor and lifecycle while adding isPlayerControlled(role), controllingStations(role), engagedRoles(), and entitySystemName(). The template does not automatically subscribe a component to VR-Engage messages.
The published Roles State Property maps a role type to its occupied station entries. Current entries are structured lists, not vectors of strings. The shared helpers interpret these records. Call isPlayerControlled("Driver") to test a particular role, or isPlayerControlled() to test any role. Use controllingStations(role) when station identifiers are needed.
include/utilities/vreUtil/vreStatePropertiesUtil.h defines the shared role-station helpers. Do not duplicate parsing or assume a role name alone grants all actuator authority. Role occupancy, joystick connection state, port arbitration, and simulation ownership are different concepts.
An actuator changes simulation state through VR-Forces ports and state repositories. Its descriptor reads system-definition parameters, and its factory creator receives the component name, owner, simulation services, descriptor, and parent registry. Use an existing actuator or DtVreSimComponent specialization when adding player-aware behavior.
The vehicle blinker example is a complete actuator/descriptor/plugin combination. Its port-creation method is:
The header declares the retained port members. The source includes the example actuator/descriptor headers and vrfStateData/groundVehicleLightingStateComponent.h. init() locates the configured left-blinker-active and right-blinker-active State Properties. These properties must exist in the entity's configured state data. See Vehicle Blinker for the system definition and frontend consumer.
Choose a base matching the sensor's behavior. For example, DtObjectProximitySensor extends the VR-Forces proximity-sensor model, while DtVreGimbalController coordinates gimbal aiming. Use the actual headers under include/vrfExtensions/vreVrfmodel for constructors and override signatures. Register a compatible descriptor along with a new component type.
The checkout includes Vortex ground-vehicle integration and RTDynamics flight integration. Their descriptors, data files, and component interfaces differ. Do not substitute a generic physics component or an invented system-definition grammar. Consult the specific engine's integration and model documentation.
The maintained sports-car system is data/simulationModelSets/VR-Engage/vrfSim/systems/movement/ground-sportscar-vortex.sysdef. Its actuators.vortex-powertrain entry selects vortex-movement-actuator-descriptor and vortex-movement-actuator. Within that entry, the mechanism parameter is:
The field is vortex-mechanism-filename, not mechanism-file. DtVortexMovementActuatorDescriptor registers that exact name and supplies it to the actuator. The actuator resolves the path and loads the mechanism using the Vortex integration. The system also defines Vortex part/interface mappings and repository-update connections; the single field above is not a complete vehicle definition.
The same system wires player input to the Vortex actuator:
Sources: libsrc/vrfExtensions/vreVrfVortexObjparam/vortexMovementActuatorDescriptor.cxx and libsrc/vrfExtensions/vreVrfVortex/vortexMovementActuator.cxx. Mechanism assets must come from the compatible installed Vortex data package.
Flight actuators and descriptors are in vreVrfRtd and vreVrfRtdobjparam. Use the maintained fixed-wing or rotary-wing system definitions and their corresponding model data. Do not infer model fidelity, control inputs, or tuning parameters from the Vortex example.
There is no single guide-defined entity switch that disables every CGF actuator whenever any player engages. Authority depends on the subsystem's controller connection, active ports, role occupancy, and actuator logic. A driver, gunner, and commander can control different subsystems of the same entity.
DtVreJoystickController::joystickConnected() persists its connection state and attempts to activate its output group. joystickDisconnected() persists state and deactivates that group. Controllers and actuators then use VR-Forces port arbitration; role occupancy is not a replacement for it.
The human movement controller shows another policy: when all movement ports activate, it sets internalState()->setJoystickMovementControlled(true). Disconnection zeros speed, permits group deactivation, and clears that flag. This is movement-specific, not a global weapon or sensor control mode.
Vortex applies its own role and physics policy. isVortexPlayerControlled() accepts an occupied Driver role, or an occupied Gunner role when a Vortex turret interface exists. isInVortexWorld() also considers high-fidelity stationary CGF operation and towing. It excludes unavailable interfaces, disallowed destroyed/mobility-killed cases, and embarked entities. checkTaskStatus() skips a current CGF task while Vortex control is active. Do not generalize this behavior to all VR-Engage components.
Releasing joystick control permits the relevant controller/port policy to restore CGF authority. Whether a prior plan continues depends on the actuator and task manager. A disengagement does not promise automatic restoration of a task skipped during Vortex operation.
Frontend roles select joystick function groups. A joystick command identifies an entity, group, function, value, and repeat flag. The connector translates it to a VR-Forces joystick request. The configured backend controller maps the group/function pair to its output port. Function-group strings are case-sensitive; they are routing identifiers, not a general authorization check.
The sports-car system's joystick controller includes this real control:
$automotive-driving is a system-definition variable, not the literal group name sent by the frontend. Use the entity's bindings and role joystickFunctionGroups to establish the actual pairing.
The simulation owner publishes state for the entity. Connected frontends consume reflected state or explicit response messages. Player attributes themselves remain process-local. See Reflected Entity Attributes for subscriptions and value timing.
DtOwnshipControlConnector::handleJoystick() runs in the frontend. It receives a queued JoystickMessage and calls its VR-Forces remote controller's sendJoystickControl(). The remote request reaches VR-Forces joystick handlers in the simulation. This is not a backend DtVrfRemoteControlConnector receiving the original frontend object.
DtVreJoystickController inherits both DtVreSimComponent<DtControllerComponent> and DtVreJoystickControllerInterface. The latter derives from DtJoystickControllerInterface. Controllers override calcAndSetPortValues(const DtString&, const DtString&, double, bool) and connection hooks.
DtVreJoystickControllerInterface persists each controller's Enabled flag and exact RequestCount under internal state VreJoystickControllers.Controllers, keyed by full component name. Connection hooks write transitions; device-request processing also preserves count-only changes. The helper creates the typed storage when needed; SMS declarations for this internal-state map are unnecessary.
First-tick restoration reconnects only after incoming ownership transfer. It does not reconnect on ordinary construction, scenario loading, or rewind. It preserves live requests received before the first tick rather than replacing them with archived state. Controllers already inheriting the VR-Forces interface use static helpers to avoid a second interface subobject. Callback registration must use the original adjusted interface pointer.
The generic controller's actual first-tick implementation is:
Read include/vrfExtensions/vreVrfmodel/vreJoystickControllerInterface.h and its corresponding source before extending connection or ownership-transfer behavior.
DtVreJoystickController::createPorts() reads DtRwJoystickControls from its descriptor. Equal minimum/maximum values create a boolean output initialized to false; other ranges create an analog output initialized to zero. Port names come from the control entry name; dispatch keys combine functionGroup and functionName. The descriptor reads output-port-group-name. There are no port-type or default-value fields in this controller's documented configuration path.
System-definition connect entries wire controller outputs to actuator inputs. The Vortex connections above use vehicle-control and driver-input. Connection hooks govern activation, and the controller attempts activation during enabled ticks.
The blinker actuator processes new data, acknowledges it, and toggles the configured State Property:
tick() takes no double argument in this simulation component. newData() tests for pending input; dataReceived() acknowledges it.
The frontend gunner/weapon logic sends control and selection requests; backend weapon components own ammunition, firing, and weapon simulation. DtWeaponsStatusController handles configuration requests and selection messages, and publishes configuration/ammunition responses. Its current base includes DtVreJoystickControllerInterface for ownership-handoff state.
Use include/vrfExtensions/vreVrfmodel/weaponsStatusController.h and libsrc/vrfExtensions/vreVrfmodel/weaponsStatusController.cxx for the actual interface and handlers. Use maintained weapon .sysdef/.template_sysdef files under the VR-Engage model set, not a synthetic system-definition/components wrapper. Frontend gunner parameters are declared in include/commonRoleLibraries/vreCommonComponents/gunnerControlLogic.h.
Entity files reference backend systems and frontend roles. Role Lua supplies frontend components, input mappings, and display-layout overrides; system definitions supply backend components and connections. See Role Configuration for composition and entity parameter overrides.
vreVrfmodel provides simulation components and controllers. vreVrfobjparam provides their descriptors. vreVrfobjcore extends object/state/task behavior. vreVrfVortex and vreVrfRtd integrate physics engines. vreMessageManager is under libsrc/utilities, not libsrc/framework; its base message header is include/utilities/vreMessageManager/vreMessage.h. Use maintained example CMake files for actual include roots and dependencies.
See also