> It is recommended to create a virtual machine for this build process, although the build process can be done on your PC. VMWare/Hyper-V are recommended to run the VM due to their performance.
## Prerequisite Setup
1. Install Visual Studio 2012
- Uncheck all optional components in the installer **except "Microsoft Foundation Classes for C++"** to save space, none of them are needed for the build.
- If you encounter the error that the installer is "Blocked by your administrator", follow these steps:
1. Hold Shift and right click the `incredibuild4_0.exe` file, select "Copy as path"
2. Open Command Prompt as Administrator
3. Paste the path and press Enter
- Select to install "Incredibuild Agent", "Incredibuild Coordinator", and the extension for Visual Studio
4. Install DirectX SDK June 2010
5. Install OpenIV
6. Create X:\ drive
1. Open Command Prompt
2. Run `net use X: \\localhost\c$\<Path to working folder for build> /persistent:yes`
- ex. `net use X: \\localhost\c$\Users\abc\Desktop\GTA /persistent:yes` for working folder `C:\Users\abc\Desktop\GTA`
6. Create the folder `X:\gta5` and copy all folders from `GTAVSP.7z\GTA V Source` into it
- By the end, you should have the folders `X:\gta5\src`, `X:\gta5\script`, and `X:\gta5\tools_ng`. If the paths are different or some folders are missing, try re-extracting or moving as needed.
7. Right click the folder `X:\gta5`, select "Properties", uncheck "Read-only", click Apply then OK
8. Copy all folders in `dll_patches.zip` to `X:\gta5\tools_ng\bin`, make sure to overwrite when copying
9. Open Command Prompt as Administrator and run the following commands, then close:
- If prompted with "How do you want to open this file?", check "Always use this app to open .sln files" and click OK
2. Once the solution loads, open the dropdown menu that says "Debug" at the top, select "Configuration Manager"
3. Change "Active Solution Platform" to "x64" and close the configuration window
4. Hold Ctrl key and click all projects under "GameLibs" and "Rage", right-click and select "Properties"
5. In the "Configuration" dropdown, select "All Configurations"
6. Select `C/C++ > All options`, under "Look for options or switches", search "err" and set "Treat Warnings as Errors" to "No (/WX-)", then click "Apply" and "OK"
- For faster compiles, search "mul" and set "Multiprocessor Compilation" to "Yes (/MP)"
- If you get the error `C1060: Compiler is out of heap space` during build, come back to the above setting and turn it off
7. Right-click the "game" project and select "Properties" and do step 5 again
8. Change build the type at the top of the window from "Debug" to "BankRelease"
9. At the top of the window, select `Build > Build Solution` and wait for build to finish
10. Copy output binary to game folder
> [!NOTE]
> Building shaders and scripts can be skipped using the prebuilt files above. These steps are here to allow modding or for those who prefer to build from source as much as possible.
## Building shaders
1. Under "Shaders", right click the "shaders_rc" project and click "Build"
2. (OPTIONAL) Build low quality shaders
1. Right click the "shaders_rc" project and click "Properties"
2. Select `Configuration Properties > NMake`
3. Under "General", change all command lines from ending with `win32_40.bat` to ending with `win32_40_lq.bat`, then click "Apply" and "OK"
4. Rebuild shaders
3. Copy `X:\gta5\titleupdate\dev_ng\common` to game directory
## Building game scripts
1. Open Command Prompt
2. Run the following commands:
```batch
X:
cd X:\gta5\src\dev_ng
setenv
cd ..\..\tools_ng\bin\RageScriptEditor
ragScriptEditor
```
3. In the editor, select `File > Open Project` and open `X:\gta5\script\dev_ng\singleplayer\GTA5_SP.scproj`
-`-kbgame` - Start game with game keyboard enabled
-`-output` - Show console log of game
-`-rag` - Enable support for RAG, the internal game debugging tool
-`-ragUseOwnWindow` - Combined with `-rag` to make game run outside of RAG window
-`-DoReleaseStartup` - Start real Story Mode on launch
- Additional standard game arguments can be added as well
3. (OPTIONAL) Launch RAG with the following commands in Command Prompt
```batch
X:
cd X:\gta5\src\dev_ng
setenv
cd ..\..\tools_ng\bin\rag
rag
```
4. (OPTIONAL) Copy [Goldberg](https://gitlab.com/Mr_Goldberg/goldberg_emulator/-/jobs/4247811310/artifacts/download) patch into game directory, make sure to overwrite
5. Run `launch.bat`
## Debug Build Controls
```
Legend:
LCTRL -- Left control.
RCTRL -- Right control.
LALT - Left alt.
RALT - Right alt.
LSHIFT - Left shift
RSHIFT - Right shift.
Main keybinds:
CTRL + TAB -> Switch between game keyboards. Available are debug, marketing, game and roleplay.
Debug Keybinds:
Backtick ---> Toggle scene information.
Ins (Numpad) ---> Remove debug screen information.
Del (Numpad) ---> Creates a copy of you.
Page up (Numpad) ---> Toggle CPU information.
CTRL + Del (Numpad) ---> Creates a copy of you and sets as your main.
CTRL + Num lock (Numpad) ---> Freezes the game. (literally)