Egg Repository

Pterodactyl Community Egg Repository

OpenRCT2

OpenRCT2 is an open-source re-implementation of RollerCoaster Tycoon 2 (RCT2), expanding the game with new features, fixing bugs and raising game limits.

Read Me

OpenRCT2

Authors / Contributors


Red-Thirten

💻

parkervcp

💻 💡

janisozaur

💻 💡

Game Description

From OpenRCT2's Website:

OpenRCT2 is an open-source re-implementation of RollerCoaster Tycoon 2 (RCT2), expanding the game with new features, fixing bugs and raising game limits. The gameplay revolves around building and maintaining an amusement park containing attractions, shops and facilities. The player must try to make a profit and maintain a good park reputation whilst keeping the guests happy. OpenRCT2 allows for both scenario and sandbox play. Scenarios require the player to complete a certain objective in a set time limit whilst sandbox allows the player to build a more flexible park with optionally no restrictions or finance.


Server Ports

PortDefault (TCP)
Game11753

Installation/System Requirements

Minimum
Processorx86/64 (*multiarch may be supported for develop builds, but has not been tested)
RAM256-512 MiB (depends on # of clients & park size)
Storage110 MB (may require more if building from source)
RCT2 FilesNot required

Save Files

Save files and autosaves are located in this directory:

/home/container/ServerData/save/

If the "Load Latest Autosave" startup variable is enabled, and the autosave/ directory exists, the server will load the latest autosave instead of the specified Save File.


Console Commands

Until support for console commands to interactive programs gets added to Pterodactyl, entering commands via the panel's console do nothing (reference issue pterodactyl/panel#3712).


Becoming an Admin on the Server

Unfortunately, because console commands currently do not register, becoming the first admin on the server takes some steps, listed below:

  1. Ensure the "Log Server Actions" startup variable is set to "true".
  2. Start the server and join it with the client you want to make an admin.
  3. Open ServerData/serverlogs/<Server Name>/<Latest Date>.txt and copy the SHA1 hash next to your client's username (note the username as well).
  4. Then, open ServerData/users.json. Paste the hash into the "hash" value, change the "name" value to your client's username, and save the file.
  5. Reboot the server, re-join it, and you should be an admin!

After becoming an admin, you can use the in-game users management window to add additional admins (or groups) more easily if you wish.


Known Issues

The following are known issues that are unique to running OpenRCT2 on Pterodactyl, but likely can only be fixed by further development/updates from OpenRCT2.

  • Configuring a password on the server disallows non-admin clients from entering in a password in their client to connect; it just disconnects them. Admin clients can still join normally. (reference issue OpenRCT2/OpenRCT2#16396)
  • You may rarely run into the server crashing on start due to a "Floating point exception(core dumped)" error. If this occurs to you, please help with OpenRCT2 development by doing the following:
    1. Add the following to the beginning of your server's startup command: SEGFAULT_SIGNALS=fpe LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
    2. Start the server. If it boots normally, nothing extra will print. If it crashes, it will print a stack trace to the console.
    3. If a crash occurs, copy the entire stack trace, and save it to a log sharing website (like Hastebin).
    4. Open a new Bug Report Issue with OpenRCT2 and share your logs with them.
Yolks
NameTag
ghcr.io/ptero-eggs/yolks:debianghcr.io/ptero-eggs/yolks:debian
Variables and Startup

Startup Command

./OpenRCT2/openrct2-cli --version && ./OpenRCT2/openrct2-cli host $(if {{LOAD_AUTOSAVE}} && [ -d ServerData/save/autosave/ ]; then find ServerData/save/autosave/ | sort -r | head -1; else echo "{{SAVE_URI}}"; fi) --port {{SERVER_PORT}} --user-data-path /home/container/ServerData/

Variables

Save File

Save file (.sv4 / .sv6 / .park) to load. Can be a file path or can be a webhosted file URL. An existing save file must be specified; the server cannot generate a new scenario/save from scratch.

Environment Variable: SAVE_URI
Default Value: ServerData/save/save.park
User Viewable:
User Editable:
Load Latest Autosave

Will load the latest autosave (assuming one is present) *instead* of the Save File when the server is started. Useful for loading the latest progress of a park after a reboot. Set to "false" to "lock" progress of the park, and always load the original Save File on start up.

Environment Variable: LOAD_AUTOSAVE
Default Value: true
User Viewable:
User Editable:
Autosave Interval

0 = Every 1 min, 1 = Every 5 min, 2 = Every 15 min, 3 = Every 30 min, 4 = Every hour, 5 = Never

Environment Variable: AUTOSAVE_INTERVAL
Default Value: 1
User Viewable:
User Editable:
Autosaves To Keep

Number of autosaves to keep before rolling over and deleting the oldest one. Set to 0 to disable autosaving.

Environment Variable: AUTOSAVE_AMOUNT
Default Value: 10
User Viewable:
User Editable:
Max Players

Maximum players allowed to connect to the server.

Environment Variable: MAX_PLAYERS
Default Value: 16
User Viewable:
User Editable:
Server Password

Password requested by the server for clients to connect. Admins do not have to enter password to join. Leave empty for no password.

Environment Variable: SERVER_PASSWORD
Default Value:
User Viewable:
User Editable:
Advertise Server

If set to "false", the server will not be advertised in the master server list, and clients must manually connect.

Environment Variable: SERVER_ADVERTISE
Default Value: true
User Viewable:
User Editable:
Pause Server If No Clients

Set to "true" to have the server pause simulation if no clients are on the server.

Environment Variable: PAUSE_NO_CLIENTS
Default Value: false
User Viewable:
User Editable:
Server Name

Name of the server that appears in the server list.

Environment Variable: SERVER_NAME
Default Value:
User Viewable:
User Editable:
Server Description

Description of the server that appears when hovering over the server in the server list.

Environment Variable: SERVER_DESCRIPTION
Default Value:
User Viewable:
User Editable:
Server Player Name

The server appears as a player in the player list. This is the name it will have.

Environment Variable: SERVER_PLAYER_NAME
Default Value: Server
User Viewable:
User Editable:
Server Greeting

The "Message of the Day" that gets sent to all clients who join.

Environment Variable: SERVER_GREETING
Default Value:
User Viewable:
User Editable:
Provider Name

Server provider name that appears in server information window.

Environment Variable: PROVIDER_NAME
Default Value:
User Viewable:
User Editable:
Server Provider E-Mail

Server provider e-mail that appears in server information window.

Environment Variable: PROVIDER_EMAIL
Default Value:
User Viewable:
User Editable:
Server Provider Website

Server provider website that appears in server information window.

Environment Variable: PROVIDER_WEBSITE
Default Value:
User Viewable:
User Editable:
Log Chat

Set to "true" if you would like in-game chat logged to file in Data/chatlogs.

Environment Variable: LOG_CHAT
Default Value: false
User Viewable:
User Editable:
Log Server Actions

Set to "true" if you would like in-game actions logged to file in Data/serverlogs.

Environment Variable: LOG_SERVER_ACTIONS
Default Value: false
User Viewable:
User Editable:
OpenRCT2 Version

The release tag (version) of OpenRCT2 to download and install from their official Github (ie. "v0.3.5.1"). Use "latest" to download the latest release, or "develop" to build from the latest source (takes longer to install but is the most up to date).

Environment Variable: VERSION
Default Value: latest
User Viewable:
User Editable:
[Advanced] Library Path

What path to load libraries from for release binaries. Rarely needs to be changed.

Environment Variable: LD_LIBRARY_PATH
Default Value: ./OpenRCT2/lib
User Viewable:
User Editable:
Install Script
#!/bin/bash

## File: Pterodactyl OpenRCT2 Egg - egg-openrct2.json
## Authors: David Wolfe (Red-Thirten), ptero-eggs
## Date: 2022/06/28
## License: MIT License

GITHUB_PACKAGE="OpenRCT2/OpenRCT2"
MATCH="linux-x86_64.AppImage"
DEFAULT_SAVE="https://raw.githubusercontent.com/ptero-eggs/game-eggs/main/openrct2/save.park"

## OpenRCT2 Install
apt -y update
[ ! -d /mnt/server ] && mkdir /mnt/server
cd /mnt/server
# Remove existing installation if present
[ -d OpenRCT2 ] && rm -rf OpenRCT2
# Setup OpenRCT2 directory
mkdir -p OpenRCT2/data
# Setup temp directory for building and move to it
[ -d temp ] && rm -rf temp
mkdir temp && cd temp

# Determine if installing from source or from release
if [ "${VERSION}" == "develop" ]; then
    # Get required packages
    apt -y install curl git make cmake gcc build-essential libicu-dev pkg-config libcurl4-openssl-dev libcrypto++-dev libpng-dev libssl-dev libzip-dev duktape-dev nlohmann-json3-dev
    echo -e "\nInstalling/Updating OpenRCT2 from source...\n"
    
    # Clone the branch and check if successful
    git clone --branch "${VERSION}" https://github.com/${GITHUB_PACKAGE}
    if [ ! -d OpenRCT2 ]; then
        echo -e "\nFailed to clone \"${VERSION}\" branch from https://github.com/${GITHUB_PACKAGE}\n"
        exit 1
    fi
    
    cd OpenRCT2
    mkdir build && cd build
    # Prepare CMake files for a lightweight and CLI-only build of OpenRCT2, using the appropriate flags
    cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DPORTABLE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_FLAGS="-g -gz" -DDISABLE_TTF=ON -DDISABLE_GOOGLE_BENCHMARK=ON -DDISABLE_DISCORD_RPC=ON -DDISABLE_GUI=ON
    echo -e "\nBuilding OpenRCT2 package from source...\n\tThis process can take quite some time. Grab a coffee :)\n"
    # Build OpenRCT2
    DESTDIR=. make install
    # Check if build was successful
    if [ ! -d usr/local ]; then
        echo -e "\nFailed to successfully build OpenRCT2!\n"
        exit 1
    fi
    
    # Make executable-ready package by moving compiled files to the correct locations
    cd usr/local
    mv bin/* /mnt/server/OpenRCT2/
    mv share/openrct2/* share/openrct2-cli/* /mnt/server/OpenRCT2/data/
    mv share/doc /mnt/server/OpenRCT2/
    echo -e "\nBuild of OpenRCT2 package complete!"
else
    # Get required packages
    apt install -y curl jq
    echo -e "\nInstalling/Updating OpenRCT2 from release tag \"${VERSION}\"...\n"
    
    # This is a simple script to use the GitHub API for release versions.
    # This requires the egg has a variable for GITHUB_PACKAGE, VERSION and MATCH (MATCH is to match the filename in some way).
    # Get release info and download links
    LATEST_JSON=$(curl --silent "https://api.github.com/repos/${GITHUB_PACKAGE}/releases/latest")
    RELEASES=$(curl --silent "https://api.github.com/repos/${GITHUB_PACKAGE}/releases")
    if [ -z "${VERSION}" ] || [ "${VERSION}" == "latest" ]; then
        DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})
    else
        VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .tag_name')
        if [ "${VERSION}" == "${VERSION_CHECK}" ]; then
            DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION "${VERSION}" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})
        else
            DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)
        fi
    fi
    # Download the release and check if successful
    curl -L ${DOWNLOAD_URL} -o OpenRCT2.AppImage
    if [ ! -f OpenRCT2.AppImage ]; then
        echo -e "\nFailed to download release: ${DOWNLOAD_URL}\n"
        exit 1
    fi
    
    chmod +x OpenRCT2.AppImage
    # Extract AppImage and check if successful
    echo -e "Extracting AppImage files..."
    ./OpenRCT2.AppImage --appimage-extract
    if [ ! -d squashfs-root/usr ]; then
        echo -e "\nFailed to extract AppImage!\n\t(Is the `MATCH` variable set to download an AppImage?)\n"
        exit 1
    fi
    
    # Move needed files to correct directories
    cd squashfs-root/usr
    mv lib bin/openrct2-cli /mnt/server/OpenRCT2/
    mv share/openrct2/* /mnt/server/OpenRCT2/data/
    mkdir /mnt/server/OpenRCT2/doc && mv share/doc/openrct2 $_
    echo -e "\nDownload/Update of OpenRCT2 release successful!"
fi

cd /mnt/server
rm -rf temp # Clean up temp building directory

## OpenRCT2 Setup
# Setup ServerData/save directory
[ ! -d ServerData/save ] && mkdir -p ServerData/save
cd ServerData/save
# Download default save.park if missing
if [ ! -f save.park ]; then
    echo -e "Downloading default save.park file from ${DEFAULT_SAVE}"
    curl -sSLO ${DEFAULT_SAVE}
fi

echo -e "\nOpenRCT2 Successfully Installed!"
Installation Imagedebian:bullseye-slimInstallation Entrypoint/bin/bash