|
VR-Engage
2.2
|
This section covers the foundational concepts that inform all subsequent development work: the dual-process architecture, plugin loading mechanism, build system configuration, and development environment setup.
VR-Engage operates as a distributed system with two cooperating processes, even when running on a single machine. This architectural decision enables high frame rates for visualization while maintaining simulation fidelity, and provides clean separation between user-facing code and simulation logic.
The frontend process (vrEngage.exe) builds upon VR-Vantage and handles everything the user directly experiences. This includes 3D rendering, head-mounted display integration, input device polling, audio playback, and user interface presentation. The frontend maintains a local copy of entity state for smooth rendering but defers to the backend for authoritative simulation decisions.
The backend process (vrEngageSim.exe) builds upon VR-Forces and manages the authoritative simulation state. This includes physics calculations, damage assessment, sensor modeling, AI behavior, and network protocol handling. The backend publishes state updates that the frontend consumes for visualization, and receives input commands that the frontend forwards from user actions.
When developing new features, consider which process should own each responsibility. User-facing concerns like custom HUDs, input mappings, or visual effects belong in the frontend. Simulation concerns like physics models or weapon ballistics, belong in the backend. State that both processes need access to flows through the messaging layer described in Inter-Process Communication.
VR-Engage uses a plugin-based architecture that loads custom code at runtime. Plugins are compiled as Dynamic Link Libraries (DLLs) that register factories, components, and services with the application framework. This approach enables extending VR-Engage without modifying or rebuilding the core application.
Frontend plugins extend the player station with custom UI components, input handlers, and control logic. They export an initPlayerStationModule() entry point and are placed in plugins64/vrEngage/release/. VR-Engage automatically discovers and loads all plugins in this directory at startup.
Simulation plugins (also called backend plugins) extend the VR-Forces simulation engine with custom entity behaviors, physics models, and network handlers. They use VR-Forces entry points (DtInitializeVrfPlugin()) and require explicit configuration via XML files in appData/plugins/.
Shared libraries contain code used by both frontend and simulation plugins, such as message definitions or utility functions. They are deployed to bin64/ where both processes can load them.
For detailed plugin implementation patterns, entry point signatures, and complete code examples, see Plugin Architecture.
Plugin development requires Visual Studio 2022, CMake 3.16+, Qt 5.15.x, and the VR-Engage Toolkit. These tools work together to compile plugins against the VR-Engage SDK and deploy them to the correct runtime directories.
The build process uses CMake to generate Visual Studio solutions. VR-Engage provides CMake configuration files in the toolkit's cmake/ directory that define imported targets for linking against VR-Engage libraries. Plugins use find_package(VREngage) to locate these targets, then link against libraries like VREngage::vrePlayerStation for frontend plugins or VR-Forces libraries for simulation plugins.
Environment variables tell the build system where to find dependencies. The examples build system computes MAK_VREDIR automatically from the directory structure, but requires MAK_VRFDIR for VR-Forces, MAK_VRLDIR for VR-Link, and QTDIR for Qt.
For step-by-step setup instructions, environment variable configuration, and build commands, see Environment Setup & Build Guide. The examples directory includes a setupEnv.bat script and working CMakeLists.txt files that serve as templates for new plugins.
The VR-Engage Toolkit installation organizes headers, libraries, and runtime files in this structure:
| Directory | Contents |
|---|---|
bin64/ | Executables (vrEngage.exe, vrEngageSim.exe) and shared libraries |
include/ | Public headers organized by subsystem (framework/, vrePlayerStation/, vreMessages/) |
lib64/ | Import libraries for linking |
plugins64/ | Plugin directories: vrEngage/ (frontend), vrForces/ (simulation), vrVantage/ (graphics) |
data/ | Runtime data: roles, input mappings, simulation model sets |
examples/ | Toolkit examples with full source code |
cmake/ | CMake configuration files for find_package() |
Headers in include/ are organized by functional area. The framework/ directory contains core abstractions. The vrePlayerStation/ directory contains frontend-specific classes. The vrfExtensions/ directory contains backend integration classes.
For details on plugin installation paths and deployment, see Plugin Architecture.
Several patterns appear repeatedly throughout VR-Engage toolkit development.
Components are instantiated through factories rather than direct construction. This enables configuration-driven instantiation where role files specify component types by name.
Components read configuration from DtInitTable during initialization rather than hardcoding values. This enables runtime configuration through role files.
Components communicate through published messages rather than direct method calls. This decouples components and enables cross-process communication.
Proper error handling ensures components behave predictably during both normal operation and failure conditions.
Validate configuration during initialization. Check required parameters, validate ranges, and verify dependencies before returning from initialize(). Configuration errors should prevent component activation rather than causing runtime failures.
Handle runtime errors gracefully. Backend simulation logic should continue processing despite individual component failures. Frontend components should maintain functionality when backend connections drop. Log sufficient diagnostic information to understand failure causes without exposing internal implementation details.
Log sufficient diagnostic information to aid troubleshooting:
Consistent testing and validation help catch integration issues early and keep custom plugins maintainable over time.
See also
Next steps
This section covered the dual-process architecture, plugin system, and development environment. The following sections address specific implementation topics: