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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 11 deletions

View File

@ -44,8 +44,8 @@ set(TITLE_SEQUENCE_SHA1 "304d13a126c15bf2c86ff13b81a2f2cc1856ac8d")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v1.0.18/objects.zip")
set(OBJECTS_SHA1 "4a3c32a0251c3babe014844f2c683fc32138b3f2")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.19/replays.zip")
set(REPLAYS_SHA1 "8EAAE223FF9FE4D49949C9F343831977E6DB6CDE")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.20/replays.zip")
set(REPLAYS_SHA1 "65532bcb21c39236cfc1b7301d30297506383b65")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")

View File

@ -4,6 +4,7 @@
- Change: [#13346] Change FootpathScenery to FootpathAddition in all occurrences
- Fix: [#13334] Uninitialised variables in CustomTabDesc
- Fix: [#13342] Rename tabChange to onTabChange in WindowDesc interface
- Improved: [#12917] Changed peep movement so that they stay more spread out over the full width of single tile paths.
0.3.2 (2020-11-01)
------------------------------------------------------------------------

View File

@ -48,8 +48,8 @@
<TitleSequencesSha1>304d13a126c15bf2c86ff13b81a2f2cc1856ac8d</TitleSequencesSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.0.18/objects.zip</ObjectsUrl>
<ObjectsSha1>4a3c32a0251c3babe014844f2c683fc32138b3f2</ObjectsSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.19/replays.zip</ReplaysUrl>
<ReplaysSha1>8EAAE223FF9FE4D49949C9F343831977E6DB6CDE</ReplaysSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.20/replays.zip</ReplaysUrl>
<ReplaysSha1>65532bcb21c39236cfc1b7301d30297506383b65</ReplaysSha1>
</PropertyGroup>
<ItemGroup>

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;
}

View File

@ -215,13 +215,13 @@ TEST_P(SimplePathfindingTest, CanFindPathFromStartToGoal)
INSTANTIATE_TEST_CASE_P(
ForScenario, SimplePathfindingTest,
::testing::Values(
SimplePathfindingScenario("StraightFlat", { 19, 15, 14 }, 24), SimplePathfindingScenario("SBend", { 15, 12, 14 }, 88),
SimplePathfindingScenario("UBend", { 17, 9, 14 }, 86), SimplePathfindingScenario("CBend", { 14, 5, 14 }, 164),
SimplePathfindingScenario("TwoEqualRoutes", { 9, 13, 14 }, 87),
SimplePathfindingScenario("TwoUnequalRoutes", { 3, 13, 14 }, 87),
SimplePathfindingScenario("StraightFlat", { 19, 15, 14 }, 24), SimplePathfindingScenario("SBend", { 15, 12, 14 }, 87),
SimplePathfindingScenario("UBend", { 17, 9, 14 }, 87), SimplePathfindingScenario("CBend", { 14, 5, 14 }, 164),
SimplePathfindingScenario("TwoEqualRoutes", { 9, 13, 14 }, 89),
SimplePathfindingScenario("TwoUnequalRoutes", { 3, 13, 14 }, 89),
SimplePathfindingScenario("StraightUpBridge", { 12, 15, 14 }, 24),
SimplePathfindingScenario("StraightUpSlope", { 14, 15, 14 }, 24),
SimplePathfindingScenario("SelfCrossingPath", { 6, 5, 14 }, 213)),
SimplePathfindingScenario("SelfCrossingPath", { 6, 5, 14 }, 211)),
SimplePathfindingScenario::ToName);
class ImpossiblePathfindingTest : public PathfindingTestBase, public ::testing::WithParamInterface<SimplePathfindingScenario>