Enabling Hot Reload
Locate your config file
Find your
config.ini file in your OpenRCT2 user directory:- Windows:
C:\Users\YourName\Documents\OpenRCT2\config.ini - Mac:
/Users/YourName/Library/Application Support/OpenRCT2/config.ini - Linux:
$XDG_CONFIG_HOME/OpenRCT2/config.inior$HOME/.config/OpenRCT2/config.ini
Edit the configuration
Open
config.ini in a text editor and find the [plugin] section. If it doesn’t exist, create it.Set enable_hot_reloading to true:How Hot Reload Works
When hot reload is enabled:- OpenRCT2 monitors your plugin files for changes
- When you save a JavaScript file, the game detects the change
- The plugin is automatically reloaded without restarting the game
- Your changes take effect immediately
Hot reload works best with plugins that create UI windows or subscribe to events. You can close and reopen custom windows to see your changes instantly.
Demo Video
A demonstration of hot reload in action can be found on YouTube: OpenRCT2 plugin hot-reload demo The video shows:- Writing code in Visual Studio Code
- Saving the file
- Seeing changes immediately reflected in OpenRCT2
- Opening and closing custom windows to preview updates
Development Workflow
With hot reload enabled, your development workflow becomes much faster:Set up your environment
- Enable hot reload in
config.ini - Open your park in OpenRCT2
- Open your plugin file in your code editor (VS Code recommended)
Example: Developing a Custom Window
Here’s a typical workflow when developing a custom UI window:- Open the window using the menu item
- Make changes to the window layout or content
- Save the file
- Close the window in OpenRCT2
- Reopen it from the menu
- See your changes instantly!
Best Practices
Clean Up Resources
When your plugin is reloaded, the old instance is disposed. Make sure to clean up any resources:Use Window Classifications
Give your custom windows unique classifications to prevent duplicates:Separate Development and Production
You might want different behavior during development:Limitations
Syntax Errors
If your plugin has syntax errors, hot reload will fail and an error will be logged to the console. Fix the syntax error and save again.State Persistence
When a plugin is reloaded:- All variables are reset
- Event subscriptions are disposed and re-created
- Windows remain open but need to be manually closed and reopened to see changes
Persisting Data Across Reloads
TypeScript and Build Tools
If you’re using TypeScript or build tools, you can set up automatic compilation on file save:TypeScript Watch Mode
Webpack Watch Mode
If using webpack for bundling:VS Code Task
Create a.vscode/tasks.json file:
Ctrl+Shift+B (or Cmd+Shift+B on Mac).
Troubleshooting
Hot Reload Not Working
- Check config.ini: Ensure
enable_hot_reloading = trueunder[plugin] - Restart OpenRCT2: Config changes require a restart
- Check file location: Plugin must be in the
plugindirectory - Check file extension: File must end with
.js - Check console: Look for error messages in the console
Changes Not Appearing
- Close and reopen windows: Custom windows need to be reopened to show changes
- Check syntax: Syntax errors prevent reloading
- Check file saved: Ensure you actually saved the file
- Check build output: If using TypeScript/webpack, ensure compilation succeeded
Multiple Reloads
If the plugin reloads multiple times:- Your build tool might be writing the file multiple times
- Try adding a small delay in your build process
- Check that you don’t have multiple watchers running
Complete Example
Here’s a complete example showing hot reload in action:- Change the window layout and see it immediately
- Modify button text or colors
- Add new widgets
- Change the counter logic

