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

Note: OpenRCT2 only recently (Jan. 2022) updated to support non-interactive Docker environments, and development is ongoing to improve it. Please understand future updates may be unstable, or this Egg may update in the future to accommodate changes.


Authors / Contributors


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

Port Default (TCP)
Game 11753

Installation/System Requirements

Minimum
Processor x86/64 (*multiarch may be supported for develop builds, but has not been tested)
RAM 256-512 MiB (depends on # of clients & park size)
Storage 110 MB (may require more if building from source)
RCT2 Files Not 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
NameDescriptionEnvironment VariableDefault ValueUser ViewableUser Editable
Save FileSave 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.SAVE_URIServerData/save/save.parkYesYes
Load Latest AutosaveWill 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.LOAD_AUTOSAVEtrueYesYes
Autosave Interval0 = Every 1 min, 1 = Every 5 min, 2 = Every 15 min, 3 = Every 30 min, 4 = Every hour, 5 = NeverAUTOSAVE_INTERVAL1YesYes
Autosaves To KeepNumber of autosaves to keep before rolling over and deleting the oldest one. Set to 0 to disable autosaving.AUTOSAVE_AMOUNT10YesYes
Max PlayersMaximum players allowed to connect to the server.MAX_PLAYERS16YesYes
Server PasswordPassword requested by the server for clients to connect. Admins do not have to enter password to join. Leave empty for no password.SERVER_PASSWORDYesYes
Advertise ServerIf set to "false", the server will not be advertised in the master server list, and clients must manually connect.SERVER_ADVERTISEtrueYesYes
Pause Server If No ClientsSet to "true" to have the server pause simulation if no clients are on the server.PAUSE_NO_CLIENTSfalseYesYes
Server NameName of the server that appears in the server list.SERVER_NAMEYesYes
Server DescriptionDescription of the server that appears when hovering over the server in the server list.SERVER_DESCRIPTIONYesYes
Server Player NameThe server appears as a player in the player list. This is the name it will have.SERVER_PLAYER_NAMEServerYesYes
Server GreetingThe "Message of the Day" that gets sent to all clients who join.SERVER_GREETINGYesYes
Provider NameServer provider name that appears in server information window.PROVIDER_NAMEYesYes
Server Provider E-MailServer provider e-mail that appears in server information window.PROVIDER_EMAILYesYes
Server Provider WebsiteServer provider website that appears in server information window.PROVIDER_WEBSITEYesYes
Log ChatSet to "true" if you would like in-game chat logged to file in Data/chatlogs.LOG_CHATfalseYesYes
Log Server ActionsSet to "true" if you would like in-game actions logged to file in Data/serverlogs.LOG_SERVER_ACTIONSfalseYesYes
OpenRCT2 VersionThe 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).VERSIONlatestYesYes
[Advanced] Library PathWhat path to load libraries from for release binaries. Rarely needs to be changed.LD_LIBRARY_PATH./OpenRCT2/libNoNo
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!"