1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 07:44:38 +01:00

Debunch peeps (#12917)

* Stop guests from being forced to the center line of a path over time

Change the way we apply randomness to peep destinations when moving from one tile to the next, to allow peeps that are moving along a straight path to maintain their perpendicular offset relative to the path direction, instead of being (eventually) forced back to the center line.

* Update test expectations

The changes to guest movement mean that the number of steps taken for these expected paths are now slightly different to before.
This commit is contained in:
Richard Fine
2020-11-03 20:30:36 -05:00
committed by GitHub
parent faf10568bb
commit 438b197b80
6 changed files with 36 additions and 11 deletions

View File

@@ -34,7 +34,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "0"
#define NETWORK_STREAM_VERSION "1"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View File

@@ -137,7 +137,31 @@ static int32_t peep_move_one_tile(Direction direction, Peep* peep)
peep->DestinationTolerance = 2;
if (peep->State != PeepState::Queuing)
{
peep->DestinationTolerance = (scenario_rand() & 7) + 2;
// When peeps are walking along a path, we would like them to be spread out across the width of the path,
// instead of all walking along the exact center line of the path.
//
// Setting a random DestinationTolerance does not work very well for this. It means that peeps will make
// their new pathfinding decision at a random time, and so will distribute a bit when they are turning
// corners (which is good); but, as they walk along a straight path, they will - eventually - have had a
// low tolerance value which forced them back to the center of the path, where they stay until they turn
// a corner.
//
// What we want instead is to apply that randomness in the direction they are walking ONLY, and keep their
// other coordinate constant.
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 keep their current Y
peep->DestinationX += offset;
peep->DestinationY = peep->y;
}
else
{
// Peep is moving along Y, so apply the offset to the Y position of the destination and keep their current X
peep->DestinationX = peep->x;
peep->DestinationY += offset;
}
}
return 0;
}