Skip to main content
This guide covers building OpenRCT2 from source on Windows using Visual Studio and vcpkg.

Prerequisites

Required Software

  • Windows 7 or later (Windows 10/11 recommended)
  • Visual Studio 2022 or later with:
    • Desktop development with C++ workload
    • Windows 10/11 SDK
  • CMake 3.24 or later
  • Git for Windows
  • vcpkg (for dependencies)

Installing Visual Studio

  1. Download Visual Studio 2022 Community (free)
  2. During installation, select “Desktop development with C++” workload
  3. Ensure the Windows SDK is included

Installing CMake

choco install cmake

Installing Git

choco install git

Installing vcpkg

vcpkg is the recommended way to manage dependencies on Windows.
1

Clone vcpkg

Open PowerShell or Command Prompt:
cd C:\
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
2

Bootstrap vcpkg

.\bootstrap-vcpkg.bat
3

Integrate with Visual Studio

.\vcpkg integrate install
This makes vcpkg packages available to all Visual Studio projects.
4

Install OpenRCT2 dependencies

For 64-bit build:
.\vcpkg install sdl2:x64-windows libzip:x64-windows libpng:x64-windows zlib:x64-windows freetype:x64-windows icu:x64-windows zstd:x64-windows
For 32-bit build:
.\vcpkg install sdl2:x86-windows libzip:x86-windows libpng:x86-windows zlib:x86-windows freetype:x86-windows icu:x86-windows zstd:x64-windows
Optional dependencies:
.\vcpkg install flac:x64-windows libvorbis:x64-windows libogg:x64-windows

Building OpenRCT2

1

Clone the repository

git clone https://github.com/OpenRCT2/OpenRCT2.git
cd OpenRCT2
2

Create a build directory

mkdir build
cd build
Do not build in the source directory. CMake will reject in-source builds.
3

Configure with CMake

Using vcpkg toolchain:
cmake .. -G "Visual Studio 17 2022" -A x64 `
  -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
For 32-bit:
cmake .. -G "Visual Studio 17 2022" -A Win32 `
  -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
Replace C:/vcpkg with your actual vcpkg installation path.
4

Build

Using CMake:
cmake --build . --config Release
Or open OpenRCT2.sln in Visual Studio and build from the IDE.
5

Locate binaries

Built executables will be in:
build\Release\openrct2.exe
build\Release\openrct2.com
build\Release\openrct2-cli.exe

Build Configurations

Release Build

Optimized for performance:
cmake --build . --config Release

Debug Build

With debugging symbols:
cmake --build . --config Debug

RelWithDebInfo Build

Optimized with debug info:
cmake --build . --config RelWithDebInfo

Build Options

Headless Build (Server Only)

cmake .. -G "Visual Studio 17 2022" -A x64 `
  -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
  -DDISABLE_GUI=ON

Disabling Features

cmake .. -G "Visual Studio 17 2022" -A x64 `
  -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
  -DDISABLE_OPENGL=ON `
  -DDISABLE_HTTP=ON `
  -DDISABLE_NETWORK=ON

Building with Tests

cmake .. -G "Visual Studio 17 2022" -A x64 `
  -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
  -DWITH_TESTS=ON

cmake --build . --config Debug

# Run tests
ctest -C Debug --output-on-failure

Running OpenRCT2

After building, run from the build directory:
.\Release\openrct2.exe
For console output:
.\Release\openrct2.com
For headless server:
.\Release\openrct2-cli.exe host savegame.sv6
On first run, OpenRCT2 will search for RollerCoaster Tycoon 2 in common installation directories or ask you to locate it.

Creating a Portable Build

To create a portable installation:
1

Build in Release mode

cmake --build . --config Release
2

Create distribution folder

mkdir dist
3

Copy binaries and DLLs

copy Release\openrct2.exe dist\
copy Release\openrct2.com dist\
copy Release\*.dll dist\
4

Copy data files

xcopy /E /I ..\data dist\data
5

Copy generated assets

copy Release\g2.dat dist\data\
copy Release\fonts.dat dist\data\
copy Release\palettes.dat dist\data\
copy Release\tracks.dat dist\data\

Using Ninja (Alternative)

For faster builds, use Ninja instead of MSBuild:
1

Install Ninja

choco install ninja
# or
scoop install ninja
2

Open Visual Studio Developer Command Prompt

Search for “x64 Native Tools Command Prompt for VS 2022” in Start Menu
3

Configure with Ninja

cmake .. -G Ninja ^
  -DCMAKE_BUILD_TYPE=Release ^
  -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
4

Build

ninja

Troubleshooting

CMake cannot find vcpkg packages

Ensure you’re using the vcpkg toolchain file:
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
Verify vcpkg integration:
cd C:\vcpkg
.\vcpkg integrate install

Missing DLLs when running

Copy DLLs from vcpkg to your build directory:
# For Release builds
copy C:\vcpkg\installed\x64-windows\bin\*.dll .\Release\

# For Debug builds
copy C:\vcpkg\installed\x64-windows\debug\bin\*.dll .\Debug\
Or run from Visual Studio, which handles this automatically.

”Building in-source is not supported” error

Delete CMakeCache.txt and CMakeFiles/ from the source directory, then create a separate build directory.
cd OpenRCT2
rm -r CMakeCache.txt, CMakeFiles
mkdir build
cd build

Visual Studio version mismatch

For Visual Studio 2022:
cmake .. -G "Visual Studio 17 2022"
For Visual Studio 2019:
cmake .. -G "Visual Studio 16 2019"

Windows SDK not found

Install the Windows SDK through Visual Studio Installer:
  1. Open Visual Studio Installer
  2. Click “Modify” on your Visual Studio installation
  3. Under “Individual components”, search for “Windows SDK”
  4. Select the latest Windows 10 or 11 SDK
  5. Click “Modify” to install

Out of memory errors during build

Limit parallel builds:
cmake --build . --config Release -- /maxcpucount:2

Next Steps