![]() |
VR-Forces Developer's Guide
|
This document describes the public API changes in the vrfcore library between VR-Forces 5.2 and VR-Forces 5.3.
It covers the following public headers:
vrfcore/createObjectServiceInterface.hvrfcore/detonationServiceInterface.hvrfcore/frameRateMonitor.hvrfcore/hitZoneDamageParamsManagerInterface.h (new)vrfcore/scenarioServiceInterface.hvrfcore/simManager.hvrfcore/simulationServices.hvrfcore/timerTypes.hvrfcore/vrfSimSettingsManager.hvrfcore is the core toolkit library. Several of the headers listed above declare abstract service interfaces that plug-ins and back-end implementations are expected to implement. Pure virtual methods added to those interfaces break every existing implementation at compile time, so review the Breaking Changes section carefully even if your code only implements a single service.
Changes that are internal to an implementation or limited to comments are not listed.
DtDetonationServiceInterface now requires implementations to supply a detonation power value:
Every class deriving from DtDetonationServiceInterface must implement this method or it will no longer be instantiable. powerType selects which power curve is consulted for the munition; rangeFromShooter and rangeFromImpact are supplied so the implementation can attenuate the returned power with distance. Implementations that have no meaningful power model should return the munition's nominal power rather than zero, because a zero result is interpreted by the damage assessment code as "no effect".
DtScenarioServiceInterface now requires accessors for the snapshot fragment directory and the simulation terrain filename:
All four must be implemented by any class deriving from DtScenarioServiceInterface. The snapshot fragment directory is resolved on access rather than on assignment, so store the DtFilename unmodified and let the caller resolve it. The terrain filename records the terrain that the simulation engine actually loaded, which is not necessarily the terrain named in the scenario file.
The scenario run identifier changed from an int to a DtUUID. This affects both the simulation manager and the DtSimulationServices facade:
Code that stored the run ID in an int, compared it with an integer literal, or wrote it to a stream as a number must be updated to use DtUUID. Comparison and assignment work as before through the DtUUID operators; formatting requires DtUUID::string(). Because the return type is now a reference, do not hold the result beyond the lifetime of the simulation manager.
The "run for a duration" feature was reworked into a "run until a simulation time" feature. The semantics changed along with the names: runForDuration took a delta from the current simulation time, whereas setRunUntilTime takes an absolute simulation time at which the scenario pauses. Call sites must be updated to pass an absolute time, not just renamed.
| 5.2 declaration | 5.3 declaration |
|---|---|
DtSimManager::runForDuration(double) | DtSimManager::setRunUntilTime(double) |
DtSimManager::runDurationTime() const | DtSimManager::runUntilTime() const |
DtSimManager::stopSimulationDurationTimer() | DtSimManager::stopSimulationUntilTimer() |
DtSimManager::runDurationCompleteCallback(DtTimer*) | DtSimManager::runUntilTimerCompleteCallback(DtTimer*) |
DtSimManager::processRunDurationComplete() | DtSimManager::processRunUntilComplete() |
DtSimManager::addSimulationRunDurationCallback | DtSimManager::addSimulationRunUntilCallback |
DtSimManager::removeSimulationRunDurationCallback | DtSimManager::removeSimulationRunUntilCallback |
DtSimulationServices::runForDuration(double) | DtSimulationServices::setRunUntilTime(double) |
DtSimulationServices::runDurationTime() const | DtSimulationServices::runUntilTime() const |
DtSimulationServices::stopSimulationDurationTimer() | DtSimulationServices::stopSimulationUntilTimer() |
The callback function pointer typedef was renamed with it. The signature is unchanged, so only the type name needs to be updated:
processRunUntilComplete and runUntilTimerCompleteCallback are virtual and static respectively; subclasses of DtSimManager that overrode processRunDurationComplete must rename the override or it will silently stop being called.
The timer type constant in vrfcore/timerTypes.h was renamed to match the run until feature. The numeric value is unchanged, so there is no wire or file format impact:
Code that compares a DtTimer type against DtRunDurationTimerType must use the new name.
The TDL message interface is no longer owned or exposed by the simulation manager. The following declarations were removed from DtSimManager:
The corresponding accessor was removed from DtSimulationServices:
The forward declaration of DtVrfTDLMessageInterface was removed from both headers, so code that relied on either header to declare the type must include the defining header directly. Subclasses of DtSimManager that overrode createTDLMessageInterface must remove the override. There is no replacement accessor in vrfcore; TDL messaging is now obtained from the TDL plug-in itself.
The static message callback used to distribute the random seed was removed:
It was registered internally on the simulation manager's message executive and was not intended to be registered or invoked by application code. Code that referenced it should be deleted; the random seed is now handled without an externally visible callback.
The requester list now holds DtString identifiers rather than simulation addresses:
The iterator typedefs DtFrameRateRequestersIter and DtFrameRateRequestersConstIter follow the change. Code that dereferenced an iterator and used the result as a DtSimulationAddress, for example to call siteId() or hostId(), must be reworked to use the string identifier.
The report generator now takes the destination address:
Existing call sites continue to compile because the parameter is defaulted to DtSimSendToAll, which preserves the 5.2 broadcast behavior. Subclasses that override generateReport must add the parameter to the override signature; an override that keeps the no-argument form will no longer override the base method and will not be called.
Periodic checkpointing was separated from periodic snapshots, and the method now carries both sets of values:
The second parameter was renamed from enabled to snapshots but retains its meaning, so existing arguments map directly. Supply false and 0.0 for the two new parameters to preserve the 5.2 behavior of no periodic checkpointing. Subclasses that override this method must update the override signature.
The new header vrfcore/hitZoneDamageParamsManagerInterface.h declares DtHitZoneDamageParamsManagerInterface, an abstract service that supplies hit zone damage probabilities for a detonation. It has a single pure virtual method:
hitZoneDamageParameterType names an entry in the hitZoneDamageParams.mtl file. isDirectDamage selects the direct damage probabilities when true and the collateral damage probabilities when false. The method returns false when no entry matches, in which case probabilities is left untouched.
This is a new service, not a replacement for an existing one. Applications that do not provide an implementation are unaffected; the simulation manager returns a null pointer from hitZoneDamageParamsManager() and the damage code falls back to its existing behavior.
DtSimManager gained accessors for the new service, following the same pattern as the other service accessors:
simManager.h now includes hitZoneDamageParamsManagerInterface.h directly, so the type is complete for anyone including simManager.h.
The service facade gained matching installation and access methods:
A plug-in that provides the service should call installHitZoneDamageParamsService during initialization, in the same place it installs the detonation service. Plug-ins that consume the service must check the returned pointer for null, because installation is optional.
DtCreateObjectServiceInterface and DtScenarioServiceInterface now declare defaulted virtual destructors:
Deleting an implementation through a base class pointer is now well defined. Implementations that declared their own destructor solely to work around the missing virtual destructor can remove it. Note that declaring a destructor suppresses the implicit copy and move operations, so an implementation that relied on implicit move construction of one of these base classes will now see a copy instead.
Return to VR-Forces 5.3 API Migration Guide.
[Home]