Skip to content

Fix guests 'waiting' on extended railway crossings#18257

Merged
Gymnasiast merged 2 commits into
OpenRCT2:developfrom
rik-smeets:improve-crossing-behaviour
Oct 9, 2022
Merged

Fix guests 'waiting' on extended railway crossings#18257
Gymnasiast merged 2 commits into
OpenRCT2:developfrom
rik-smeets:improve-crossing-behaviour

Conversation

@rik-smeets

Copy link
Copy Markdown
Contributor

On extended railway crossings, guests would stop to 'wait' for the passing train, which would then phase right through them. This change at least allows guests a chance to get to a safe place.

Before:
Guests would stop dead in their tracks, accepting their fate.
Accepting faith

After:
Guests will at least try to reach a safe place. This lucky peep manages to do just that!
Railway escape

Of course, guests heading towards to incoming train will simply continue walking (right through it). And not every guest will get to a safe place in time. But I think this is at least better than the current situation where every guest would stop dead in their tracks.

@rik-smeets rik-smeets force-pushed the improve-crossing-behaviour branch from 519280a to 5f5081d Compare October 8, 2022 19:57
On extended railway crossings, guests would stop to 'wait' for the passing train, which would then phase right through them. This change at least allows guests a chance to get to a safe place.
@rik-smeets rik-smeets force-pushed the improve-crossing-behaviour branch from 5f5081d to bba54d2 Compare October 8, 2022 19:59
Comment thread src/openrct2/entity/Peep.cpp
@IntelOrca

Copy link
Copy Markdown
Contributor

Could the guest start running if a train is chasing them? 😅

@ocalhoun6

ocalhoun6 commented Oct 8, 2022

Copy link
Copy Markdown
Contributor

Guests have a fair bit of leeway to move side-to-side on a path. Maybe it's possible to have them walk on the far left or far right side of the path in situations like this? They'd still be unrealistically close, of course, but at least visually, it would look like they're stepping aside to let the train through, and it would look like the train is brushing past them, rather than plowing through them.

Not in this PR, of course, but it might be something for a future PR.

Edit:
The code controlling peep's side-to-side position on the path is located in GuestPathfinding.cpp, lines 158-172:

        const int8_t offset = (scenario_rand() & 7) - 3;
        if (direction == 0 || direction == 2)
        {
            // Peep is moving along X, so apply the offset to the X position of the destination and clamp their current Y
            const int32_t centreLine = (peep.y & 0xFFE0) + COORDS_XY_HALF_TILE;
            newTile.x += offset;
            newTile.y = std::clamp<int32_t>(peep.y, centreLine - 3, centreLine + 3);
        }
        else
        {
            // Peep is moving along Y, so apply the offset to the Y position of the destination and clamp their current X
            const int32_t centreLine = (peep.x & 0xFFE0) + COORDS_XY_HALF_TILE;
            newTile.x = std::clamp<int32_t>(peep.x, centreLine - 3, centreLine + 3);
            newTile.y += offset;
        }

A modified version of this could force them to the outside edges of the path, rather than holding them closer to the center.

@rik-smeets

Copy link
Copy Markdown
Contributor Author

@IntelOrca Perhaps that's something for a different PR 😅. I could see the RCT community using a feature like that for some 'fun' scenarios... Not fun for the guests though.

@ocalhoun6 Yes, I was thinking of something like that too. This is basically a quick win to improve the current behaviour, but I intend to look into it further in the future. Thanks for sharing the bit of code. Something similar happens (I think) if a guest is watching scenery or a ride, when they also move to the side of the tile.

@Gymnasiast Gymnasiast merged commit def6b70 into OpenRCT2:develop Oct 9, 2022
@Gymnasiast Gymnasiast added this to the v0.4.3 milestone Oct 9, 2022
@rik-smeets rik-smeets deleted the improve-crossing-behaviour branch October 9, 2022 20:42
Gymnasiast added a commit that referenced this pull request Dec 14, 2022
- Feature: [#17782] The Flying Coaster now has access to boosters and can draw outside loops.
- Feature: [#17997] The Log Flume can now draw steep pieces down (if vehicle allows it).
- Feature: [#18312, objects#220, OpenSFX#13] New sound effects for the Hybrid and Single Rail roller coasters.
- Feature: [#18675] [Plugin] Plugins can refer to g2 image icons by name.
- Feature: [objects#173] Add alpine coaster vehicle.
- Feature: [objects#221] Add two extra jungle walls.
- Feature: [objects#225] Add log cabin roofs.
- Feature: [OpenMusic#14, OpenMusic#15, OpenMusic#18] Added Galaxy, Acid and Dodgems ride music styles.
- Improved: [#18013, #18016, #18018, #18019, #18514, objects#224] Added colour presets to Spiral Slide, Dodgems, Boat Hire, Flying Saucers, and Car Ride.
- Improved: [#18024] Clearer error messages when loading incompatible .park files.
- Improved: [#18192] Tycoon Park has been added to the Extras tab.
- Improved: [#18214] Competition scenarios have received their own section.
- Improved: [#18250] Added modern style file and folder pickers on Windows.
- Improved: [#18332] Allow Inverted Roller Coaster to draw boosters.
- Improved: [#18350] Changed ride vehicle list to have less padding.
- Improved: [#18422] Allow adding images to music objects.
- Improved: [#18428] [Plugin] Add widget description interfaces to documentation.
- Improved: [#18487] Mini Helicopters track can now draw spinning tunnels.
- Improved: [#18591] Order RollerCoaster Tycoon 2 scenarios by difficulty.
- Improved: [#18607] A new tab for all UCES Scenarios, if it’s installed.
- Improved: [#18621] OpenGL performance.
- Change: [#17677] Open campaign window from finished campaign news.
- Change: [#17998] Show cursor when using inverted mouse dragging.
- Change: [#18230] Make the large flat to steep pieces available on the corkscrew roller coaster without cheats.
- Change: [#18381] Convert custom invisible paths to the built-in ones.
- Change: [OpenSFX#11, OpenMusic#19] First implementation of official replacement asset packs for sound effects & music.
- Fix: [#1491] Clearance of the Cash Machine is too low (original bug).
- Fix: [#1519] “See-through rides” doesn't affect all rides (original bug).
- Fix: [#6341] “Unlock vehicle limits” does not allow setting fewer vehicles than the vehicle type requires.
- Fix: [#14312] Research ride type message incorrect.
- Fix: [#14425] Ride ratings do not skip unallocated ride ids.
- Fix: [#15969] Guests heading for ride use vanilla behaviour
- Fix: [#17067] Random Staff Patrol Area clicks.
- Fix: [#17316] Sides of River Rapids’ corners overlay other parts of the track.
- Fix: [#17657] When switching from buying land rights to buying construction rights, grid disables and won't re-enable afterwards.
- Fix: [#17763] Missing validation on invalid characters in file name.
- Fix: [#17853] Invention name tears while being dragged.
- Fix: [#18064] Unable to dismiss notification messages.
- Fix: [#18070] Underground entrance/exit shows through terrain walls (original bug).
- Fix: [#18094] Underground shops & facilities don't show when adjacent to non-underground path (original bug).
- Fix: [#18122] Ghosts count towards “Great scenery!” guest thought.
- Fix: [#18134] Underground on-ride photo section partially clips through adjacent terrain edge.
- Fix: [#18244] Invention DragWindow's starting position is inconsistent.
- Fix: [#18245] Guests stopping dead in their tracks at railway crossings.
- Fix: [#18257] Guests ‘waiting’ on extended railway crossings.
- Fix: [#18354] Overwrite alert does not show when save name has different casing on Windows.
- Fix: [#18379] Tunnel entrances for underground Mini Golf Hole E are not rendered correctly.
- Fix: [#18442] About window background is clickable.
- Fix: [#18449] [Plugin] Change type of listview widgets from 'scroll_view' to 'listview'.
- Fix: [#18453] Slow walking guests don't get across level crossings in time.
- Fix: [#18469] Land rights window buttons incorrectly disabled and markers remain visible indefinitely.
- Fix: [#18459] ‘Highlight path issues’ hides fences for paths with additions.
- Fix: [#18552] Trains clipping through helixes.
- Fix: [#18576] Cannot open parks with certain types of corrupt tile elements.
- Fix: [#18606] JSON objects do not take priority over the DAT files they supersede.
- Fix: [#18620] [Plugin] Crash when reading widget properties from windows that have both static and tab widgets.
- Fix: [#18653] Negative ratings multipliers do not appear in Vehicle tab.
- Fix: [#18696] Construction rights cannot be viewed after all are purchased.
- Fix: [#18720] Upwards helix is enabled for the Alpine Coaster, even when cheats are off.
- Fix: [#18755] Ferris Wheel and Circus ghosts not coloured correctly.
- Fix: [#18802] Game could crash when determining if a mechanic is heading to fix the ride blocking the path.
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.

5 participants