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
- Download Visual Studio 2022 Community (free)
- During installation, select “Desktop development with C++” workload
- Ensure the Windows SDK is included
Installing CMake
Installing Git
Installing vcpkg
vcpkg is the recommended way to manage dependencies on Windows.
Clone vcpkg
Open PowerShell or Command Prompt:cd C:\
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
Integrate with Visual Studio
.\vcpkg integrate install
This makes vcpkg packages available to all Visual Studio projects.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
Clone the repository
git clone https://github.com/OpenRCT2/OpenRCT2.git
cd OpenRCT2
Create a build directory
Do not build in the source directory. CMake will reject in-source builds.
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.
Build
Using CMake:cmake --build . --config Release
Or open OpenRCT2.sln in Visual Studio and build from the IDE. 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:
For console output:
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:
Build in Release mode
cmake --build . --config Release
Create distribution folder
Copy binaries and DLLs
copy Release\openrct2.exe dist\
copy Release\openrct2.com dist\
copy Release\*.dll dist\
Copy data files
xcopy /E /I ..\data dist\data
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:
Install Ninja
choco install ninja
# or
scoop install ninja
Open Visual Studio Developer Command Prompt
Search for “x64 Native Tools Command Prompt for VS 2022” in Start Menu
Configure with Ninja
cmake .. -G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
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:
- Open Visual Studio Installer
- Click “Modify” on your Visual Studio installation
- Under “Individual components”, search for “Windows SDK”
- Select the latest Windows 10 or 11 SDK
- Click “Modify” to install
Out of memory errors during build
Limit parallel builds:
cmake --build . --config Release -- /maxcpucount:2
Next Steps