VR-Engage  2.3
Loading...
Searching...
No Matches
Plugin Architecture

Frontend plugins extend Player Station interaction, UI, input, and roles. Simulation Engine plugins extend VR-Forces entities, simulation components, physics, and backend services. Keep entry points focused on registration and lightweight initialization; put runtime behavior in the corresponding libraries.

Plugin type overview

Primary plugin types

VR-Engage supports two primary extension types. Frontend plugins add player-facing components, input devices, and UI. Simulation Engine plugins add entity behavior and simulation components to the backend. A feature can have both parts: the vehicle blinker example adds frontend input handling and a backend actuator, with entity state providing feedback to the display.

VR-Engage also uses VR-Vantage graphics plugins and VR-Forces protocol-dependent plugins. A shared library is a dependency, not a plugin: neither plugin loader calls its functions automatically. Choose the extension point that owns the behavior. A HUD or input mapping belongs in the frontend; an actuator or sensor model belongs in the simulation. Use a shared library when both sides need the same message definitions or common data structures.

Frontend plugin architecture

Entry points

DtVrePluginManager resolves three C-linkage exports. Each accepts makVre::DtPlayerStationApp*:

Export Return type Purpose
initPlayerStationModule bool Register component, input-device, or service creators
postInitPlayerStationModule bool Finish setup that depends on application initialization
shutdownPlayerStationModule void Remove registrations and release plugin-owned resources

Declare exports in the plugin header using its DLL export macro. Including that header before the definitions exports the same C-linkage symbols. The notification example declares its init and shutdown hooks in examples/notification/plugin.h; it does not need a post-init hook.

The export declarations in that header are:

// Source: examples/notification/plugin.h (declarations excerpt)
namespace makVre
{
class DtPlayerStationApp;
}
extern "C"
{
}
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:155
#define NOTIFICATION_DLL
Definition plugin.h:15
VRECOMMONCOMPONENTS_DLL bool initPlayerStationModule(makVre::DtPlayerStationApp *app)
Module initialization function declarations using C linkage.
VRECOMMONCOMPONENTS_DLL void shutdownPlayerStationModule(makVre::DtPlayerStationApp *app)
Shuts down the vreCommonComponents module.
!
Definition glsVreMessageUtil.h:50

The header defines NOTIFICATION_DLL as __declspec(dllexport) when building the Windows module, and __declspec(dllimport) for consumers. Its condition is notification_EXPORTS, the module target's export definition. If adapting the example, keep the target, macro condition, declarations, and function definitions consistent. C linkage prevents C++ name mangling; the export macro makes the symbol visible to the loader.

The excerpt below is from examples/notification/plugin.cxx. The file includes plugin.h, notifyLogic.h, vrePlayerStation/playerStationApp.h, and vreUtil/logger.h.

using namespace makVre;
extern "C"
{
{
LOG_VERBOSE("Example Notify", "Initializing front-end\n");
app->componentFactory().addCreator<DtNotifyLogic>("DtNotifyLogic");
return true;
}
{
app->componentFactory().removeCreator<DtNotifyLogic>("DtNotifyLogic");
}
}
Example component demonstrating player attribute monitoring and temporary notifications.
Definition notifyLogic.h:43
void removeCreator(std::string name="")
Definition factory.h:103
void addCreator(std::string name="")
Registers a creator for a specific type.
Definition factory.h:129
virtual DtComponentFactory & componentFactory()
Gets the component factory.
#define LOG_VERBOSE(channel, format,...)
Macro to log a verbose message using printf-style formatting.
Definition logger.h:162

The current loader accepts a DLL with any recognized hook; each phase skips missing hooks. An init hook is needed when the plugin registers creators. This differs from older header comments that describe init as universally required. A false init or post-init return logs a failure; it is not automatic rollback of registrations or proof that later hooks cannot run.

Discovery and registration

Plugin discovery

DtPlayerStationApp loads vreCommonComponents.dll before discovering other frontend plugins. It resolves playerStationApp.pluginPath, defaults to ../plugins64/vrEngage, and appends the build's release or debug subdirectory. Discovery scans that directory's DLLs in case-insensitive filename order. Frontend plugins do not use VR-Forces XML records.

Register a component with the same string returned by its type() method and used in Lua componentType. Registration does not construct a Player Station component. Player loading creates configured components and runs their lifecycle. Components should normally use the inherited myMessageHandlers group for message subscriptions. See Toolkit Fundamentals and Player Station Framework.

Component registration

The factory stores a creator rather than a pre-created component. This lets different Player Stations create their own instances from role configuration. The notification plugin registers "DtNotifyLogic"; the component returns the same identifier from type(), and its maintained role uses:

-- Source: data/simulationModelSets/examples/notification/roles/human.lua (excerpt)
components = {
["notifyLogic"] = {
componentType = "DtNotifyLogic";
};
};

The complete role inherits humanBase.lua and includes its display layouts. notifyLogic is the instance key; DtNotifyLogic is the registered C++ type. The framework supplies the merged component table to initialize() during player loading. Remove the creator in the plugin shutdown hook, as the entry-point example does.

Message-handler registration and cleanup

Register component-specific handlers during component initialization, not by creating role objects in the plugin entry point. Prefer the inherited DtVreMessageHandlerGroup when subscriptions share the component's lifetime. The maintained saved-view updater registers its handlers this way:

// Source: libsrc/commonRoleLibraries/vreCommonComponents/savedViewUpdater.cxx
// initialize() excerpt, after base initialization
virtual makVre::DtVreMessageResult handleMenuMessage(makVre::DtVreMessage *msg)
Handles menu action messages related to saved views.
virtual makVre::DtVreMessageResult handlePlayerCreated(makVre::DtVreMessage *msg)
Handles player creation messages.
static const std::string & theType()
Get the message type string for this instance.
static const std::string & theType()
Get the message type string for this instance.

The surrounding source includes vreMessages/menuAction.h and vreMessages/playerCreated.h. DtPlayerComponent supplies the member group. Its base shutdown disconnects both message and attribute subscriptions:

// Source: libsrc/framework/vrePlayerStation/playerComponent.cxx
{
}
void disconnectAll()
Removes and destroys all registered callbacks.
virtual void shutdown()
Shuts down the component.
DtAttributeCallbackManager myAttributeCallbacks
Member-scope instance of Attribute callback manager.
Definition playerComponent.h:275
DtVreMessageHandlerGroup myMessageHandlers
Member-scope instance of message handler group.
Definition playerComponent.h:281
void disconnectAll()
Disconnects all handlers for all message types.
Definition vreMessageManager.h:368

Call base shutdown before releasing resources that callbacks use. A single retained DtVreMessageHandler remains appropriate for a simpler connection. If using direct addHandler(type, delegate) calls, retain the matching removeHandler() cleanup. The QML HUD example shows that explicit pairing. Do not use the obsolete templated DtVreMessageManager::addHandler<MessageType>() pattern.

Frontend plugin examples

  • Notification: component registration and attribute monitoring.
  • State: application-state customization.
  • Input device: input-device registration.

Simulation Engine plugin architecture

Simulation Engine plugins use the VR-Forces plugin loader and CGF factories, not the frontend loader. There are two entry-point patterns: use the VR-Forces hooks directly when adding new components or other factory types; call the VR-Engage initialization functions from those hooks when extending an existing VR-Engage controller or class.

Plugin configuration

The shipped VR-Engage Simulation Engine record is appData/plugins/vreVrfSimPlugin.xml. At runtime the backend reads the effective appData/plugins directory; --appDataDir can change the root.

The record is a Boost-serialized DtVrfPluginRecord, not a single <plugin> element. It selects a library for an application, platform, build configuration, and transport. In this record the selectors are vrfSim, Windows64, Release, and Independent. The library value is ../plugins64/vrForces/release/vreVrfSimPlugin.dll; myLoad is 1. Use the complete shipped record or the VR-Forces Plug-ins editor rather than inventing XML.

The complete record is:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Source: appData/plugins/vreVrfSimPlugin.xml -->
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="20">
<DtVrfPluginRecord class_id="0" tracking_level="0" version="1">
<myPluginData class_id="1" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="2" tracking_level="0" version="0">
<first>vrfSim</first>
<second class_id="3" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="4" tracking_level="0" version="0">
<first>Windows64</first>
<second class_id="5" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="6" tracking_level="0" version="0">
<first>Release</first>
<second class_id="7" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="8" tracking_level="0" version="0">
<first>Independent</first>
<second class_id="9" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>plugin</first>
<second>../plugins64/vrForces/release/vreVrfSimPlugin.dll</second>
</item>
</second>
</item>
</second>
</item>
</second>
</item>
</second>
</item>
</myPluginData>
<myLoad>1</myLoad>
</DtVrfPluginRecord>
</boost_serialization>

This is the VR-Engage core Simulation Engine record, not a ready-made record for a different DLL. Create the custom record with the editor, selecting its actual DLL and supported configurations. Copying only the library path without retaining the record structure is insufficient.

The inherited VR-Forces startup method DtVrfApp::initializePluginsForCommandLineArguments() reads the records with DtVrfPluginRecordManager, selects vrfSim and applicable transports, and adds selected libraries to the CGF. It then creates the plugin manager. The same function handles --loadPlugin, including explicit XML records. See "Managing Plug-ins" in the VR-Forces User's Guide for the editor workflow.

Entry points

Both patterns export the VR-Forces C-linkage hook names. The VR-Forces loader calls these exports; the namespaced VR-Engage functions described below are callable library functions, not alternative DLL export names.

Adding new components with VR-Forces entry points

Use this pattern when strictly adding new components, descriptors, or other factory types without extending VR-Engage controllers or classes. Register the new types directly in the VR-Forces initialization hook. No call to the VR-Engage initialization functions is needed for this registration-only pattern.

The lifecycle hooks documented by vrfcgf/vrfPluginExtension.h are:

Export Return type Purpose
DtPluginInformation(DtVrfPluginInformation& info) void Identify the customer plugin
DtInitializeVrfPlugin(DtCgf* cgf) bool Register the plugin's creators and perform lightweight setup
DtPostInitializeVrfPlugin(DtCgf* cgf) bool Perform setup that requires initialized CGF objects or other plugins
DtUnloadVrfPlugin(DtCgf* cgf) void Release plugin-owned resources during unload

Declare the hooks with extern "C" and DT_VRF_DLL_PLUGIN. Supply post-initialization and unload hooks when the plugin needs those phases. The unload hook takes DtCgf*, not an empty parameter list.

The vehicle blinker plugin shows this component-registration pattern:

// Source: examples/vehicleBlinker/vehicleBlinkerSim/plugin.cxx
extern "C"
{
void DT_VRF_DLL_PLUGIN DtPluginInformation(DtVrfPluginInformation& info)
{
info.pluginName = "Example Vehicle Blinker Sim";
info.pluginVersion = DtVreVersionNumber;
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
}
bool DT_VRF_DLL_PLUGIN DtInitializeVrfPlugin(const DtCgf* cgf)
{
cgf->factoryManager()->componentFactory()->addCreatorFcn(makVre::DtVehicleBlinkerActuatorType,
cgf->factoryManager()->componentDescriptorFactory()->addCreatorFcn(makVre::DtVehicleBlinkerDescriptorType,
return true;
}
}
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=nullptr, DtReaderWriterRegistry *parentRegistry=nullptr)
static DtComponentDescriptor * creator()
constexpr char DtVehicleBlinkerActuatorType[]
Definition vehicleBlinkerActuator.h:22
constexpr char DtVehicleBlinkerDescriptorType[]
Definition vehicleBlinkerDescriptor.h:19

The excerpt omits only additional contact metadata and comments. Its file includes plugin.h, the actuator and descriptor headers, vreUtil/version.h, vrfcgf/vrfPluginExtension.h, vrfcgf/cgf.h, and vrfcgf/factoryManager.h. Use the signature required by the selected VR-Forces entry point; the maintained blinker example accepts a const CGF pointer. The VR-Engage wrapper functions below require DtCgf*.

Extending an existing VR-Engage controller or class

Use this pattern when deriving from an existing VR-Engage controller or component, such as makVre::DtObjectProximitySensor, or when extending classes that depend on VR-Engage's Simulation Engine setup. The plugin DLL itself does not inherit a DtVreSimPlugin class; DtVreVrfSimPlugin is a namespace.

The callable VR-Engage functions are declared in include/vrfExtensions/vreVrfSimPlugin/vreVrfPlugin.h. The core plugin forwards its VR-Forces exports to these functions:

// Source: libsrc/vrfExtensions/vreVrfSimPlugin/vreVrfPlugin.cxx (exports excerpt)
extern "C"
{
DT_VRF_DLL_PLUGIN bool DtInitializeVrfPlugin(DtCgf* cgf)
{
}
DT_VRF_DLL_PLUGIN bool DtPostInitializeVrfPlugin(DtCgf* cgf)
{
}
DT_VRF_DLL_PLUGIN void DtUnloadVrfPlugin(DtCgf* cgf)
{
}
DT_VRF_DLL_PLUGIN void DtPluginInformation(DtVrfPluginInformation& info)
{
}
}
VREVRFSIMPLUGIN_DLL void DtVreVrfPluginInformation(DtVrfPluginInformation &info)
Provides information about the VREngage simulation plugin.
VREVRFSIMPLUGIN_DLL bool DtPostInitializeVreVrfPlugin(DtCgf *cgf)
Performs post-initialization tasks for the VREngage simulation plugin.
VREVRFSIMPLUGIN_DLL bool DtInitializeVreVrfPlugin(DtCgf *cgf)
Initializes the VREngage simulation plugin.
VREVRFSIMPLUGIN_DLL void DtUnloadVreVrfPlugin(DtCgf *cgf)
Unloads the VREngage simulation plugin.

The source includes vreVrfSimPlugin/vreVrfPlugin.h, vrfcgf/vrfPluginExtension.h, and CGF/factory headers. These wrappers show the core lifecycle functions, not a complete customer plugin.

In a customer plugin, call makVre::DtVreVrfSimPlugin::DtInitializeVreVrfPlugin(cgf) first and check its result, then register the derived creators. The initialization hook follows this template:

// Template: insert the customer plugin's factory registrations at the marked location.
#include <vrfcgf/vrfPluginExtension.h>
extern "C"
{
DT_VRF_DLL_PLUGIN bool DtInitializeVrfPlugin(DtCgf* cgf)
{
{
return false;
}
// Register derived creators after the VR-Engage base registrations.
return true;
}
}
Main entry point for the VREngage simulation plugin.

When replacing a built-in component, register the derived creator under the existing component type identifier. For example, a DtObjectProximitySensor replacement uses DtObjectProximitySensorType; a separately configured variant uses its own type identifier. The creator must construct the derived class, not the base class. This initialization order prevents the core plugin's registrations from replacing the customer override. DtInitializeVreVrfPlugin() has a repeat-call guard, so the core plugin's later initialization call does not repeat its registrations.

Keep the core plugin enabled when the customer plugin only extends it. The core plugin owns its post-initialization and unload phases; the customer hooks perform customer-owned setup and cleanup. Do not also forward the core post-initialization and unload functions from every extension plugin: post-initialization has no repeat-call guard, and core unload releases shared VR-Engage services. Use the full forwarding pattern only when deliberately taking over the core plugin's lifecycle, with a single owner for those phases. Populate DtPluginInformation() with the customer DLL's metadata rather than copying the core plugin's identity.

Registration patterns

Component and descriptor registration serve different purposes. The component creator constructs the runtime actuator, sensor, or controller. The descriptor creator reads that component's configuration from the system definition. Register both when adding a new descriptor type, and ensure the configured component and descriptor type strings match their creators. A derived override can retain its existing descriptor when compatible.

Simulation Engine plugin examples

examples/vehicleBlinker/vehicleBlinkerSim/plugin.cxx registers both an actuator and its descriptor:

cgf->factoryManager()->componentFactory()->addCreatorFcn(makVre::DtVehicleBlinkerActuatorType,
cgf->factoryManager()->componentDescriptorFactory()->addCreatorFcn(makVre::DtVehicleBlinkerDescriptorType,

This is an excerpt from its exported init function, not a complete plugin. The surrounding file includes the actuator, descriptor, CGF, factory-manager, and export headers. See Vehicle Blinker and Custom Projectile.

Shared libraries

Purpose

Shared libraries contain reusable code and definitions rather than plugin entry points. Common uses include generated messages, protocol-independent helpers, and data structures consumed by more than one module. A single shared definition avoids separately maintained copies of message layouts. Both consumers still need the library deployed and a compatible version of its interface.

Keep shared message definitions and utilities in libraries linked by their frontend and Simulation Engine consumers. Export public symbols with the library's export header and compile definition. The examples/customPdu/commentMessage project is a maintained example: export.h supplies EXAMPLEMESSAGE_DLL, and CMakeLists.txt generates the message classes from Lua. Its output library is exampleCommentMessage, deployed to bin64.

Symbol export

The Comment library uses this export header:

// Source: examples/customPdu/commentMessage/export.h
#pragma once
#ifdef _WIN32
#ifdef COMMENTMESSAGE_EXPORTS
#define EXAMPLEMESSAGE_DLL __declspec(dllexport)
#else
#define EXAMPLEMESSAGE_DLL __declspec(dllimport)
#endif
#else
#define EXAMPLEMESSAGE_DLL
#endif

The building target defines COMMENTMESSAGE_EXPORTS; consumers include the same header without that definition. The resulting import declarations let Windows consumers link to the exported symbols. An export macro does not replace linking the import library or deploying the runtime DLL.

Class declaration and message generation

For a generated message, describe the fields in Lua and let the maintained generator supply the C++ class, accessors, serialization, and factory registration. The Comment schema is:

-- Source: examples/customPdu/commentMessage/comment.lua
MESSAGE{
fileName="commentMessage";
className="Comment";
messageType="admin.comment";
comment = "This class is used with the exampleCustomPdu example";
attributes={
{type = "EntityIdentifier", name = "sender"};
{type = "EntityIdentifier", name = "receiver"};
{type="String", name="comment"};
}
}

Generation produces makVre::CommentMessage and its commentMessage.h/.cpp files. The build passes EXAMPLEMESSAGE_DLL and export.h to the generator. Do not replace it with a partial handwritten DtVreMessage subclass that omits serialization and factory requirements. The message base header is vreMessageManager/vreMessage.h.

CMake configuration

These excerpts show the actual shared target, generation call, export definition, and deployment rule:

# Source: examples/customPdu/commentMessage/CMakeLists.txt (excerpts)
add_library(commentMessage SHARED)
set(TARGET commentMessage)
set_target_properties(commentMessage PROPERTIES
OUTPUT_NAME "exampleCommentMessage"
FOLDER "Examples/CustomPdu"
)
generateMessages(${TARGET} ${CMAKE_CURRENT_SOURCE_DIR} makVre EXAMPLEMESSAGE_DLL "${CMAKE_CURRENT_SOURCE_DIR}/export.h" ${CMAKE_CURRENT_SOURCE_DIR})
AddCompilerDefinitions(${TARGET} ${BOOST_COMPILER_DEFINITIONS} -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -DNOMINMAX -DDT_DLL_BUILD -DDT_USE_DLL -DCOMMENTMESSAGE_EXPORTS)
install(TARGETS commentMessage
RUNTIME DESTINATION ${MAK_VREDIR}/bin64
LIBRARY DESTINATION ${MAK_VREDIR}/lib64
)

The complete CMake file also supplies include/link directories, collects generated and handwritten sources, and links the message infrastructure. Retain those prerequisites when adapting it. See Message code generation for the full build example and parameter list.

Linking from plugins

The Entity Detection example demonstrates a shared library used by both frontend and Simulation Engine plugins. Both examples/entityDetection/entityDetectionFrontend/CMakeLists.txt and examples/entityDetection/entityDetectionSim/CMakeLists.txt include entityDetectionShared in their AddLibrariesToLinkWith() lists:

# Source: examples/entityDetection/entityDetectionSim/CMakeLists.txt (library-list excerpt)
AddLibrariesToLinkWith(${TARGET}
entityDetectionShared
vreUtil
vrfmodel
vrfobjcore
vrfobjparam
vrfSimCore
vrfmsgs
vrftasks
vrfutil
readerWriter
vlutil
matrix
vrfMsgTransport
vl
vreMessageManager
features
gdb
geometry
luabind
makSettingsManager
mtl
tdbutil
terrainCS
terrainInterface
vreMessages
vrfExtProtocol
vrfStateData
vrvImgui
proj)

The shared target's output name is exampleEntityDetectionShared. Its CMake file installs the runtime library into both ${MAK_VREDIR}/bin64 and ${MAK_VRFDIR}/bin64 so the participating processes can find it. The Custom PDU example's consumers are frontend and network-connector modules; its network module is not a VR-Forces backend plugin.

Deployment

Deploy the runtime DLL wherever each consumer process resolves its dependencies, not merely beside the source files. The import library is used during linking; the DLL is needed at runtime. The maintained shared-target CMake rules perform that deployment for their known consumers.

Example

See Custom PDU for the shared message, frontend publisher, and network consumer. A local message queue does not automatically send data to the other process; a connector or bridge must handle the message and use the configured transport.

Plugin lifecycle

Frontend plugin lifecycle

  1. Resolve the configured directory, load common components, and discover plugin DLLs.
  2. Call available init hooks during application initialization.
  3. Call available post-init hooks near the end of DtPlayerStationApp::postInitialize().
  4. Create role components during player loading, independently of plugin initialization.
  5. Clear Player Stations, then call available shutdown hooks during application shutdown.

Shutdown cleanup is explicit; loading a DLL does not create automatic factory unregistration. Recognized frontend plugin libraries remain loaded until process exit. The current wrapper deliberately retains them because disconnected signal connections can still reference plugin code. Do not describe shutdown as immediate DLL unload. See include/framework/vrePlayerStation/vrePluginManager.h.

Simulation Engine plugin lifecycle

  1. Read enabled plugin records for the applicable application, platform, configuration, and transport.
  2. Load the selected DLL and retrieve its plugin information.
  3. Run its initialization entry point to register factories and services.
  4. Run available post-initialization hooks for work that depends on initialization of other plugins.
  5. Create configured simulation components as entities and systems are initialized.
  6. Run the plugin's unload hook for plugin-owned cleanup when the loader shuts it down.

The factory-registration phase and entity/component lifetime are separate. Do not instantiate a sample actuator in the entry point to simulate normal entity creation. Derived VR-Engage component overrides must also preserve the base-registration ordering described above.

Plugin dependencies

Declaring dependencies

Use the maintained example CMake files for include directories, export definitions, libraries, and install paths. Frontend headers in the source tree live beneath include/framework and include/utilities; an include such as vrePlayerStation/playerStationApp.h needs the corresponding include root.

The notification frontend links vrePlayerStation, vreMessageManager, vreMessages, vreUtil, VR-Vantage support, and its role/UI dependencies. The vehicle blinker Simulation Engine target links the VR-Forces component, state-data, transport, and utility libraries used by its actuator and descriptor. A shared-message consumer additionally links the shared target, as the Entity Detection example shows.

A plugin that calls the VR-Engage Simulation Engine initialization functions also links vreVrfSimPlugin. Add the include/vrfExtensions include root for vreVrfSimPlugin/vreVrfPlugin.h, and link the library that provides the controller or component being extended, such as vreVrfmodel for DtObjectProximitySensor.

Dependencies must match both the types used in headers and calls made in implementation. Adding an include directory does not resolve linker dependencies; copying a DLL does not provide the compile-time declarations or import library.

Cross-plugin communication

Within the frontend, plugins can exchange process-local messages and share application or Player Station attributes. Give each attribute a stable type and one owner. Those writes do not automatically reach the simulation.

For backend changes, use the supported connector/message path. For reflected entity data, retain the required interests and consume the connector-owned values. Shared message definitions keep field layouts consistent but do not create a transport on their own. See Inter-Process Communication, Frontend Attributes, and Reflected Entity Attributes.

Plugin deployment

Installation locations

The maintained examples use these Windows runtime destinations under the toolkit root:

Target Runtime output Destination
notification exampleNotification.dll plugins64/vrEngage/release
vehicleBlinkerSim exampleVehicleBlinkerSim.dll plugins64/vrForces/release
commentMessage exampleCommentMessage.dll bin64

examples/notification/CMakeLists.txt installs its module to plugins64/vrEngage/release. examples/vehicleBlinker/vehicleBlinkerSim/CMakeLists.txt defines the backend dependencies and install location. Shared-library dependencies must be available to the relevant process. Do not assume a generic install destination automatically appends release.

Automatic installation with CMake

The frontend rule is:

# Source: examples/notification/CMakeLists.txt
install(TARGETS notification
RUNTIME DESTINATION ${MAK_VREDIR}/plugins64/vrEngage/release
LIBRARY DESTINATION ${MAK_VREDIR}/plugins64/vrEngage/release
)

The Simulation Engine plugin rule is:

# Source: examples/vehicleBlinker/vehicleBlinkerSim/CMakeLists.txt
install(TARGETS vehicleBlinkerSim
RUNTIME DESTINATION ${MAK_VREDIR}/plugins64/vrForces/release
LIBRARY DESTINATION ${MAK_VREDIR}/plugins64/vrForces/release
)

The shared rule appears in the CMake configuration section above. For Simulation Engine plugins, installing the DLL is only part of deployment: the loader also needs the enabled record for that configuration. For frontend components, deploy the role/input/UI data that references the registered type.

Best practices

Plugin design

  • Keep entry points focused on registration and lightweight setup.
  • Use factories and role/system configuration to create runtime components.
  • Return initialization failure explicitly and undo partial plugin-owned setup when needed.
  • Remove registrations and callbacks during the appropriate shutdown phase.

Component design

Give components focused responsibilities and preserve base lifecycle behavior. Read supported role parameters during initialization; resolve dependencies in post-initialization. Use the loading/readiness stage for deferred setup rather than blocking a normal frame tick. Keep ownership and callback cleanup explicit, particularly when a station can be suspended and recreated.

Performance

Register creators rather than pre-creating objects during plugin load. Keep frame and simulation-tick work bounded, and avoid verbose per-frame logging in production. Loading a module eagerly does not mean that all its registered role components are created eagerly.

Troubleshooting

Plugin not loading

Check the effective plugin directory or XML record, DLL exports, dependency availability, and failure messages. Confirm the configured library filename matches OUTPUT_NAME, including a protocol suffix when the maintained project supplies one. A dependent shared DLL must be visible to that process as well. Check the active platform/build/transport selectors in a Simulation Engine plugin record. For frontend plugins, verify the unmangled entry-point names and the export header's target definition.

Component not registered

For a missing frontend component, check its registered type string against Lua componentType. Confirm that registration happened before player loading, that the role actually includes the component, and that initialization did not fail. A descriptor type and a component type serve different factories; registering one does not register the other. For a Simulation Engine override, check that base VR-Engage initialization runs before the replacement registration. An init failure does not undo registrations already made by that hook.

Crashes on load or shutdown

Check library/toolkit ABI compatibility, static initialization, and exceptions during plugin setup. Avoid accessing application services from global constructors before the application exists. For shutdown failures, check dangling callbacks, pointers to destroyed components, and attempted manual DLL unload. Calling a shutdown hook is not proof that no remaining object or signal connection references the DLL's code.

See also