|
VR-Engage
2.3
|
Role configuration connects frontend C++ components to selectable entity roles. Lua role files and reusable includes describe components and parameters. Entity files bind roles to entity types and supply overrides. Backend system definitions remain separate: they configure simulation components, not Player Station components.
| Layer | Format | Responsibility |
|---|---|---|
| Entity | .entity XML | Available roles, role-file references, display selection, parameter overrides |
| Role | Lua table fragments | Frontend components, inheritance, includes, menu and display-layout configuration |
| Component | C++ | Registered type, configuration reader, lifecycle, and runtime behavior |
Source role files live under data/simulationModelSets/VR-Engage/roles. The installed equivalent is data/simulationModelSets/VR-Engage/roles. @(vre-roles-dir) is resolved through the active model-set role search paths. Keep source-tree and installation paths distinct.
The maintained notification example extends an existing human role:
Use the complete file with its inheritance/include setup when deploying the example. examples/notification/plugin.cxx registers the same type string with the component factory. Component entry keys identify instances; componentType identifies the registered C++ creator. Other fields become the DtInitTable supplied to that component's initialize(). See Player Station Framework for loading and readiness.
Role displayLayouts are named role-configuration overrides, not lists of channel rectangles. The selected layout commonly contributes UI, observer, window-layout, or VR components. The driver role's "1 Screen Horizontal" layout contains this saved-view component:
The full layout includes additional components. The "VR Headset" layout uses requiresHMD = true and its own component configuration. Observer/channel/window names refer to the actual VR-Vantage display configuration. See Configuring views in role definitions for saved records, look-around settings, and channel keywords.
includes loads reusable Lua configuration files; inherits establishes the parent role chain. These files contribute ordinary components tables, not a special runtime component-group type. Use the maintained role and device files for registered types and supported parameter names. Do not treat a component-group filename as a componentType.
DtQtQuickOverlay reads qmlFilename, qmlDataItemObjectName, and bindQmlPropertyToAttribute. The maintained QML HUD example uses:
These fields belong to the configured overlay component, whose complete role also supplies the filename/data-item name and a publisher component. The binding values are player-store paths. The publisher and QML properties must agree on types and names. Use visibilityAttribute for the supported visibility path; a generic properties table is not the overlay binding API. See UI and Visualization for the complete example.
Component groups are reusable Lua files with ordinary role-table entries. Their location is a convention, not a parser requirement. Existing devices under roles/devices include radios, deployable objects, and towing. Check the actual file and corresponding component reader before adding parameters.
appData/scripts/loadDefinition.lua provides the composition functions. DtPlayerCreationPalette supplies model-set paths and entity/display descriptors.
resolvePath() and loadTableFile().DtInitTable to C++.mergeDefinitions() handles fields by category. Components merge by instance name; same-named display-layout entries are cloned/replaced rather than treated as channel geometry. Authored roleTypes and legacy roles declarations normalize to the player roleTypes list. getPlayerConfiguration() merges the selected layout before applying parameter overrides. Component sorting uses ascending priority, with 10 when omitted. Do not depend on a particular order among equal-priority components.
When debugRoleDefinitions is enabled, the loader serializes the final player table to the role debug folder. The creation palette prepares that folder. Inspect this output to diagnose the actual merged component list. Sources: loadDefinition.lua and libsrc/framework/vrePlayerStation/playerCreationPalette.cxx.
Components read only parameters supported by their current C++ reader. findDataOr<T>() supplies a fallback when absent; findData<T>() reads a specified value. Public \vreRoleParam annotations describe the intended keys/types/defaults, but the current reader determines behavior. Role parameters do not automatically become attributes or backend commands. See Role Configuration Parameters and Frontend Attributes.
| Lua value | C++ lookup type |
|---|---|
true / false | bool |
| Integer | int |
| Number | double or the reader's actual numeric type |
| Quoted string | std::string |
| Table | DtInitTable or the supported structured reader |
Keep the configured numeric type and units consistent with the reader. Do not add a parameter merely because another component supports a similarly named field.
The ACV-P entity has a real Driver role reference and saved-view overrides:
This excerpt omits the entity's other Driver overrides and surrounding vrEngageRoles/entity XML. paramName names the selectable entity role. slotName associates the role with an embarkation slot; defaultDisplayLayout selects an available role layout. order controls presentation order. Use unlisted for sub-roles that should not appear independently in selection.
The XML attribute supplies the componentName.parameterName path; element text supplies the Lua value. For string values, preserve the quotes inside XML text, as the actual saved-view overrides above do. Do not put an assignment expression inside an attribute-less <parameterOverride> element.
The final player configuration combines inheritance/includes, the role's components, and the selected layout. Entity role overrides then apply, followed by display-specific overrides. C++ defaults apply only where the resulting component table has no configured value. Component groups and includes are the same merge mechanism, not two separate precedence layers.
Entity role definitions can reference configured embarkation slots. Role names, slot names, role-type keys, station identifiers, and entity UUIDs serve different purposes. Use actual entity/role data when pairing them. See the VR-Engage User Guide's embarkation-slot configuration documentation for the complete entity schema.
Role changes pass through Player Station loading and readiness, not directly from selection to normal component ticks. A suspended station can retain its attribute branch while its components are recreated. See Player Station Framework for that lifecycle.
DtMetaRoleControlLogic manages configured sub-roles. Current role parameters separate nextSubRoleInputAction and nextSubRoleMenuAction. The reader retains nextSubRoleBinding as the fallback when either separate action is absent. Read include/commonRoleLibraries/vreCommonComponents/metaRoleControlLogic.h, the corresponding source, and the maintained model-set meta-role definitions. Keep sub-role names consistent with the entity's role entries.
Keep role, input, saved-view, and entity files in their maintained model-set directories. Deploy the corresponding plugin DLL and required UI assets as well as the role data. Source files under data are installed under data; factory scripts are installed under the application's factory/appData trees.
Use portable path macros, valid registered types, and current parameter readers. Check the merged role, component creation/readiness, input mappings, and selected display configuration. Test runtime behavior in the intended application; static configuration review does not establish that external assets, devices, or display resources are available.
See also