Skip to content

Visor lifecycle

Bogdan T. edited this page May 23, 2025 · 31 revisions

Visor Play Modes

Visor supports 3 play modes. Each mode controls whether the VR session is initialized and when VR is rendered

VR_ENABLED (default)

  • Behavior
    • VR session is initialized on startup, and is playable from main menu
    • Require VR runtime & hardware

VR_WORLD_ONLY

  • Behavior
    • VR session is initialized same as VR_ENABLED, but is playable only in world
    • Require VR runtime & hardware

VR_DISABLED

  • Behavior
    • VR session never ininitialize
    • Does not require VR runtime & hardware
    • Modifies only rendering of remote VR players (if connected to server supporting Visor through mod or plugin)

VR Lifecycle

Three Boolean flags control runtime behavior:

Flag true means… false means…
VR_INITIALIZED VR session has been successfully created and is ready for rendering No VR session is available; VR cannot render
VR_ACTIVE VR is rendering Rendering falls back to vanilla
VR_FOCUSED VR is fully functional In-game menu overlay is shown and non-essential VR visuals are disabled to save performance.

Runtime

State is updated at the beginning of mc game loop

  1. Initialization

    • On startup, after mc resources are loaded, attempt to initialize VR.
    • If successful, set VR_INITIALIZED = true.
  2. Activation

    • When VR_INITIALIZED == true and HMD has been put on, set VR_ACTIVE = true.
    • If HMD has been taken off while on server not supporting vanilla, the VR_ACTIVE stays true
    • If in VR_WORLD_ONLY play mode, set VR_ACTIVE = true only in world
  3. Focus

    • While VR_ACTIVE == true, monitor for system/menu overlays.
    • If the user opens any non-game UI (pause menu, Steam overlay, etc.), set VR_FOCUSED = false.
    • When the game view regains focus, set VR_FOCUSED = true.
  4. When VR has thrown an error

    • If the player is in-world, leaves it
    • VR session is destroyed, set VR_INITIALIZED = false
    • VR Play Mode changes to VR_DISABLED
    • Shows VR error screen

Clone this wiki locally