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

#15314: unify Booster speed across all ride types and increase limits #16692

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

spacek531
Copy link
Contributor

@spacek531 spacek531 commented Feb 20, 2022

When a vehicle travels over a booster, launched lift hill, or Reverse Freefall Coaster launch track, the vehicle's behavior is dependent on the ride the vehicle belongs to. This means no matter how many merges you do, a Looping Coaster will always have anemic Looping Coaster boosters, and launched lift hills will never boost it.

This PR changes this behavior. Instead of looking at the vehicle's ride for how powerful or fast the boosters are, the vehicle looks at the track itself. This opens up many possibilities for ride design, as rides can now have boosters and launched lift hills of differing power, and can utilize the Reverse Freefall Coaster launch track, when using merging.

At the same time, this PR unifies the speed intervals between boosters and brakes, increases the top speed slightly, and increases the precision. Boosters and brakes of all coaster types are now twice as precise as regular brakes - the same as junior coaster boosters. The two upper bits of the speed field are reserved for booster features @X123M3-256 has worked on.

Backwards compatibility is achieved with a vehicle flag that preserves the legacy behavior. The flag is automatically set when importing from an older version of the game, and can be set or unset at any time using a plugin (plugin API to be implemented).

Critical to the legacy behavior are two new functions added to the RTD: GetAbsoluteBoosterSpeed and GetRelativeBoosterSpeed. The legacy speeds are the "relative" speed space, and unified speeds are the "absolute" speed space. When importing a park, all boosters have their speed absolutized (if giga, multiply by 2, if junior, divide by 2). When a legacy vehicle travels over a booster track, the track's speed is relativized based on the track's type (if giga, divide by 2, if junior, multiply by 2), then absolutized based on the vehicle's type (if giga, multiply by 2, if junior, divide by 2). Testing is required to find any missed edge cases.

Track designs placed in new versions of the game will not have the legacy flag set, but this should not be an issue because track designs cannot merge currently. When exporting to track design, boosters and brake speeds are capped to the maximum, and speeds that are too precise to save are rounded up. Testing of this is required to find any missed edge cases.

Todos:

  • add API to ride object for ride lifecycle flag RIDE_LIFECYCLE_LEGACY_BOOSTER_SPEED
  • re-add string STR_RIDE_SET_VEHICLE_LEGACY_SPEED_FAIL
  • fix indentation where noted
  • re-add brake speed cap
  • add booster speed cap
  • reorganize diffs into multiple commits for ease of review
  • implement legacy-flagged vehicles using LegacyBoosterSettings' BoosterAcceleration and PoweredLiftAcceleration

@spacek531
Copy link
Contributor Author

I believe I've managed to fully implement the feature outlined above, plus I extended it by getting the booster acceleration from the track's RTD. Getting booster acceleration from the track's RTD is temporary behavior which will be replaced by storing the BoosterAcceleration in the track element itself.

@spacek531
Copy link
Contributor Author

spacek531 commented Dec 16, 2022

I think a testing plan could look something like this:

  1. Build a park with all affected cases
  • Rides for each BoosterSpeedFactor
  • Rides for each BoosterAccelerationFactor
  • Rides for each PoweredLiftAcceleration
  • Reverse Freefall ride
  • Merging onto booster of different BoosterSpeedFactor
  • Merging onto booster of different BoosterAcceleratonFactor
  • Reverse Freefall merging onto different PoweredLiftAcceleration
  1. Branching from develop, add a uint8_t field at the end of Vehicle struct which is set to 0 at all times
  2. Record replays from this special version
  3. Analyze this branch's desync from the new replay

If the only desyncs are Vehicle struct values, then legacy behavior is preserved. If desyncs include vehicle position, legacy behavior was not preserved.

I am unsure how much testing the behavior locked behind UNIFIED_BRAKE_SPEED_ENABLED requires. It's 100% UI-focused code that locks the updated speed increments until NTDF is added.

@spacek531
Copy link
Contributor Author

Would solve #6680

@github-actions
Copy link

This pull request has been marked as stale and will be closed in 14 days if no action is taken. To keep it open, leave a comment or remove the stale-pr label. If you're awaiting feedback from a developer, please send us a reminder (either here or on Discord).

@spacek531
Copy link
Contributor Author

Please keep this open

@github-actions github-actions bot removed the stale-pr label Apr 21, 2023
@github-actions
Copy link

This pull request has been marked as stale and will be closed in 14 days if no action is taken. To keep it open, leave a comment or remove the stale-pr label. If you're awaiting feedback from a developer, please send us a reminder (either here or on Discord).

@karst
Copy link
Member

karst commented May 22, 2023

Please keep open

@github-actions github-actions bot removed the stale-pr label May 23, 2023
@github-actions
Copy link

This pull request has been marked as stale and will be closed in 14 days if no action is taken. To keep it open, leave a comment or remove the stale-pr label. If you're awaiting feedback from a developer, please send us a reminder (either here or on Discord).

@karst
Copy link
Member

karst commented Jun 24, 2023

Keep open please

@github-actions github-actions bot removed the stale-pr label Jun 25, 2023
@spacek531
Copy link
Contributor Author

spacek531 commented Apr 8, 2024

Todo list:

see original post

@@ -62,7 +62,7 @@ extern TrackPitch _previousTrackPitchEnd;

extern CoordsXYZ _previousTrackPiece;

extern uint8_t _currentBrakeSpeed2;
extern int8_t _currentBrakeSpeed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this to a signed integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a change related to #16692 (comment) that leaked into the original feature branch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, can you revert it? I want to keep the diff as small as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can, yes, but not for the next several days since I am very busy. I am still waiting on a decision regarding the 2 bits in the flags field as outlined in that comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, didn’t know you expected me to weigh in on it. I’ll get to it.

data/language/en-GB.txt Outdated Show resolved Hide resolved
Gymnasiast pushed a commit that referenced this pull request May 13, 2024
This pull request is spun off from Unify Speed #16692 for ease of review, as well as making it easier to address some future features independent of Unify Speed.

This PR separates the OperationSettings field of RTD into 3 new fields, since the OperationSettings struct was bloated with things that are not operation settings.

This PR implements legacy and non-legacy ("modern") booster setting fields. In preparation for Unify Speed, the legacy properties are set to match the values as they stand. Separating legacy from modern allows the modern values to be changed in accordance with #21752 while preserving backwards-compatibility.

Unify Speed or a spun-off subset PR will implement a vehicle flag to switch between legacy and modern behavior, which all older parks will import with, while new rides will use the non-legacy "modern" behavior. Unify speed or a spin-off will implement enforcing brake and booster speeds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants