Skip to content

themuffinator/OpenPrey

Repository files navigation

OpenPrey banner

License: GPL v3 Version Platform Architecture Build System

A modern, open-source engine and game-code replacement for Prey (2006)

Features | Compatibility | Quick Start | Building | Documentation | TODO | Credits


Warning

Development Notice: This project leans heavily on exploratory, agentic AI "vibe coding" for speed. If you want a traditionally engineered codebase, this isn't for you.


About

The OpenPrey Project is a minimal, Prey-focused adaptation of the current OpenQ4 codebase. The project keeps the modernization work that makes current builds practical to develop and debug, but retargets the engine, tooling, and game-library workflow around Prey (2006) and its unified game-module model.

What You Need

To use OpenPrey, you need:

  • A legitimate copy of Prey (2006)
  • OpenPrey engine binaries from this repository
  • A supported host system for the current build/package flow: Windows x64, Linux x64, or macOS arm64

Note

OpenPrey does not include commercial Prey assets. On Windows, fs_basepath auto-discovery checks a valid override first, then the current working directory, registry install entries (including App Paths and uninstall metadata), and finally known legacy install roots such as Human Head Studios/Prey, 2K Games/Prey, and Games/Prey.


Features

Core Features

  • Prey-first Runtime Layout: Unified openprey/ staging for engine overlays, game modules, GUI scripts, shaders, maps, and strings
  • Unified Game Module Model: Engine prefers game_<arch> for both SP and MP, with legacy gamex86/gamex64 aliases still accepted during migration
  • Legacy Install Discovery: Windows install detection supports CD-era registry keys, App Paths, uninstall entries, and known install roots instead of assuming Steam/GOG-only layouts
  • Official Asset Validation: Startup validation checks the required official Prey base PK4 layout before the game continues

Modernization And Tooling

  • SDL3-first Windows Backend: SDL3 is the default window/input/display backend; the legacy Win32 backend remains transitional
  • Meson + Ninja Build System: Canonical configure/build/install path with repo-local staging under .install/
  • Cross-platform Nightly Builds: GitHub Actions builds and packages Windows, Linux, and macOS artifacts from the same Meson staging flow
  • Debug-Oriented Local Workflow: .install/ for staged runtime files, .home/ for configs/logs/saves, .tmp/ for task artifacts
  • Crash Diagnostics: Windows debug builds write crash logs and minidumps into crashes/ beside the executable

Runtime And Display Improvements

  • Modern Window Modes: Windowed, borderless, desktop-native fullscreen, and exclusive fullscreen behavior are all supported
  • Monitor Selection: SDL3 builds expose r_screen, listDisplays, and listDisplayModes for multi-monitor setup
  • Staged Validation Launches: Repo-local launch workflows keep logs in .home/logs/openprey.log and avoid writing back into the staged runtime tree

Compatibility Status

This status focuses on compatibility with official Prey assets and the OpenPrey game-library pipeline, not binary interchangeability with proprietary retail DLLs.

Landed

  • Project Rebrand Completed: Meson project metadata, staged binaries, VS Code launch settings, and documentation now use OpenPrey naming
  • Prey Install Discovery Path: fs_basepath auto-detection now targets Prey registry/app-path/uninstall metadata and legacy install roots
  • Unified Game Module Loader: OpenPrey builds and stages a unified game_<arch> module under openprey/
  • Companion Repo Tooling: Sync/build tooling now targets OpenPrey-GameLibs and supports both Meson-wrapper and legacy VC-solution layouts
  • Official PK4 Layout Validation: Engine startup rejects missing or modified required base-pack layouts when fs_validateOfficialPaks 1 is enabled
  • Cross-host Meson Support: Meson source selection, dependency wiring, and nightly packaging now cover Windows, Linux, and macOS hosts

In Progress

  • Stock-asset SP/MP Smoke Validation: Default staged launch flow is still being verified across single-player and multiplayer startup cases
  • Prey Gameplay Bring-up: Active src/Prey game-library integration and runtime verification continue during the migration
  • Particle And FX Compatibility: Doom 3 / Prey-era particle behavior and dependent runtime paths still need restoration and parity checks
  • Cross-host Runtime Validation: Windows remains the deepest runtime-validation path while Linux/macOS map validation is extended

Not Yet Claimed

  • Full Campaign Completion: The project does not yet claim end-to-end single-player completion against stock assets
  • Multiplayer Parity: Multiplayer compatibility remains under active validation

Current follow-up work is tracked in TODO.md, docs-dev/release-completion.md, and docs-dev/prey-gamelibs-compatibility-plan.md.


Quick Start

Prerequisites

  • Prey (2006) installed from original media or another legitimate distribution
  • Supported build hosts: Windows x64, Linux x64, or macOS arm64
  • Build tools: Meson, Ninja, and Python 3
  • Windows compiler/toolchain: Visual Studio 2026+ recommended (MSVC 19.46+)
  • Linux compiler/toolchain: GCC or Clang plus system glew, openal, x11, xext, and xxf86vm development packages
  • macOS compiler/toolchain: Apple Clang with Homebrew glew

Note

tools/build/meson_setup.ps1 automatically syncs ../OpenPrey-GameLibs on setup, compile, and install. Clone the companion repo alongside OpenPrey, or set OPENPREY_SKIP_GAMELIBS_SYNC=1 if you intentionally want to build only from the in-repo mirror.

Installation

  1. Clone the repositories

    git clone https://github.com/themuffinator/OpenPrey.git
    git clone https://github.com/themuffinator/OpenPrey-GameLibs.git
    cd OpenPrey
  2. Build and stage OpenPrey

    Windows (PowerShell)

    # Setup the build
    powershell -ExecutionPolicy Bypass -File tools/build/meson_setup.ps1 setup --wipe builddir . --backend ninja --buildtype=debug --wrap-mode=forcefallback
    
    # Compile
    powershell -ExecutionPolicy Bypass -File tools/build/meson_setup.ps1 compile -C builddir
    
    # Stage the local runtime package
    powershell -ExecutionPolicy Bypass -File tools/build/meson_setup.ps1 install -C builddir --no-rebuild --skip-subprojects

    Linux / macOS (bash)

    # Setup the build
    bash tools/build/meson_setup.sh setup --wipe builddir . --backend ninja --buildtype=release -Dplatform_backend=sdl3
    
    # Compile
    bash tools/build/meson_setup.sh compile -C builddir
    
    # Stage the local runtime package
    bash tools/build/meson_setup.sh install -C builddir --no-rebuild --skip-subprojects
  3. Run the staged build

    Set-Location .install
    .\OpenPrey-client_x64.exe +set fs_game openprey +set fs_savepath ..\.home +set logFile 2 +set logFileName logs/openprey.log +set r_fullscreen 0

For a short single-player smoke test, append +set si_gameType singleplayer +map game/roadhouse_quick.


Building from Source

Detailed Build Instructions

Requirements

  • Meson 1.2.0 or newer
  • Ninja build system
  • Python 3
  • Windows toolchain: Visual Studio 2026 / MSVC 19.46+ recommended
  • Linux toolchain: GCC or Clang with system OpenGL/X11/OpenAL development packages
  • macOS toolchain: Apple Clang with Homebrew glew

Build Options

-Dbuild_engine=true|false         # Build OpenPrey-client_<arch> and OpenPrey-ded_<arch>
-Dbuild_games=true|false          # Build the unified game module from the synchronized mirror
-Dplatform_backend=sdl3|legacy_win32|native
-Duse_pch=true|false
-Denforce_msvc_2026=true          # Fail configure if MSVC is older than 19.46+

Build Commands

Windows (PowerShell)

# Configure
powershell -ExecutionPolicy Bypass -File tools/build/meson_setup.ps1 setup builddir . --backend ninja --buildtype=release

# Build
powershell -ExecutionPolicy Bypass -File tools/build/meson_setup.ps1 compile -C builddir

# Stage the runtime tree used for local validation
powershell -ExecutionPolicy Bypass -File tools/build/meson_setup.ps1 install -C builddir --no-rebuild --skip-subprojects

From a Developer Command Prompt

tools\build\openprey_devcmd.cmd
meson setup builddir . --backend ninja --buildtype=release
meson compile -C builddir
meson install -C builddir --no-rebuild --skip-subprojects

Linux / macOS

# Configure
bash tools/build/meson_setup.sh setup builddir . --backend ninja --buildtype=release -Dplatform_backend=sdl3

# Build
bash tools/build/meson_setup.sh compile -C builddir

# Stage the runtime tree used for local validation
bash tools/build/meson_setup.sh install -C builddir --no-rebuild --skip-subprojects

Output Files

Build directory (builddir/):

  • OpenPrey-client_x64.exe - main engine executable
  • OpenPrey-ded_x64.exe - dedicated server executable
  • openprey/game_x64.dll - unified game module
  • import libraries and PDBs may be present in local debug builds

Staging directory (.install/):

  • OpenPrey-client_x64.exe
  • OpenPrey-ded_x64.exe
  • OpenAL32.dll when a bundled Windows runtime is available
  • .install/openprey/game_x64.dll
  • .install/openprey/{glprogs,guis,maps,materials,script,strings}/

meson install creates the local runtime tree used for testing and packaging input. Release packaging strips build-only artifacts such as .pdb, .lib, .exp, and .ilk.

Nightly Packaging

GitHub nightly builds package the staged .install/ tree into:

  • openprey-<version-tag>-windows.zip

  • openprey-<version-tag>-linux.tar.xz

  • openprey-<version-tag>-macos.tar.gz

  • openprey/game_<arch>.(dll|so|dylib) stays as a loose runtime module inside the packaged openprey/ directory

  • staged overlay content is bundled into openprey/pak0.pk4

  • Linux nightlies include staged share/applications and share/icons payloads

  • macOS nightlies include an OpenPrey.app launcher bundle beside the packaged binaries

  • the workflow publishes or updates a nightly-<version-tag> GitHub release with generated notes


Game Directory Structure

OpenPrey uses a unified runtime directory layout under openprey/:

.install/
|-- OpenAL32.dll                  # optional bundled runtime on Windows
|-- OpenPrey-client_x64.exe
|-- OpenPrey-ded_x64.exe
\-- openprey/
    |-- game_x64.dll
    |-- glprogs/
    |-- guis/
    |-- maps/
    |-- materials/
    |-- script/
    \-- strings/

The engine uses the unified module model for both game modes:

  • Single-player: loads game_<arch> from openprey/
  • Multiplayer: loads the same unified game_<arch> module
  • Legacy compatibility: gamex86 / gamex64 aliases are still accepted during migration

SDK And Game Library

OpenPrey keeps SDK-derived game code in the companion OpenPrey-GameLibs repository. Canonical edits for SDK/game-library work belong there first; src/game in this repo is a synchronized mirror used by the Meson build, with additional src/Prey and src/preyengine sync paths brought in as needed for compatibility work.

Companion Workflow

  • Default companion repo location: ../OpenPrey-GameLibs
  • tools/build/meson_setup.ps1 syncs the companion repo before setup, compile, and install
  • OPENPREY_BUILD_GAMELIBS=1 triggers an additional companion build-and-stage pass during compile
  • tools/build/build_gamelibs.ps1 can consume either a Meson wrapper or the current legacy src/PREY.sln layout
  • Legacy OPENQ4_* environment variable names are still accepted as temporary migration aliases

Prey SDK License

The companion repo contains code derived from the Prey Software Development Kit and is subject to the original Human Head Studios SDK license.

The bundled SDK EULA allows non-commercial Prey modifications that run only with a legitimate copy of Prey, but it prohibits commercial exploitation and standalone redistribution of the SDK-derived code. See EULA.Development Kit.rtf in the OpenPrey-GameLibs repository for the full terms.


Project Goals

Primary Objectives

  • Deliver a minimal, clean OpenQ4-to-Prey adaptation
  • Preserve behavior expected by shipped Prey assets where practical
  • Keep single-player and multiplayer behavior aligned with Prey's unified game-library model
  • Prefer Doom 3 / Prey lineage behavior over inherited Quake 4 behavior where Prey depends on it
  • Keep runtime staging and packaging centered on a single openprey/ directory

Non-Goals

  • Shipping proprietary Prey assets
  • Reintroducing the old OpenQ4 closed-source companion-repo workflow
  • Assuming Steam/GOG-only install layouts for Prey (2006)
  • Fixing compatibility by shipping content hacks instead of repairing engine/game code

Documentation


Asset Validation

OpenPrey validates the official Prey base-pack layout at startup when fs_validateOfficialPaks 1 is enabled (default).

How it works:

  1. Engine scans the detected base/ pack set
  2. Chooses the required layout to validate against:
    • classic retail naming (pak000.pk4 ... pak004.pk4)
    • consolidated retail naming (pak_data.pk4, pak_sound.pk4, pak_en_v.pk4, pak_en_t.pk4)
  3. Refuses to continue if the required packs are missing or modified

Current checksum status:

  • Consolidated retail pack checksums are published in official-pk4-checksums.md
  • Classic retail pack names are enforced by presence, while canonical checksum capture is still being finalized

Advanced Configuration

Display And Graphics Settings

Monitor Selection

  • r_screen -1 - auto-select current display (default)
  • r_screen 0..N - force a specific monitor on SDL3 builds
  • listDisplays - list monitor indices
  • listDisplayModes [displayIndex] - list exclusive fullscreen modes for a display

Display Modes

  • r_fullscreen 0|1 - windowed vs fullscreen
  • r_fullscreenDesktop 1 - desktop-native fullscreen (default)
  • r_fullscreenDesktop 0 - exclusive fullscreen using r_mode/r_custom*
  • r_mode -2 - request native desktop resolution for fullscreen mode selection
  • r_borderless 1 - borderless window when r_fullscreen 0

Windowed Sizing

  • r_windowWidth / r_windowHeight - window size when running windowed
  • Validation workflows should force +set r_fullscreen 0
File System And Validation Settings

Path Variables

  • fs_basepath - detected Prey install root
  • fs_homepath - writable user path
  • fs_savepath - save/config/log path (defaults to fs_homepath)
  • fs_game - active game directory (openprey)
  • fs_devpath - optional developer override path used by local debug workflows

Validation

  • fs_validateOfficialPaks 1 - verify required official base packs at startup
  • Launching from .install/ keeps the staged runtime overlay on the search path while letting .home/ hold writable state

Dependencies

OpenPrey resolves engine dependencies through Meson subprojects and bundled Windows runtime assets:

Library Version Purpose
SDL3 3.4.0 Windowing, input, display management
GLEW 2.3.4 OpenGL extension loading
OpenAL Soft bundled Windows package 3D audio runtime
stb_vorbis 1.22 Ogg Vorbis decoding

Debugging And Development

Local Validation Loop

  • Launch from .install/ in windowed mode with +set r_fullscreen 0
  • Use +set fs_savepath ..\.home and +set logFileName logs/openprey.log to keep logs local to the repo
  • Inspect .home\logs\openprey.log after each short run
  • Fix warnings/errors in engine/game/parser/loader code before resorting to content-side workarounds

Build Automation

  • tools/build/meson_setup.ps1 auto-detects and initializes the Visual Studio developer environment when needed
  • compile -C builddir auto-runs setup --wipe if the build directory is missing or invalid
  • install auto-adds --skip-subprojects when omitted
  • tools/build/openprey_devcmd.cmd is available if you want a reusable MSVC developer shell

Companion Repo Integration

  • Use OPENPREY_GAMELIBS_REPO=<path> to override the companion repo location
  • Use OPENPREY_SKIP_GAMELIBS_SYNC=1 to suppress automatic mirror sync
  • Use OPENPREY_BUILD_GAMELIBS=1 to build companion game libraries during compile
  • Use OPENPREY_SKIP_GAMELIBS_BUILD=1 to skip that additional companion build step

Contributing

OpenPrey is open to contributions, but the project has a few hard constraints:

  • Keep compatibility work centered on stock Prey assets
  • Edit SDK-derived sources in OpenPrey-GameLibs first; treat src/game here as a synchronized mirror
  • Preserve the unified openprey/ runtime layout
  • Keep documentation updated when workflow, naming, or repository structure changes
  • Prefer engine/game fixes over shipping replacement assets or content hacks

License

OpenPrey is licensed under the GNU General Public License v3.0 (GPLv3).

The GPLv3 license applies to OpenPrey's engine code in this repository.

SDK-derived game-library code in OpenPrey-GameLibs remains subject to the original Prey SDK license.

Prey game assets are proprietary and are not distributed with OpenPrey.


Credits

OpenPrey builds on work from multiple projects and teams:

Core Contributors

  • themuffinator - OpenPrey development and maintenance
  • Justin Marshall - Quake4Doom baseline and related reverse-engineering work
  • Robert Backebans - RBDOOM-3-BFG modernization work that informs this ecosystem

Original Developers

  • id Software - id Tech 4 lineage
  • Raven Software - Quake 4 codebase lineage used by OpenQ4
  • Human Head Studios - Prey (2006) and the Prey SDK

Third-Party Libraries

  • Sean Barrett - stb_vorbis
  • GLEW contributors
  • OpenAL Soft contributors
  • SDL contributors

Links


Disclaimer

OpenPrey is an independent project and is not affiliated with, endorsed by, or sponsored by Human Head Studios, 2K, Bethesda, ZeniMax, id Software, or Raven Software.

You must own a legitimate copy of Prey (2006) to use this software. OpenPrey does not include any copyrighted game assets.


Use At Your Own Risk

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. OpenPrey is experimental software under active development. Use it at your own risk.