A simple and minimal template for OpenRCT2 plugins using Typescript. Supports hot reload, minification and external packages!
Simple OpenRCT2 plugin template with Typescript
A simple and minimal template for OpenRCT2 plugins, using Typescript, without any unnecessary extra's.
- Automatic plugin reload in OpenRCT2 (hot reload);
- Out of the box minification to improve file sizes;
- Support for external NPM packages (like FlexUI).
How to start
- Install latest version of Node and make sure to include NPM and enable the "Add to PATH" option during installation.
- Use the green "Use this template" button in the top right corner of this page, or download the project to a location of your choice on your PC.
- Open a terminal or command prompt.
cdto change your current directory to the root folder of this project.
npm installto install the project's dependencies.
openrct2.d.tsTypeScript API declaration file in OpenRCT2 files. copy it to
- This file can usually be found in the OpenRCT2 installation directory.
- Alternatively you can download the file from Github here.
- Another option is to make a symbolic link instead of copying the file, which will keep the file up to date whenever you install new versions of OpenRCT2.
./src/plugin.ts, change the name and author of the plugin to your liking.
./rollup.config.js, change the filename of the outputted plugin.
The template comes with several terminal commands to make developing plugins easier.
npm run build
Creates a release build of your plugin. This version is optimized for sharing with others, using Terser to make the file as small as possible. By default, the plugin will be outputted to
npm run build:dev
npm start or
npm run start
Will start a script that will automatically run
These output paths can be changed in
rollup.config.js. In this file you can also change the outputted filename of the plugin.
Access game logs
When your plugin is not loading properly, it may be useful to be able to read the logs of the game to see if there are any errors. Furthermore, if you use the
console.log function, the resulting logs can be read here as well.
- Navigate to the folder where OpenRCT2 is installed.
- Launch the
openrct2.comfile located there (the MS-DOS application).
- If file extensions are hidden, make sure to enable them.
- Launch a terminal or another command-line prompt.
- Using the
cdcommand, navigate to the folder where OpenRCT2 is installed.
open OpenRCT2.app/Contents/MacOS/OpenRCT2to launch OpenRCT2 with logging enabled.
This project supports the OpenRCT2 hot reload feature for development.
- Navigate to your OpenRCT2 user directory and open the
- Enable hot reload by setting
enable_hot_reloading = truein
npm startin the directory of this project to start the hot reload server.
- Start the OpenRCT2 and load a save or start a new game.
- Each time you save any of the files in
./src/, the server will compile
./src/registerPlugin.tsand place compiled plugin file inside your local OpenRCT2 plugin directory.
- OpenRCT2 will notice file changes and it will reload the plugin.
OpenRCT2 installation directory
- Windows: usually
C:/Users//Documents/OpenRCT2/bin/when using the launcher or
C:/Program Files/OpenRCT2/when an installer was used.
- MacOS: the folder where the
OpenRCT2.appapplication file was placed.
OpenRCT2 user directory
- Windows: usually
- MacOS: usually
/Users//Library/Application Support/OpenRCT2/. Note that
Libraryis a hidden folder in your user directory, so by default it will not show up in Finder.