GTA V Development w/ RPH

Getting started with modding can be complicated. Let’s take a look at the GTA V RPH Community and see what it takes to get started!

GTA V Development w/ RPH
Hello World on when RPH loads our plugin

RPH stands for Rage Plugin Hook, a toolkit for hooking into the Rage Game Engine, allowing you to inject and execute code and allowing you to effectively mod the game with very little overhead. The platform has had a number of releases to expose and document native function calls, and is active development by a small community of developers.

I would not say it is the most active community out there, but they have a good number of dedicated and interested fans looking to extend and build upon the platform.

This is the first platform I have felt compelled to contribute to in 2019.

Getting Started with RPH

First let’s set up RPH

  1. Install GTA V
  2. Duplicate this directory so you can diff or swap in the vanilla files it at will
  3. Download RPH
  4. Unzip the contents of the RPH zip into the GTA V directory, allowing it to overwrite files

At this point you are ready to go! Run the RAGEPluginHook.exe file and follow the initial configuration of RPH. Once finished it will kick off the GTA V application, hook itself in and ultimately kick off story mode for you with RPH alerting you to its presence installed. Confirm this by hitting F4 and running the Help command.

Once you are inside the game feel free to nose around. Look a the commands that are exposed by default, for instance. Once you are done we can dive into understanding the plugin interfaces.

Go ahead, I’ll be here when you get back! =)

RPH Plugins

Of course, the first bar is going to be a Hello World plugin, with RPH. Our goal is to have RPH recognize the plugin, load it and execute its code.

Let’s get started.

Create The Project

  1. Click File > New > Project
  2. Select Class Library (.NET Framework)
  3. Give it a name
  4. Select a folder to create the project in
  5. Select .NET Framework 4.6 as the target

Before going further, build and confirm that your environment results in a reasonable output. By default, after the initial build you should see a file in the project directory under \bin\Debug\RPHDemo.dll along side a file of the same name, but with a pdb extension. You may want to read about the differences between debug and release builds, but as the name implies — release builds are for releasing.

Okay. We have a library!

Our next step is going to be adding the reference to the RPH SDK library. In your Solution Explorer, your project includes a list of its references. Right click it and click Add Reference. A window should pop up looking like this

Reference Manager highlighting Browse Button in MSVS 2017

Click on the button Browse button at the bottom of the window, and then navigate to your GTA V directory, and then into the SDK directory. In my case this is F:\Games\steamapps\common\Grand Theft Auto V\SDK

Solution Explorer view of the Demo Project

In this directory is the RagePluginHookSDK.dll which should be imported into our project. Select it and click Add. You should now see the file referenced in your Solution Explorer, as in the screenshot to the left. At this point you have access to the API exposed by RPH to build a functional plugin.

Hello GTA World

RPH loads plugins from the /Plugins in your GTA V directory. Go ahead and drop your dll into that folder and start the RPH exe. Once the application is initialized and story mode loads, hit F4 and type in LoadPlugin and you should see an auto complete option present itself, referencing your DLL. Select it, hit Tab and then hit Enter. The game will lock up for a moment, as the hook loads your dll into memory, at which point it will fail and point out that you are missing a Plugin Attribute.

Loading plugin from path: F:\Games\steamapps\common\Grand Theft Auto V\Plugins\RPHDemo.dll
<UNLOADED PLUGIN>: Initializing input system
<UNLOADED PLUGIN>: Initializing game console
<UNLOADED PLUGIN>: Initializing forms manager
ERROR: Could not load plugin from “F:\Games\steamapps\common\Grand Theft Auto V\Plugins\RPHDemo.dll”. Assembly RPHDemo.dll (RPHDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null) does not have the required Plugin attribute.
Parameter name: assemblyPath

Each time a plugin is loaded, RPH looks for a specific attribute to be defined to allow it to identify your plugin, and it also allows you to name and describe it.

Let’s add it now

Build the DLL, copy it over and load the plugin again. Note that you do not need to restart GTA V to load the plugin, just open the drop down and reload the file.

Loading plugin from path: F:\Games\steamapps\common\Grand Theft Auto V\Plugins\RPHDemo.dll
<UNLOADED PLUGIN>: Initializing input system
<UNLOADED PLUGIN>: Initializing game console
<UNLOADED PLUGIN>: Initializing forms manager
ERROR: Could not load plugin from “F:\Games\steamapps\common\Grand Theft Auto V\Plugins\RPHDemo.dll”. Plugin RPHDemo in assembly RPHDemo.dll (RPHDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null) does not have a suitable entry point.
Parameter name: assemblyPath

Once again it has failed. We are missing an entry point, and we are again in luck about the ease of this platform, as the entry point is the same as we are already likely used to

As before, build our dll, copy it over and run the load command again.

Loading plugin from path: F:\Games\steamapps\common\Grand Theft Auto V\Plugins\RPHDemo.dll
<UNLOADED PLUGIN>: Initializing input system
<UNLOADED PLUGIN>: Initializing game console
<UNLOADED PLUGIN>: Initializing forms manager
Plugin “RPHDemo” was loaded from “RPHDemo.dll”.

Voila! We have a plugin being loaded!

Well, sort of. Let’s add one more component to this — outputting a message in game. Rage exposes an interface that allows us to drop a message onto the screen DisplaySubtitle, accepting a string and it will format it appropriately for our player.

This is a good place for you to take a moment and validate that the above all works. As long as you have made it through this far you are probably good to dive into more involved tasks, like modding LSPDFR.

For now, if you find this article too complicated or would like for me to expand on the processes further please leave a comment or hit me up on one of my many social outreach platforms.