8000 GitHub - keyou91/l4d2vr: Left 4 Dead 2 VR mod · GitHub
[go: up one dir, main page]

Skip to content
keyou91Public
forked from sd805/l4d2vr

About

Left 4 Dead 2 VR mod

Resources

Stars

94 stars

Watchers

4 watching

Forks

 
 

Repository files navigation

L4D2 VR Prototype

Use this mod at your own risk of getting VAC banned.
Use the -insecure launch option to help protect yourself. (Also contains lots of flashing lights)

Video demo

image

About updates

It's best to subscribe to this mod directly on the Workshop to avoid missing updates.
Click here to go to L4D2VR's Workshop page

Things that work

Things that need fixing

  • Interactions and throwables require you to aim with your face. (Except for VR-only servers)

How to play multiplayer

  • You can join any server to play, but if the server wasn't created by VR, you will only have some VR-exclusive features.
  • Versus works, but it's barely been tested.

How to use

  1. Download L4D2VR.zip and extract the files to your Left 4 Dead 2 installation directory at: steamapps/common/Left 4 Dead 2
    • You can also access the installation directory by right-clicking Left 4 Dead 2 in Steam and going to: Manage > Browse local files
  2. Launch SteamVR, then launch Left 4 Dead 2 with these launch options:
    -heapsize 524288 -processheap -high -novid -windowed
    • If you use a desktop client resolution of 2k or higher, add -bigfonts to the launch options to make in-game text larger; otherwise, the text on the HUD will be very small.
  3. Join or create your campaign and enjoy the game.
  4. To recenter the camera height, press down on the left stick. To see the HUD, aim the left controller up or down.

VR Config Menu

  1. Start the game and get to the level.
  2. Press the left controller Y button to open the pause menu.
  3. The VR Config button will appear at the top right of the pause menu.
  4. Click to open the L4D2VR Config Panel.
  5. Change the settings and press the Save button to save, or press the Reload button to undo all changes.

ReShade

  1. Download ReShade.
  2. Select the rendering API Left 4 Dead 2 uses: Vulkan + OpenXR.

Optional: Select effects to install: VRToolkit by retroluxfilm.

Troubleshooting

If the game isn't loading in VR:

If the game shows "Failed to create D3D device!":

  • L4D2VR uses a custom d3d9.dll based on DXVK. Even though the error says D3D, the failure is often the Vulkan backend failing to initialize.
  • Update the GPU driver from NVIDIA, AMD, or Intel. Windows Update drivers are often too old for DXVK 2.x.
  • Make sure the GPU and driver support Vulkan 1.3. Very old GPUs and some virtual/remote desktop display adapters will not work.
  • Do not launch the Steam "Vulkan" launch option and do not add -vulkan. Launch the normal DirectX 9 game with the L4D2VR files installed.
  • Remove forced display launch options such as -w, -h, -fullscreen, or unusual refresh-rate settings, then try windowed/default video settings.
  • Check left4dead2_d3d9.log next to left4dead2.exe; lines such as "No adapters found" or "A Vulkan 1.3 capable driver is required" indicate a driver/GPU support problem.

If the game is stuttering:

  • Steam Settings > Downloads > Shader Pre-Caching > Allow background processing of Vulkan shaders.

DXVK async compilation and low-latency frame pacing

The bundled DXVK 2.6.1 includes a source port from DXVK-GPLALL 2.6.1-6:

  • Asynchronous graphics-pipeline compilation is enabled by default. Set DXVK_ASYNC=0, or dxvk.enableAsync = False in dxvk.conf, to disable it if a newly encountered shader causes temporary missing draws or other visual problems.
  • GPL/Async state-cache integration is enabled by default. It can be disabled with DXVK_GPLASYNCCACHE=0 or dxvk.gplAsyncCache = False.
  • Low-latency frame pacing is enabled by default. Select max-frame-latency, low-latency, or min-latency with DXVK_FRAME_PACE, or the matching dxvk.framePace value. Fine tuning is available through DXVK_LOW_LATENCY_OFFSET and DXVK_LOW_LATENCY_ALLOW_CPU_FRAMES_OVERLAP; see dxvk_new/dxvk.conf.
  • A per-game dxvk.conf next to left4dead2.exe takes priority over the optional global %APPDATA%/dxvk.conf.

The frame pacer controls DXVK's D3D9 CPU/GPU and desktop-present scheduling. It complements, but does not replace, SteamVR compositor timing or reprojection. Async compilation originates from work by jomihaka and Sporif, GPL/Async integration from Ph42oN, and low-latency frame pacing from netborg-afps.

If the game is crashing:

  • Try lowering the game's video settings.
  • Disabling all add-ons, then verifying integrity of game files:
    • Steam > Left 4 Dead 2 > Properties > Installed Files > Verify integrity of game files.
  • Re-installing the game.

How to disable it

If you want to return to normal game mode with no VR, there are two methods:

  • Method 1: Add the launch option: -nohmd.
  • Method 2: Find d3d9.dll in the game root directory and rename it or move it somewhere else. After launching the game, open the console and enter crosshair 1 to enable the crosshair again, since L4D2VR disables it.
    I still recommend keeping d3d9.dll, because it can also be used as DXVK for non-VR mode.

Build instructions

  1. git clone --recurse-submodules https://github.com/keyou91/l4d2vr.git
  2. Initialize submodules:
    git submodule update --init --recursive
  3. Install DirectX SDK: request DirectX Headers and Libs
  4. Run the fixed build script (locks target to Release|x86):
    .\build_release_x86.ps1
    or:
    build_release_x86.cmd
  5. (Optional/manual) Open l4d2vr.sln and build Release|x86.

Note: After building, it will attempt to copy the new d3d9.dll to steamapps/common/Left 4 Dead 2. The pose relay is produced as Release/l4d2vr_pose_server.dll; copy it and L4D2VR/l4d2vr_pose_server.vdf to the server's left4dead2/addons directory.

Dev note: VTable lookup

For quick vtable inspection, use Asherkin's VTable Dumper. It can be used for server.dll-side symbols and also for engine.dll targets (drop the binary and search symbol names like bob, viewmodel, etc.).

Utilizes code from

About

Left 4 Dead 2 VR mod

Resources

Stars

94 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages

0