Skip to content

Speedy Block Brakes#18713

Merged
Broxzier merged 10 commits into
OpenRCT2:developfrom
spacek531:block-brake-improvements
Apr 12, 2023
Merged

Speedy Block Brakes#18713
Broxzier merged 10 commits into
OpenRCT2:developfrom
spacek531:block-brake-improvements

Conversation

@spacek531

@spacek531 spacek531 commented Nov 28, 2022

Copy link
Copy Markdown
Collaborator

This is a continuation of #13838 since it was closed and unable to reopen.

This PR adds speedy block brakes, a long-requested feature. Block brakes now have a speed field which allows users to set the maximum speed a train may traverse the block brake. Vehicles stopped by the block brake will resume motion at the original speed when the block brake opens.

To compliment the speedy block brakes, regular brakes have new behavior. When an uninterrupted line of brakes precede a block brake, the brakes will disable themselves while these conditions are met:

  • The block brake is open
  • The brake's speed is lower than the block brake's speed

In addition to these two features, the following supporting modifications are made:

  • Tile inspector changes checkbox text "block brake closed" to "brake closed" when selecting a non-block brake piece
  • Track designs and older parks sets all block brake speed to default, which is identical to legacy behavior
  • Special case added to track design export to overwrite speed field with rotation field when saving block brakes on multidim coasters
  • Removed arbitrary limitation of TrackPlaceAction that prevents building track element with speed and seat rotation

@spacek531 spacek531 force-pushed the block-brake-improvements branch from 8d9555d to a749299 Compare November 28, 2022 22:36
@spacek531 spacek531 marked this pull request as ready for review November 28, 2022 23:19
@spacek531

Copy link
Copy Markdown
Collaborator Author

Will require replays update.

@karst

karst commented Dec 5, 2022

Copy link
Copy Markdown
Member

Seems like you have to poke the compiler again. Seems to do this often lately. It builds just fine on my machine.

@karst

karst commented Dec 5, 2022

Copy link
Copy Markdown
Member

image
Is it intentional you built this on top of 0.3.5.1?

@duncanspumpkin

Copy link
Copy Markdown
Contributor

As this will break existing track designs i can't see how we can add it like this.

@karst

karst commented Dec 5, 2022

Copy link
Copy Markdown
Member

I don't see how it would break existing track designs if they all default to what it'd be before this change. I could see people save the design without being able to complete when coming to a full stop though, idk if there was thought about that.

@spacek531

Copy link
Copy Markdown
Collaborator Author

As this will break existing track designs i can't see how we can add it like this.

Can you post which designs it breaks?

@duncanspumpkin

Copy link
Copy Markdown
Contributor

The fact that the replays are invalidated tells me that it changes the logic of vehicles and therefore will break designs

@spacek531

Copy link
Copy Markdown
Collaborator Author

Seems like you have to poke the compiler again. Seems to do this often lately. It builds just fine on my machine.

It compiled successfully, the errors are from BPB 1000 ticks

@spacek531

spacek531 commented Dec 5, 2022

Copy link
Copy Markdown
Collaborator Author

The fact that the replays are invalidated tells me that it changes the logic of vehicles and therefore will break designs

Replays are invalidated because it is loading a value where none was loaded before. The import code properly handles Legacy block brakes and updates them to use the exact same speed that they had before.

@duncanspumpkin

Copy link
Copy Markdown
Contributor

The fact that the replays are invalidated tells me that it changes the logic of vehicles and therefore will break designs

Replays are invalidated because it is loading a value where none was loaded before. The import code properly handles Legacy block brakes and updates them to use the exact same speed that they had before.

How do you achieve the legacy behaviour of block brakes there is no way to select that. Therefore it will change the behaviour of the vehicles and break tracks

@spacek531

Copy link
Copy Markdown
Collaborator Author

The fact that the replays are invalidated tells me that it changes the logic of vehicles and therefore will break designs

Replays are invalidated because it is loading a value where none was loaded before. The import code properly handles Legacy block brakes and updates them to use the exact same speed that they had before.

How do you achieve the legacy behaviour of block brakes there is no way to select that. Therefore it will change the behaviour of the vehicles and break tracks

Block brakes set to 4 mph use the legacy speed. Track designs and parks import all block brakes at 4 mph. Therefore legacy behavior is maintained.

@spacek531 spacek531 force-pushed the block-brake-improvements branch from 75824eb to 5b96a07 Compare December 5, 2022 22:00
@duncanspumpkin

Copy link
Copy Markdown
Contributor

The fact that the replays are invalidated tells me that it changes the logic of vehicles and therefore will break designs

Replays are invalidated because it is loading a value where none was loaded before. The import code properly handles Legacy block brakes and updates them to use the exact same speed that they had before.

How do you achieve the legacy behaviour of block brakes there is no way to select that. Therefore it will change the behaviour of the vehicles and break tracks

Block brakes set to 4 mph use the legacy speed. Track designs and parks import all block brakes at 4 mph. Therefore legacy behavior is maintained.

So when I set it to 4mph your BrakeLinkToBlockBrake will disable itself?

@spacek531

spacek531 commented Dec 6, 2022

Copy link
Copy Markdown
Collaborator Author

So when I set it to 4mph your BrakeLinkToBlockBrake will disable itself?

The equality in the function takes care of that. !(blockBrakeSpeed > brakeSpeed) means the brake is released when the block brake is faster than the brake speed, and since block brakes import at the minimum speed, it cannot happen.

@spacek531

Copy link
Copy Markdown
Collaborator Author

BlockBrakeSetLinkedBrakesClosed has a guard clause for trackType so it exits early if the track it is called for is not a block brake. I also have a check for the track type outside the function that serves the same purpose. Are the redundant checks bad? Is it preferred to have the guard clause or to check before calling the function?

@X123M3-256

Copy link
Copy Markdown
Contributor

Any update on this?

@spacek531 spacek531 force-pushed the block-brake-improvements branch 2 times, most recently from 9a33713 to bc44a87 Compare December 14, 2022 20:44
@spacek531

spacek531 commented Dec 14, 2022

Copy link
Copy Markdown
Collaborator Author

replay_desync_84964.txt

Here is the desync file from the current bpb1000ticks. The desync genotype is that brake_speed is changed from 0 to 2 as expected. The desync phenotype is nothing - there are no vehicle position desyncs which indicates the behavior is perfectly maintained.

Comment thread src/openrct2/rct1/S4Importer.cpp Outdated
Comment thread data/language/en-GB.txt Outdated
@spacek531

Copy link
Copy Markdown
Collaborator Author

Note: bump network version

@spacek531 spacek531 force-pushed the block-brake-improvements branch from f6b5b6d to 5fc1e27 Compare December 14, 2022 22:43
Comment thread src/openrct2/rct12/RCT12.cpp Outdated
Comment thread src/openrct2/ride/Vehicle.cpp Outdated
Comment thread src/openrct2/ride/Ride.cpp Outdated
Comment thread src/openrct2/ride/Ride.cpp Outdated
Comment thread src/openrct2/ride/Ride.cpp Outdated
Comment thread src/openrct2/ride/Ride.cpp Outdated
Comment thread src/openrct2/ride/Vehicle.cpp Outdated
Comment thread src/openrct2/ride/Vehicle.cpp
Comment thread src/openrct2/ride/Vehicle.cpp Outdated
Comment thread src/openrct2/ride/Vehicle.cpp Outdated
Comment thread src/openrct2/ride/Vehicle.cpp
Comment thread src/openrct2/ride/Track.h Outdated
@spacek531 spacek531 force-pushed the block-brake-improvements branch 3 times, most recently from 8d99c59 to 120944f Compare April 12, 2023 02:14
@spacek531 spacek531 force-pushed the block-brake-improvements branch from 120944f to fdeb311 Compare April 12, 2023 02:31
@karst

karst commented Apr 12, 2023

Copy link
Copy Markdown
Member

Out of curiosity which of the functions ended up with this PR? The original braking method or the one that looks ahead?

@spacek531

Copy link
Copy Markdown
Collaborator Author

It uses the bbrake maximum speed which currently requires lookahead

duncanspumpkin added a commit to OpenRCT2/replays that referenced this pull request Apr 12, 2023
@Broxzier Broxzier enabled auto-merge April 12, 2023 21:46
@Broxzier Broxzier merged commit 5c34d1d into OpenRCT2:develop Apr 12, 2023
@spacek531 spacek531 deleted the block-brake-improvements branch April 13, 2023 00:43
janisozaur added a commit that referenced this pull request May 8, 2023
- Feature: [#18713] Block brakes have speed control and brakes slower than adjacent block brakes copy block brake speed when block brake open.
- Feature: [#19276] Add Powered Lifthill to Giga Coaster.
- Feature: [#19305] Add new Reversed Trains ride setting to run trains backwards, granting a bonus to ride ratings.
- Feature: [#19305] [Plugin] Add “Car.isReversed” to allow individual ride vehicles to run backwards.
- Feature: [#19446] Add new color options to color dropdown.
- Feature: [#19547] Add large sloped turns to hybrid coaster and single rail coaster.
- Feature: [#19930] Add plugin APIs for research.
- Feature: [OpenMusic#25] Added Prehistoric ride music style.
- Feature: [OpenMusic#26] Fairground Organ style 2 with new recordings from Herman's 35er Voigt (Previously known as Bressingham Voigt).
- Feature: [OpenMusic#28] Add Ragtime style 2 ride music.
- Improved: [#17739] Raise water and land height limits to 254 units/182m/600ft.
- Improved: [#18490] Reduce guests walking through trains on level crossing next to station.
- Improved: [#18996] When marketing campaigns are disabled, disable the Marketing tab in the Finances window.
- Improved: [#19764] Miscellaneous scenery tab now grouped next to the all-scenery tab.
- Improved: [#19830] “Highlight path issues” will now hide wall elements.
- Improved: [#19905] Add prompt before resetting shortcut keys.
- Improved: [#19952] Add colour preset to Spiral Slide using the new colour options.
- Improved: [#19953] Add keyboard shortcut to Keyboard Shortcuts window.
- Improved: [#20055] Performance improvement for the software renderer.
- Change: [OpenSFX#17] Update Hybrid RC lifthill loop.
- Fix: [#12598] Number of holes is not set correctly when saving track designs.
- Fix: [#13130] Android always defaulting to UK locale for language, currency and temperature.
- Fix: [#13397] Ride simulation causes strange station behaviour and makes the ride unusable in some cases.
- Fix: [#16791] Rotodrop top piece replicates when walls are placed around it and clearance checks are disabled (original bug).
- Fix: [#18583] Land dropdown is incorrect if there are surface entry index holes.
- Fix: [#18895] Responding mechanic blocked at level crossing.
- Fix: [#19231] Crash due to null pointer to previously deleted banner in tile copy/paste functionality.
- Fix: [#19296] Crash due to a race condition for parallel object loading.
- Fix: [#19733] Favorite ride of X guests integer overflow.
- Fix: [#19756] Crash with title sequences containing no commands.
- Fix: [#19767] No message when path is not connected to ride exit and is therefore unreachable for mechanics.
- Fix: [#19800] Crash when displaying station stats with more than 62 stations.
- Fix: [#19801] The in-game load/save window cannot be resized anymore.
- Fix: [#19854] Looping Coaster trains clipping through steep quarter turns down.
- Fix: [#19858] Issue drawing simulate flag icon on alternate colour palettes.
- Fix: [#19901] Random shop colours never assigning last colour.
- Fix: [#19911] Guests stuck at certain railway crossings.
- Fix: [#19924] Destructible cheat does not allow partial ride modification.
- Fix: [#19950] Mine train block brake supports drawn incorrectly.
- Fix: [#19955] Mine Train Roller Coaster has incorrect supports on the sloped left small turn (original bug).
- Fix: [#19987] [Plugin] ‘SetCheatAction’ has wrong ID in plugin API.
- Fix: [#20016] The group box for small scenery details in the Tile Inspector window has unused empty space.
- Fix: [#20018] Shops not calculating up-keep cost.
- Fix: [#20033] Asset packs cannot reference game data.
- Fix: [#20104] [Plugin] Some network APIs use player index and group index.
- Fix: [#20099] Some scrollbar is glitched or have incorrect size when open window for the first time
- Fix: [#20134] Grass length being updated for tiles in the void, causing unneccesary drawing operations.
foodisgoodyesiam added a commit to foodisgoodyesiam/OpenRCT2-sven that referenced this pull request May 9, 2023
Release v0.4.5

- Feature: [OpenRCT2#18713] Block brakes have speed control and brakes slower than adjacent block brakes copy block brake speed when block brake open.
- Feature: [OpenRCT2#19276] Add Powered Lifthill to Giga Coaster.
- Feature: [OpenRCT2#19305] Add new Reversed Trains ride setting to run trains backwards, granting a bonus to ride ratings.
- Feature: [OpenRCT2#19305] [Plugin] Add “Car.isReversed” to allow individual ride vehicles to run backwards.
- Feature: [OpenRCT2#19446] Add new color options to color dropdown.
- Feature: [OpenRCT2#19547] Add large sloped turns to hybrid coaster and single rail coaster.
- Feature: [OpenRCT2#19930] Add plugin APIs for research.
- Feature: [OpenMusic#25] Added Prehistoric ride music style.
- Feature: [OpenMusic#26] Fairground Organ style 2 with new recordings from Herman's 35er Voigt (Previously known as Bressingham Voigt).
- Feature: [OpenMusic#28] Add Ragtime style 2 ride music.
- Improved: [OpenRCT2#17739] Raise water and land height limits to 254 units/182m/600ft.
- Improved: [OpenRCT2#18490] Reduce guests walking through trains on level crossing next to station.
- Improved: [OpenRCT2#18996] When marketing campaigns are disabled, disable the Marketing tab in the Finances window.
- Improved: [OpenRCT2#19764] Miscellaneous scenery tab now grouped next to the all-scenery tab.
- Improved: [OpenRCT2#19830] “Highlight path issues” will now hide wall elements.
- Improved: [OpenRCT2#19905] Add prompt before resetting shortcut keys.
- Improved: [OpenRCT2#19952] Add colour preset to Spiral Slide using the new colour options.
- Improved: [OpenRCT2#19953] Add keyboard shortcut to Keyboard Shortcuts window.
- Improved: [OpenRCT2#20055] Performance improvement for the software renderer.
- Change: [OpenSFX#17] Update Hybrid RC lifthill loop.
- Fix: [OpenRCT2#12598] Number of holes is not set correctly when saving track designs.
- Fix: [OpenRCT2#13130] Android always defaulting to UK locale for language, currency and temperature.
- Fix: [OpenRCT2#13397] Ride simulation causes strange station behaviour and makes the ride unusable in some cases.
- Fix: [OpenRCT2#16791] Rotodrop top piece replicates when walls are placed around it and clearance checks are disabled (original bug).
- Fix: [OpenRCT2#18583] Land dropdown is incorrect if there are surface entry index holes.
- Fix: [OpenRCT2#18895] Responding mechanic blocked at level crossing.
- Fix: [OpenRCT2#19231] Crash due to null pointer to previously deleted banner in tile copy/paste functionality.
- Fix: [OpenRCT2#19296] Crash due to a race condition for parallel object loading.
- Fix: [OpenRCT2#19733] Favorite ride of X guests integer overflow.
- Fix: [OpenRCT2#19756] Crash with title sequences containing no commands.
- Fix: [OpenRCT2#19767] No message when path is not connected to ride exit and is therefore unreachable for mechanics.
- Fix: [OpenRCT2#19800] Crash when displaying station stats with more than 62 stations.
- Fix: [OpenRCT2#19801] The in-game load/save window cannot be resized anymore.
- Fix: [OpenRCT2#19854] Looping Coaster trains clipping through steep quarter turns down.
- Fix: [OpenRCT2#19858] Issue drawing simulate flag icon on alternate colour palettes.
- Fix: [OpenRCT2#19901] Random shop colours never assigning last colour.
- Fix: [OpenRCT2#19911] Guests stuck at certain railway crossings.
- Fix: [OpenRCT2#19924] Destructible cheat does not allow partial ride modification.
- Fix: [OpenRCT2#19950] Mine train block brake supports drawn incorrectly.
- Fix: [OpenRCT2#19955] Mine Train Roller Coaster has incorrect supports on the sloped left small turn (original bug).
- Fix: [OpenRCT2#19987] [Plugin] ‘SetCheatAction’ has wrong ID in plugin API.
- Fix: [OpenRCT2#20016] The group box for small scenery details in the Tile Inspector window has unused empty space.
- Fix: [OpenRCT2#20018] Shops not calculating up-keep cost.
- Fix: [OpenRCT2#20033] Asset packs cannot reference game data.
- Fix: [OpenRCT2#20104] [Plugin] Some network APIs use player index and group index.
- Fix: [OpenRCT2#20099] Some scrollbar is glitched or have incorrect size when open window for the first time
- Fix: [OpenRCT2#20134] Grass length being updated for tiles in the void, causing unneccesary drawing operations.
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.

Block brake speed

8 participants