Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free money exploit with level-to-steep elements of hypercoasters #11752

Closed
James103 opened this issue May 14, 2020 · 9 comments · Fixed by #16477
Closed

Free money exploit with level-to-steep elements of hypercoasters #11752

James103 opened this issue May 14, 2020 · 9 comments · Fixed by #16477
Labels
bug Something went wrong.

Comments

@James103
Copy link
Contributor

James103 commented May 14, 2020

OS: Win 10
Version: 0.2.6, 0.3.0
Commit/Build: 6c3c857, 135cc10

Building a level to steep element of a hypercoaster costs $0.50 less than demolishing it, causing you to gain $0.50 every time you build and delete such an element on level ground.

  • Reproducible in RCT2 (vanilla)? No
  • Specific to multiplayer? No

Steps to reproduce:

  1. Start a hypercoaster.
  2. Build a station.
  3. Build a level to steep element.
  4. Demolish the level to steep element.
  5. You've just made $0.50!

Save game:
Test Park.zip

@James103 James103 changed the title Free money exploit with level-to-steep elements of hyper twister coasters Free money exploit with level-to-steep elements of hypercoasters May 14, 2020
@e-foley
Copy link
Contributor

e-foley commented May 15, 2020

This issue does not appear to be present in vanilla. Here's what I've found.

Action on level-to-steep-up piece at ground level RCT2 OpenRCT2
Cost to place $309.00 $308.50
Sale price $309.00 $309.00

Even though the piece costs $308.50 in OpenRCT2, it still displays the price in the construction window as "$309".

@Gymnasiast Gymnasiast added the bug Something went wrong. label May 16, 2020
@James103
Copy link
Contributor Author

Does this occur with any of the other track types, or is it just the hypercoaster?

@TusharSariya
Copy link
Contributor

TusharSariya commented May 17, 2020

How would I go about debugging this? what tools or tutorials should I use?

@duncanspumpkin
Copy link
Contributor

The fact the prices are so similar suggests that this is due to doing refund calculations in a slightly different way to price calculations. You would need to look at the two game actions and see how they differ.

@duncanspumpkin
Copy link
Contributor

Track Remove

        money32 price = RideTrackCosts[ride->type].track_price;
        if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE))
        {
            price *= FlatRideTrackPricing[trackType];
        }
        else
        {
            price *= TrackPricing[trackType];
        }
        price >>= 16;
        price = (price + cost) / 2;
        if (ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)
            price *= -7;
        else
            price *= -10;

        res->Cost = price;

TrackPlace

        money32 price = RideTrackCosts[ride->type].track_price;
        price *= (rideTypeFlags & RIDE_TYPE_FLAG_FLAT_RIDE) ? FlatRideTrackPricing[_trackType] : TrackPricing[_trackType];

        price >>= 16;
        res->Cost = cost + ((price / 2) * 10);

Notice that track place and track remove are using slightly different calcs cost (removal of scenery and supports) in the remove is going to be 5 times greater before the ride is opened! I would need to check the original to work out which one is correct or if its being broken since vanilla.

@duncanspumpkin
Copy link
Contributor

After checking the original the TrackPlace is incorrect.
image
ebx is the cost. eax is the price. It clearly adds together the cost and the price prior to the divide and multiply.

TrackRemove for reference:
image
ebp is the cost. eax is the price. It clearly adds together prior to the divide and multiply.

@duncanspumpkin
Copy link
Contributor

This bug has been in the code base a while...

@duncanspumpkin duncanspumpkin added this to the v0.3.0 milestone May 18, 2020
@James103
Copy link
Contributor Author

James103 commented May 26, 2020

In OpenRCT2 0.2.6 release (6c3c857), by building a level-to-steep element of any of the following coaster types and demolishing it, you lose $0.50 ($353 to build, $352 refund).

  • Hyper twister coaster
  • Giga coaster
  • Twister roller coaster

@caseyjohnsonwv
Copy link
Contributor

caseyjohnsonwv commented Jun 27, 2020

The profit exploit is also available for Hypercoaster station pieces at heights ending in 5. Placing and removing station pieces at 5ft, 15ft, 25ft, etc profits $0.50, but not at 0ft, 10ft, 20ft, etc. Station pieces are priced the same as flat-to-60s in TrackData.cpp. Corkscrew coaster stations do this too, as do Looping coasters. I have no idea how far this issue goes.

Flat-to-60-up and 60-down-to-flat (hill bottoms) both seem to do this for all heights, but 60-up-to-flat and flat-to-60-down (hill tops) never seem to do it.

Changing TrackPrice in CorkscrewRollerCoaster.h from 105 to 104 makes all corkscrew/hypercoaster cases yield -$0.50 instead of profiting while all correctly-priced ride elements seem unchanged. This isn't the "right" solution, but it's a start. I'll see if I can make any inroads.

@Gymnasiast Gymnasiast removed this from the v0.3.0 milestone Jul 13, 2020
CookiePLMonster added a commit to CookiePLMonster/OpenRCT2 that referenced this issue Jan 20, 2022
…o build

Fixes an inconsistency wuth RCT2 where track prices with a fractional part
did not have their price rounded up when building, but did when refunding.
This created an exploit where refunding such a track piece granted the player
0.50€ more than they spent on the piece.
CookiePLMonster added a commit to CookiePLMonster/OpenRCT2 that referenced this issue Jan 20, 2022
…o build

Fixes an inconsistency wuth RCT2 where track prices with a fractional part
did not have their price rounded up when building, but did when refunding.
This created an exploit where refunding such a track piece granted the player
0.50€ more than they spent on the piece.
CookiePLMonster added a commit to CookiePLMonster/OpenRCT2 that referenced this issue Jan 20, 2022
…o build

Fixes an inconsistency wuth RCT2 where track prices with a fractional part
did not have their price rounded up when building, but did when refunding.
This created an exploit where refunding such a track piece granted the player
0.50€ more than they spent on the piece.
CookiePLMonster added a commit to CookiePLMonster/OpenRCT2 that referenced this issue Jan 23, 2022
…o build

Fixes an inconsistency wuth RCT2 where track prices with a fractional part
did not have their price rounded up when building, but did when refunding.
This created an exploit where refunding such a track piece granted the player
0.50€ more than they spent on the piece.
CookiePLMonster added a commit to CookiePLMonster/OpenRCT2 that referenced this issue Jan 26, 2022
…o build

Fixes an inconsistency wuth RCT2 where track prices with a fractional part
did not have their price rounded up when building, but did when refunding.
This created an exploit where refunding such a track piece granted the player
0.50€ more than they spent on the piece.
CookiePLMonster added a commit to CookiePLMonster/OpenRCT2 that referenced this issue Feb 19, 2022
…o build

Fixes an inconsistency wuth RCT2 where track prices with a fractional part
did not have their price rounded up when building, but did when refunding.
This created an exploit where refunding such a track piece granted the player
0.50€ more than they spent on the piece.
duncanspumpkin pushed a commit that referenced this issue Feb 19, 2022
…16477)

Fixes an inconsistency wuth RCT2 where track prices with a fractional part
did not have their price rounded up when building, but did when refunding.
This created an exploit where refunding such a track piece granted the player
0.50€ more than they spent on the piece.
Gymnasiast added a commit that referenced this issue Apr 25, 2022
- Headline feature: [#10664] New save format with increased limits.
- Feature: [#714] Allow up to 255 trains per ride.
- Feature: [#2253] Path surfaces and railings can be mixed and matched, like in RCT1.
- Feature: [#2766] The Fruity Ices Stall can now be recoloured, like in RCT1.
- Feature: [#4933] Allow map sizes of 999 × 999 (up from 254 × 254).
- Feature: [#7660] Custom music objects that are distributed with the save.
- Feature: [#8407] Ride platforms can be made invisible.
- Feature: [#12793] Add Excitement/Intensity/Nausea ratings to Ride List view with sorting.
- Feature: [#13858] Flatride bases can be made invisible.
- Feature: [#14676] [Plugin] Allow plugins to store data in .park files.
- Feature: [#15367] Individual track elements can now be drawn as another ride type.
- Feature: [#15901] [Plugin] Add ‘map.getAllEntitiesOnTile’ to API.
- Feature: [#16029] [Plugin] Add ‘TrackElement.rideType’ to API.
- Feature: [#16097] The Looping Roller Coaster can now draw all elements from the LIM Launched Roller Coaster.
- Feature: [#16132, #16389] The Corkscrew, Twister and Vertical Drop Roller Coasters can now draw inline twists.
- Feature: [#16144] [Plugin] Add ‘ImageManager’ to API.
- Feature: [#16707] [Plugin] Implement intransient plugins.
- Feature: [#16707] [Plugin] New API for current mode, ‘map.change’ hook and toolbox menu items on title screen.
- Feature: [#16731] [Plugin] New API for fetching and manipulating a staff member’s patrol area.
- Feature: [#16800] [Plugin] Add lift hill speed properties to API.
- Feature: [#16806] Parkobj can load sprites from RCT image archives.
- Feature: [#16831] Allow tertiary colours for small and large scenery objects.
- Feature: [#16872] [Plugin] Add support for custom images.
- Improved: [#3517] Cheats are now saved with the park.
- Improved: [#10150] Ride stations are now properly checked if they’re sheltered.
- Improved: [#10664, #16072] Visibility status can be modified directly in the Tile Inspector’s list.
- Improved: [#16251] Plugin API handles null values better.
- Improved: [#16251] openrct2.d.ts: mark ‘callback’ argument of queryAction and executeAction as optional.
- Improved: [#16251] openrct2.d.ts: change ‘network.status’ to ‘network.mode’ in network API docs.
- Improved: [#16251] openrct2.d.ts: added previously undocumented ‘GroupBoxWidget.text’ property.
- Improved: [#16251] openrct2.d.ts: removed unused ‘LabelWidget.onChange’ property.
- Improved: [#16258] Increased image limit in the engine.
- Improved: [#16408] Improve ‘--version’ cli option to report more compatibility information.
- Improved: [#16740] Allow staff patrol areas to be defined with individual tiles rather than groups of 4x4.
- Improved: [#16764] [Plugin] Add hook ‘map.save’, called before the map is saved.
- Improved: [#16925] The queue length of 1000 guests is lifted, and a warning for too long queues is added instead.
- Change: [#14484] Make the Heartline Twister coaster ratings a little bit less hateful.
- Change: [#16077] When importing SV6 files, the RCT1 land types are only added when they were actually used.
- Change: [#16424] Following an entity in the title sequence no longer toggles underground view when it’s underground.
- Change: [#16493] Boat Hire and Submarine Ride support costs now match their visual appearance.
- Change: [#16710] Changed default view of Guest List to ‘Thoughts’ and selected tab will default to ‘Summarised’ (when opened from the menu).
- Change: [#16859] Guests with umbrellas no longer always avoid going into a Maze.
- Change: [#16912] Tired or nauseated guests will no longer jump in a Maze.
- Fix: [#6767] Black screen after Alt-Tabbing back into the game.
- Fix: [#11752] Track pieces with fractional cost are too cheap to build.
- Fix: [#12556] Allow game to run without audio devices.
- Fix: [#12774] [Plugin] Scripts will not be re-initialised when a new scenario is loaded from within a running scenario.
- Fix: [#13336] Can no longer place Bumble Bee track design (reverts #12707).
- Fix: [#14155] Map Generator sometimes places non-tree objects as trees.
- Fix: [#14674] Recent Messages only shows first few notifications.
- Fix: [#14920] Ghosts for rides and shops do not auto-elevate when obscured.
- Fix: [#15413] Modifying park rating with plugins desyncs park rating history from actual park rating.
- Fix: [#15571] Non-ASCII characters in scenario description get distorted while saving.
- Fix: [#15830] Objects with RCT1 images are very glitchy if OpenRCT2 is not linked to an RCT1 install.
- Fix: [#15909] Text can overflow in ‘Select ride design’ windows.
- Fix: [#15947, #15960] Removing a flat ride results in an error message and duplicate structures.
- Fix: [#15998] Cannot set map size to the actual maximum.
- Fix: [#16007] Scenario Editor “Entry Price” appears to the right of the value field.
- Fix: [#16008] Tile Inspector can select elements from last tile without reselecting it.
- Fix: [#16024] Go-Karts with more than 32 vehicles do not colour themselves correctly.
- Fix: [#16026] Newly created rides with “Disable vehicle limits” cheat always get 32 trains with 12 cars each.
- Fix: [#16063] Object Selection preview for objects with glass is broken.
- Fix: [#16075] Exporting track designs saves scenery in incorrect locations.
- Fix: [#16087] The Looping Roller Coaster booster is now always drawn correctly.
- Fix: [#16140] The ‘Follow this’ option is now disabled when the ride view is set to ‘overall’ or a station.
- Fix: [#16162] Go Karts speeds are not correctly randomised, they only go very fast or very slow.
- Fix: [#16188] Medium-size banked turns on the Twister and Vertical Roller Coaster have incorrect support placement (partly original bug).
- Fix: [#16264, #16572] Placing saved track design crashes game.
- Fix  [#16308] Crash when trying to place down a ride on Android.
- Fix: [#16327] Crash on malformed network packet.
- Fix: [#16449] [Plugin] Viewport doesn't hide when switching tabs.
- Fix: [#16450] Banner style not copied when using tile inspector.
- Fix: [#16535] Entering construction mode unblocks all paths.
- Fix: [#16542] “Same price throughout park” status not correctly imported for RCT1 saves.
- Fix: [#16572] Crash when trying to place track designs.
- Fix: [#16591] [Plugin] ‘setInterval’ and ‘setTimeout’ is not disposed when map unloads.
- Fix: [#16711] [Plugin] ‘Car.rideObject’ overflowing with more than 256 ride types.
- Fix: [#16779] Fix case where title music doesn't unmute properly.
- Fix: [#16808] Incorrect track design serialisation causing vehicle object replacement.
- Fix: [#16869] Soft Toy Stall cannot be recoloured, but shows a recolouring option anyway (original bug).
- Fix: [#16995] Native Linux dialog windows do not open if the path contains single quotes.
- Fix: [objects#165] Glitch when Bengal Tiger Cars go through a corner.
rik-smeets pushed a commit to rik-smeets/OpenRCT2 that referenced this issue Jun 11, 2022
- Headline feature: [OpenRCT2#10664] New save format with increased limits.
- Feature: [OpenRCT2#714] Allow up to 255 trains per ride.
- Feature: [OpenRCT2#2253] Path surfaces and railings can be mixed and matched, like in RCT1.
- Feature: [OpenRCT2#2766] The Fruity Ices Stall can now be recoloured, like in RCT1.
- Feature: [OpenRCT2#4933] Allow map sizes of 999 × 999 (up from 254 × 254).
- Feature: [OpenRCT2#7660] Custom music objects that are distributed with the save.
- Feature: [OpenRCT2#8407] Ride platforms can be made invisible.
- Feature: [OpenRCT2#12793] Add Excitement/Intensity/Nausea ratings to Ride List view with sorting.
- Feature: [OpenRCT2#13858] Flatride bases can be made invisible.
- Feature: [OpenRCT2#14676] [Plugin] Allow plugins to store data in .park files.
- Feature: [OpenRCT2#15367] Individual track elements can now be drawn as another ride type.
- Feature: [OpenRCT2#15901] [Plugin] Add ‘map.getAllEntitiesOnTile’ to API.
- Feature: [OpenRCT2#16029] [Plugin] Add ‘TrackElement.rideType’ to API.
- Feature: [OpenRCT2#16097] The Looping Roller Coaster can now draw all elements from the LIM Launched Roller Coaster.
- Feature: [OpenRCT2#16132, OpenRCT2#16389] The Corkscrew, Twister and Vertical Drop Roller Coasters can now draw inline twists.
- Feature: [OpenRCT2#16144] [Plugin] Add ‘ImageManager’ to API.
- Feature: [OpenRCT2#16707] [Plugin] Implement intransient plugins.
- Feature: [OpenRCT2#16707] [Plugin] New API for current mode, ‘map.change’ hook and toolbox menu items on title screen.
- Feature: [OpenRCT2#16731] [Plugin] New API for fetching and manipulating a staff member’s patrol area.
- Feature: [OpenRCT2#16800] [Plugin] Add lift hill speed properties to API.
- Feature: [OpenRCT2#16806] Parkobj can load sprites from RCT image archives.
- Feature: [OpenRCT2#16831] Allow tertiary colours for small and large scenery objects.
- Feature: [OpenRCT2#16872] [Plugin] Add support for custom images.
- Improved: [OpenRCT2#3517] Cheats are now saved with the park.
- Improved: [OpenRCT2#10150] Ride stations are now properly checked if they’re sheltered.
- Improved: [OpenRCT2#10664, OpenRCT2#16072] Visibility status can be modified directly in the Tile Inspector’s list.
- Improved: [OpenRCT2#16251] Plugin API handles null values better.
- Improved: [OpenRCT2#16251] openrct2.d.ts: mark ‘callback’ argument of queryAction and executeAction as optional.
- Improved: [OpenRCT2#16251] openrct2.d.ts: change ‘network.status’ to ‘network.mode’ in network API docs.
- Improved: [OpenRCT2#16251] openrct2.d.ts: added previously undocumented ‘GroupBoxWidget.text’ property.
- Improved: [OpenRCT2#16251] openrct2.d.ts: removed unused ‘LabelWidget.onChange’ property.
- Improved: [OpenRCT2#16258] Increased image limit in the engine.
- Improved: [OpenRCT2#16408] Improve ‘--version’ cli option to report more compatibility information.
- Improved: [OpenRCT2#16740] Allow staff patrol areas to be defined with individual tiles rather than groups of 4x4.
- Improved: [OpenRCT2#16764] [Plugin] Add hook ‘map.save’, called before the map is saved.
- Improved: [OpenRCT2#16925] The queue length of 1000 guests is lifted, and a warning for too long queues is added instead.
- Change: [OpenRCT2#14484] Make the Heartline Twister coaster ratings a little bit less hateful.
- Change: [OpenRCT2#16077] When importing SV6 files, the RCT1 land types are only added when they were actually used.
- Change: [OpenRCT2#16424] Following an entity in the title sequence no longer toggles underground view when it’s underground.
- Change: [OpenRCT2#16493] Boat Hire and Submarine Ride support costs now match their visual appearance.
- Change: [OpenRCT2#16710] Changed default view of Guest List to ‘Thoughts’ and selected tab will default to ‘Summarised’ (when opened from the menu).
- Change: [OpenRCT2#16859] Guests with umbrellas no longer always avoid going into a Maze.
- Change: [OpenRCT2#16912] Tired or nauseated guests will no longer jump in a Maze.
- Fix: [OpenRCT2#6767] Black screen after Alt-Tabbing back into the game.
- Fix: [OpenRCT2#11752] Track pieces with fractional cost are too cheap to build.
- Fix: [OpenRCT2#12556] Allow game to run without audio devices.
- Fix: [OpenRCT2#12774] [Plugin] Scripts will not be re-initialised when a new scenario is loaded from within a running scenario.
- Fix: [OpenRCT2#13336] Can no longer place Bumble Bee track design (reverts OpenRCT2#12707).
- Fix: [OpenRCT2#14155] Map Generator sometimes places non-tree objects as trees.
- Fix: [OpenRCT2#14674] Recent Messages only shows first few notifications.
- Fix: [OpenRCT2#14920] Ghosts for rides and shops do not auto-elevate when obscured.
- Fix: [OpenRCT2#15413] Modifying park rating with plugins desyncs park rating history from actual park rating.
- Fix: [OpenRCT2#15571] Non-ASCII characters in scenario description get distorted while saving.
- Fix: [OpenRCT2#15830] Objects with RCT1 images are very glitchy if OpenRCT2 is not linked to an RCT1 install.
- Fix: [OpenRCT2#15909] Text can overflow in ‘Select ride design’ windows.
- Fix: [OpenRCT2#15947, OpenRCT2#15960] Removing a flat ride results in an error message and duplicate structures.
- Fix: [OpenRCT2#15998] Cannot set map size to the actual maximum.
- Fix: [OpenRCT2#16007] Scenario Editor “Entry Price” appears to the right of the value field.
- Fix: [OpenRCT2#16008] Tile Inspector can select elements from last tile without reselecting it.
- Fix: [OpenRCT2#16024] Go-Karts with more than 32 vehicles do not colour themselves correctly.
- Fix: [OpenRCT2#16026] Newly created rides with “Disable vehicle limits” cheat always get 32 trains with 12 cars each.
- Fix: [OpenRCT2#16063] Object Selection preview for objects with glass is broken.
- Fix: [OpenRCT2#16075] Exporting track designs saves scenery in incorrect locations.
- Fix: [OpenRCT2#16087] The Looping Roller Coaster booster is now always drawn correctly.
- Fix: [OpenRCT2#16140] The ‘Follow this’ option is now disabled when the ride view is set to ‘overall’ or a station.
- Fix: [OpenRCT2#16162] Go Karts speeds are not correctly randomised, they only go very fast or very slow.
- Fix: [OpenRCT2#16188] Medium-size banked turns on the Twister and Vertical Roller Coaster have incorrect support placement (partly original bug).
- Fix: [OpenRCT2#16264, OpenRCT2#16572] Placing saved track design crashes game.
- Fix  [OpenRCT2#16308] Crash when trying to place down a ride on Android.
- Fix: [OpenRCT2#16327] Crash on malformed network packet.
- Fix: [OpenRCT2#16449] [Plugin] Viewport doesn't hide when switching tabs.
- Fix: [OpenRCT2#16450] Banner style not copied when using tile inspector.
- Fix: [OpenRCT2#16535] Entering construction mode unblocks all paths.
- Fix: [OpenRCT2#16542] “Same price throughout park” status not correctly imported for RCT1 saves.
- Fix: [OpenRCT2#16572] Crash when trying to place track designs.
- Fix: [OpenRCT2#16591] [Plugin] ‘setInterval’ and ‘setTimeout’ is not disposed when map unloads.
- Fix: [OpenRCT2#16711] [Plugin] ‘Car.rideObject’ overflowing with more than 256 ride types.
- Fix: [OpenRCT2#16779] Fix case where title music doesn't unmute properly.
- Fix: [OpenRCT2#16808] Incorrect track design serialisation causing vehicle object replacement.
- Fix: [OpenRCT2#16869] Soft Toy Stall cannot be recoloured, but shows a recolouring option anyway (original bug).
- Fix: [OpenRCT2#16995] Native Linux dialog windows do not open if the path contains single quotes.
- Fix: [objects#165] Glitch when Bengal Tiger Cars go through a corner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something went wrong.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants