Skip to main content

Minimal example mods

The SDK package ships four complete F4SE DLL examples. They share one verified FO4VR bootstrap and consumer lifecycle, but each feature file stays small enough to read in one sitting.

These are educational starting points. Rename the plugin, request only the capabilities you keep, add an explicit user setting for stateful behavior, and retain the same generation/lease/cleanup rules.

Shared plugin shell

Every example:

  1. rejects the editor and non-VR runtimes;
  2. checks REL::Module::IsVR() and the exact Fallout4VR.exe 1.2.72.0 file version without comparing that domain to F4SEVR's loader runtime;
  3. initializes the provider with the final table extent it needs;
  4. requests an exact capability mask and rejects a partial grant;
  5. registers an owner frame callback after game data is ready;
  6. clears feature state, unregisters the callback, then unregisters the owner across session transitions.

The CMake build enforces the loader source contract before compiling and ROCK's normal test configuration builds all four DLLs.

1. Hand state monitor

Idea: a lightweight interaction telemetry mod that logs only meaningful hand and provider transitions.

Capabilities: FrameSnapshots, HandInteractionState, ProviderEvents.

The callback compares snapshot.stateSequence with its previous value. On a change it queries both hands and reports phase, target kind/form/body, and held body count. It separately drains copyProviderEventsSinceV1 through a retained sequence cursor.

This pattern can become:

  • a gesture/context HUD;
  • a compatibility recorder;
  • an accessibility state announcer;
  • a test harness that waits for a precise grab/release transition.

The important detail is that it does not log every frame. It reacts to coherent sequences and bounded event batches.

2. Weapon inspector

Idea: a read-only mod that explains the current weapon whenever its generation changes.

Capabilities: FrameSnapshots, WeaponPartObservability, WeaponComposition, PoseReadback, ScopeSightState.

On a new weaponGenerationKey, it copies composition entries, weapon-part poses, and scope state, then reports one summary. A production inspector could add evidence point clouds, emitter state, classification provenance, authored grip poses, and selected overlay labels.

This pattern can become:

  • a weapon compatibility analyzer;
  • an attachment-aware optic or emitter mod;
  • a grip-pose authoring tool;
  • a physical-control debugger.

Cache by weapon generation and composition signature, never by scene pointer.

3. Surface climber

Idea: two hands can independently grab static/keyframed world surfaces.

Capabilities: FrameSnapshots, TouchGrabTargets.

The callback publishes two short-lived wildcard FixedAnchor descriptors: one right-hand target and one left-hand target. Each has a distinct ID so the hands may resolve different bodies. The sample refreshes current generation guards, clears the scope whenever physics writes are blocked, and logs target phase transitions from copyTouchGrabStatesForScopeV1.

This pattern can become:

  • climbable walls or ladders;
  • hand-over-hand vehicle/exterior traversal;
  • grab-anywhere environmental bracing;
  • authored fixed handles mixed with wildcard surfaces.

The shipped example is deliberately always active for clarity. A real mod must add an activation rule and narrow allowedLayerMask to its intended surfaces.

4. Contact visualizer

Idea: render contact normals and a compact status label through ROCK's existing stereo debug renderer.

Capabilities: FrameSnapshots, SemanticHandContacts, PlayerColliderDescriptors, DebugOverlayPublication.

Each visual-write frame, the example copies current semantic contacts for both hands, turns each point/normal into one short colored line, counts generated player colliders, and publishes a two-frame overlay lease. It clears the publication whenever visuals are blocked or the owner stops.

This pattern can become:

  • a finger/contact calibration tool;
  • a collision health overlay;
  • a weapon/body interaction debugger;
  • an in-VR tutorial that highlights current touch affordances.

Consumer memory is copied during publication, so bounded stack arrays are valid for the call. ROCK owns rendering; the consumer owns content and lease.

Building the examples

From SDK/ROCK/examples:

cmake -S . -B build -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
-DCOMMON_LIB_F4VR_PATH="F:/path/to/CommonLibF4VR"
cmake --build build --config Release -- /m:1 /p:CL_MPCount=2

The outputs are ROCKSDKHandStateMonitor.dll, ROCKSDKWeaponInspector.dll, ROCKSDKSurfaceClimber.dll, and ROCKSDKContactVisualizer.dll. Install only a renamed/adapted plugin; the example names are not intended as a user-facing mod collection.