Codebase analysis · CoreStory V3

OpenRCT2

An open-source re-implementation of the theme park simulation game RollerCoaster Tycoon 2, written in C++. It models park finances, rides, guests and staff. Maintained by the OpenRCT2 project.

Maintained by
the OpenRCT2 project
License
GPL-3.0
Commit analyzed
53bbc400e28be44d3c2e56fa514d5f65b61a64d4
Rules extracted
2026-11-11
Extracted by CoreStory V3
7522
verified game rules, each with a cited source quote
1053
files that contain rules
5
capabilities
21
features
01 · Rules

Game rules, traced to source lines.

These 12 rules are a sample of the 7,522 CoreStory V3 extracted from OpenRCT2. Each one links to the exact lines on GitHub at commit 53bbc40. The statement is CoreStory V3’s wording; the code excerpt is the source it cites.

configuration
src/openrct2/management/Finance.cpp

On finance initialisation, starting cash is 10000.00 GBP, the bank loan is 10000.00 GBP, the maximum bank loan is 20000.00 GBP, and the bank loan interest rate is 10. The scenario's initial cash is set to 10000.00 GBP for cheat detection.

  • 10000.00 GBP — initial cash
  • 10000.00 GBP — initial bank loan
  • 20000.00 GBP — maximum bank loan
  • 10 — initial bank loan interest rate
park.cash = 10000.00_GBP; park.bankLoan = 10000.00_GBP; park.maxBankLoan = 20000.00_GBP; park.bankLoanInterestRate = 10;

Also cited: L237

validation
src/openrct2/actions/park/ParkSetLoanAction.cpp

A request to set the loan is disallowed (bank refuses to increase the loan) when the new loan value is greater than the current bank loan and also greater than the park's maximum bank loan.

if (_value > park.bankLoan && _value > park.maxBankLoan) { return Result(Status::disallowed, STR_CANT_BORROW_ANY_MORE_MONEY, STR_BANK_REFUSES_TO_INCREASE_LOAN); }
configuration
src/openrct2/management/Finance.cpp

Monthly research cost depends on funding level: 0.00 GBP for no funding, 100.00 GBP for minimum, 200.00 GBP for normal, and 400.00 GBP for maximum.

  • 0.00 GBP — cost of no research funding
  • 100.00 GBP — cost of minimum research funding
  • 200.00 GBP — cost of normal research funding
  • 400.00 GBP — cost of maximum research funding
const money64 kResearchCosts[RESEARCH_FUNDING_COUNT] = { 0.00_GBP, // No funding 100.00_GBP, // Minimum funding 200.00_GBP, // Normal funding 400.00_GBP, // Maximum funding };
calculation
src/openrct2/entity/Staff.cpp

Staff wages by type: handyman 50.00 GBP, mechanic 80.00 GBP, security 60.00 GBP, entertainer 55.00 GBP. Any other type falls through to the handyman wage.

  • 50.00 GBP — handyman wage (also the default)
  • 80.00 GBP — mechanic wage
  • 60.00 GBP — security wage
  • 55.00 GBP — entertainer wage
case StaffType::handyman: return 50.00_GBP; case StaffType::mechanic: return 80.00_GBP; case StaffType::security: return 60.00_GBP; case StaffType::entertainer: return 55.00_GBP;
eligibility threshold
src/openrct2/management/Award.cpp

Best Value is deserved only if neither Worst Value nor Most Disappointing is active, the park has money enabled and its entrance fee is unlocked, total ride value for money is at least 10.00 GBP, and the entrance fee plus 0.10 GBP is less than half the total ride value.

  • 10.00 GBP — minimum total ride value for money
  • 0.10 GBP — margin added to entrance fee before comparing
  • 2 — divisor of total ride value
if (park.flags.has(ParkFlag::noMoney) || !Park::EntranceFeeUnlocked(park)) return false; if (park.totalRideValueForMoney < 10.00_GBP) return false; if (Park::GetEntranceFee(park) + 0.10_GBP >= park.totalRideValueForMoney / 2) return false; return true;

Also cited: L183–L187

eligibility threshold
src/openrct2/management/Award.cpp

Safest is deserved only if no more than 2 in-park guests have a fresh (freshness <= 5) vandalism thought and no ride has a lastCrashType other than RIDE_CRASH_TYPE_NONE.

  • 2 guests — maximum guests with vandalism thoughts
  • 5 — maximum thought freshness counted
if (peepsWhoDislikeVandalism > 2) return false; // Check for rides that have crashed maybe? const auto& rideManager = RideManager(gameState); if (std::any_of(rideManager.begin(), rideManager.end(), [](const Ride& ride) { return ride.lastCrashType != RIDE_CRASH_TYPE_NONE; })) { return false; } return true;

Also cited: L260–L261

validation
src/openrct2/entity/Peep.cpp

A guest entering the park whose (voucher-adjusted) entrance fee exceeds their cash in pocket does not enter; they switch to leavingPark and turn around.

if (entranceFee > guest->cashInPocket) { guest->state = PeepState::leavingPark;
pricing
src/openrct2/management/Marketing.cpp

Weekly advertising campaign prices by campaign type: park entry free 50.00 GBP, ride free 50.00 GBP, park entry half price 50.00 GBP, food or drink free 50.00 GBP, park 350.00 GBP, ride 200.00 GBP.

  • 50.00 GBP — weekly price for park entry free campaign
  • 50.00 GBP — weekly price for ride free campaign
  • 50.00 GBP — weekly price for park entry half price campaign
  • 50.00 GBP — weekly price for food or drink free campaign
  • 350.00 GBP — weekly price for park advertising campaign
  • 200.00 GBP — weekly price for ride advertising campaign
50.00_GBP, // PARK_ENTRY_FREE 50.00_GBP, // RIDE_FREE 50.00_GBP, // PARK_ENTRY_HALF_PRICE 50.00_GBP, // FOOD_OR_DRINK_FREE 350.00_GBP, // PARK 200.00_GBP, // RIDE
calculation
src/openrct2/actions/ride/RideDemolishAction.cpp

The refurbish cost is computed as negative of the ride's refund price divided by 2 (half of the refund price, sign-inverted).

  • 2 — divisor applied to the negated refund price
money64 RideDemolishAction::GetRefurbishPrice(const Ride& ride) const { return -GetRefundPrice(ride) / 2; }
calculation
src/openrct2/actions/track/TrackRemoveAction.cpp

If the ride has ever been opened, the removal price is multiplied by 45875/65536 (about 70%).

  • 45875 — numerator of opened-ride price modifier
  • 65536 — denominator of opened-ride price modifier
  • 0.7 ratio — approximate modifier stated in comment
if (ride->flags.has(RideFlag::everBeenOpened)) { // 70% modifier for opened rides price = (price * 45875) / 65536; }
limit
src/openrct2/entity/Staff.cpp

A mechanic answering a breakdown call who has not arrived after mechanicTimeSinceCall exceeds 2500 ticks gives up. The ride's mechanic status is set back to calling and the mechanic falls (state becomes falling). The same limit applies when heading to an inspection if the ride is still due inspection and heading.

  • 2500 ticks — maximum time since call before giving up
if (mechanicTimeSinceCall > 2500) { ride->mechanicStatus = MechanicStatus::calling;

Also cited: L1295

eligibility threshold
src/openrct2/management/Award.cpp

Best Toilets is deserved when there are at least 4 open toilet rides, at least one open toilet per 128 guests (numToilets >= numGuestsInPark/128, integer division), and no more than 16 in-park guests have a fresh (freshness <= 5) toilet thought.

  • 4 toilets — minimum open toilets
  • 128 — divisor of guests giving minimum toilets
  • 16 guests — maximum guests needing a toilet
  • 5 — maximum thought freshness counted
if (numToilets < 4) return false; // At least one open toilet for every 128 guests if (numToilets < getGameState().park.numGuestsInPark / 128u) return false;

Also cited: L416–L419

02 · Capabilities

What the application does

5 capabilities and 21 features, as described by an earlier CoreStory V3 ingest of the same commit. These are descriptions, not the cited rules above.

Extensibility and Custom Content

Enables plugin-based extensions, extension user interfaces, custom imagery, and configurable title presentations.

  • Custom Image Management: Plugins can work with loaded images, animations, sprite ranges, and raw or encoded pixel data.
  • Plugin Registration: Plugins can register themselves with metadata and participate in the host application.
  • Plugin User Interface: Plugins can present interactive windows, controls, lists, dialogs, viewports, and map tools.
  • Title Sequence Control: Title sequences can orchestrate park loading, camera movement, playback speed, waits, restarts, and termination.

Park Construction and World Editing

Provides integrated construction and editing capabilities for rides, paths, scenery, signs, terrain, and water.

  • Footpath Construction: Footpaths and their additions can be placed, laid out, and removed.
  • Ride Construction and Management: Users and plugins can create, configure, operate, rename, price, and demolish rides and their track infrastructure.
  • Scenery and Sign Editing: Users and plugins can place, remove, recolour, name, and style scenery, walls, banners, and signs.
  • Terrain and Water Editing: The map terrain, water levels, land rights, surface styles, and dimensions can be edited.

Park Simulation Operations

Supports running and administering park simulations, including park, guest, staff, multiplayer, time, cheat, and saved-session concerns.

  • Cheat Controls: Game cheats can be selected and applied through explicit cheat controls.
  • Game Speed and Pause Control: The running game can be paused, resumed, and switched between supported simulation speeds.
  • Guest Management: Guests can be generated, spawned, picked up, renamed, and updated through guest-facing controls.
  • Multiplayer Administration: Multiplayer sessions support authentication, chat events, player groups, permissions, reassignment, and player removal.
  • Park Management: Core park settings and operations such as naming, entrance fees, finances, marketing, research funding, dates, entrances, and messages can be managed.
  • Scenario and Save-Game Control: Scenarios and saved games can be selected, configured, saved, loaded, or exited.
  • Staff Management: Staff can be hired, dismissed, named, assigned orders and patrol areas, and visually customized.

Project Quality Automation

Automates source-format validation and configurable file filtering for repository quality workflows.

  • Clang-Format Diff Checking: Runs clang-format comparisons and presents formatting differences to the user with explicit outcome handling.
  • Configurable File Exclusions: Selects files for formatting checks while allowing paths to be excluded through an exclusion file.

Release Assets and Project Metadata

Maintains distributable assets, platform branding, release history, and contributor attribution.

  • Asset Update: Updates application assets from packaged files.
  • Changelog Normalization: Parses, cleans up, reorders, and prints changelog content in a normalized form.
  • Contributor Credits: Users can view categorized credits recognizing the OpenRCT2 team, contributors, original game credits, and supporting roles.
  • macOS App Icon: Provides a macOS application icon that can be regenerated when its artwork changes.
03 · Size

What was analyzed

  • C++ · 735 files · 570,098 lines
  • Text · 36 files · 102,526 lines
  • C/C++ Header · 744 files · 68,571 lines
  • JSON · 13 files · 58,416 lines
  • Java · 16 files · 4,542 lines
  • XML · 21 files · 3,542 lines
  • SVG · 3 files · 3,135 lines
  • TypeScript · 1 file · 2,917 lines
  • CMake · 13 files · 1,470 lines
  • YAML · 16 files · 1,303 lines
  • Markdown · 12 files · 1,228 lines
  • Other (15 languages) · 49 files · 2,935 lines

Whole repository: 11,869 files, not counting src/thirdparty. cloc 2.06 counts 820,683 lines of code in 1,659 of them (913,588 lines with comments and blanks).

04 · Source

Where this came from

Business rules extracted by CoreStory V3 from the public repository at commit 53bbc40 on 2026-11-11. Business rules were extracted from the full repository; the bundled third-party code in src/thirdparty is excluded from the rule counts and samples. Capability descriptions from an earlier CoreStory V3 ingest of the same commit (2026-10-19).

Code excerpts are from the upstream repository and remain under its GPL-3.0 license. CoreStory is not affiliated with or endorsed by the OpenRCT2 project.

Want this for your own codebase?

Talk to us about mapping the business rules in your repositories.

Talk to an expert