1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00
Commit Graph

15826 Commits

Author SHA1 Message Date
Michał Janiszewski
0ee1811faa Merge pull request #8539 from richard-fine/tests/pathfinding
Tests for peep pathfinding
2019-01-02 15:55:20 +01:00
Richard Fine
cec457fbf1 Reformat 2019-01-02 14:12:51 +00:00
Richard Fine
315ea057fe Verify that peeps stay on paths
As per PR recommendation, confirm that a peep is still on the footpath for every step of the pathfinding tests.
2019-01-02 14:12:51 +00:00
Richard Fine
bb4e79ddda Rework tests to use ride entrances as path targets
It turns out that trying to just give a peep a pathfinding goal and then let them loose doesn't work, because every time they reach a junction, the pathfinder has them walk 'aimlessly' instead of pursuing their target. That's why we were seeing some very large step counts in previous tests - they were (eventually) walking onto the target square, but only after lots of wandering around in circles.

This commit reworks the test data to contain an actual ride for each test scenario, where the peep will path to the tile in front of the ride entrance. A nice side benefit of this is that the ride names must match the test names, so you can now tell from looking at the rides in the test data which one is used for which test instance.

The 'yellow marker' tiles for goal positions are also removed here, as we're deriving goal positions from the ride entrances instead.
2019-01-02 14:12:51 +00:00
Richard Fine
c8c1abd10a Reformat 2019-01-02 14:12:51 +00:00
Richard Fine
a20c8d61be Call core_init instead of bitcount_init 2019-01-02 14:12:51 +00:00
Richard Fine
280a0c61e4 Rename maxSteps to expectedSteps
To make it a little clearer what the parameter is for, rename FindPath::maxSteps to FindPath::expectedSteps, and extend the comment to describe what happens in negative test scenarios.
2019-01-02 14:12:51 +00:00
Richard Fine
357ee293f3 Remove default value for SimplePathfindingScenario steps
Remove the default value as it's more consistent to just always have the test case specify it explicitly.
2019-01-02 14:12:51 +00:00
Richard Fine
49e46f8940 Replace GetSurfaceStyleAtLocation with map_get_surface_element_at
There exists a helper function map_get_surface_element_at which already searches a tile's element list for the surface element, so we can just use that.
2019-01-02 14:12:51 +00:00
Michał Janiszewski
f4685f7b94 Add Pathfinding test to CMake 2019-01-02 14:12:51 +00:00
Richard Fine
8fb81a2d89 Initial data-driven tests for pathfinder behaviour
Introduce some basic scenario-style tests for the pathfinding AI. There
are two tests:

* Test that a peep can get from a given start position to a given end
  position, and that it takes them an expected number of ticks to do so.
  Also test that they did not walk on any 'forbidden' tiles in the process,
  e.g. tiles that are completely the wrong direction from the goal etc.

* Test that a peep can *not* get from a given start position to a given
  end position after a given number of ticks.

Each test is parametric, and instantiated for multiple different
start/end positions within the provided test park. If we find a new
situation that needs a test, it should just be a matter of building
that situation in the saved game and then adding a line to the code to
set it up.

Indicating 'forbidden' tiles is done using terrain surface type IDs:
tiles that the pathfinder should never send the peep into should be
painted with the red neon surface type (index 8). This means we have
no way to forbid some path elements on a tile while allowing others,
but we don't need that right now.

Similarly, to help ensure that the test data and code are kept in
sync, the tests also require that peep start tiles are painted with
the green neon surface type (index 11) and that goal tiles are
painted with the yellow neon surface type (index 9).
2019-01-02 14:12:08 +00:00
Richard Fine
b845304656 Equality operators for TileCoordsXYZ
Introduce operator == and operator != for TileCoordsXYZ, so that we can more easily operate on them in tests.
2019-01-02 14:11:28 +00:00
ζeh Matt
a065806b20 Merge pull request #8374 from ZehMatt/replay-feature
Add support to record and replay game commands/actions.
2019-01-02 09:15:10 +01:00
Matt
045e72e863 Add more replays to test. 2019-01-02 08:30:33 +01:00
Matt
7955dba9ba Add warning for mismatching network version. 2019-01-02 06:58:36 +01:00
Matt
fc4e45562d Use stringstream to log integral values. 2019-01-02 06:39:59 +01:00
Matt
74668c6188 Use correct file path on replay info output. 2019-01-02 05:39:32 +01:00
Matt
8615690891 Fix timestamp not being stored. 2019-01-02 05:36:31 +01:00
Matt
6aee1cba28 Remove deprecated function std::asctime. 2019-01-02 05:35:57 +01:00
Matt
1f20fdf65b Log more replay information to console. 2019-01-02 05:20:10 +01:00
Matt
a8254aa292 Add 64 bit serialisation support. 2019-01-02 05:18:36 +01:00
Matt
fafd2081e3 Result NewsItem when adding to queue. 2019-01-02 05:03:42 +01:00
Michał Janiszewski
f27e51e54f Update APK paths for uploading Android builds 2019-01-02 00:06:36 +01:00
Michał Janiszewski
51c88d85fd Add missing repository to Android project 2019-01-01 22:38:04 +01:00
OpenRCT2 git bot
d4dc94ff83 Merge Localisation/master into OpenRCT2/develop. 2019-01-01 04:00:23 +00:00
OpenRCT2 git bot
d71531fc98 Merge Localisation/master into OpenRCT2/develop. 2018-12-31 04:00:21 +00:00
Ted John
153ab15428 Fix #8493: Remove_unused_scenery removes map data
Do not try to remove (unused) terrain surfaces, edges and stations.
2018-12-30 23:40:22 +00:00
Matt
8721bef807 Fix TileElementWantsFootpathConnection test not releasing context. 2018-12-30 12:24:41 +01:00
Matt
f868c23077 Update replay. 2018-12-30 00:07:39 +01:00
Matt
38dc762f62 Initialize gCommandPosition with LOCATION_NULL in case its not set. 2018-12-30 00:04:34 +01:00
Matt
19ffc6208f Add version to replay file. 2018-12-30 00:03:20 +01:00
Matt
c7ab757a86 Cleanup. 2018-12-29 23:06:15 +01:00
Matt
0ba42d6899 Fix TileElementWantsFootpathConnection test not releasing context. 2018-12-29 22:58:33 +01:00
Matt
5497036f01 Add missing static keyword. 2018-12-29 19:23:28 +01:00
Matt
871a24c410 Rename replay file. 2018-12-29 19:23:28 +01:00
Matt
0a62938e42 Pretty print the test parameter. 2018-12-29 19:23:28 +01:00
Matt
3a9c0dda81 Update changelog.txt 2018-12-29 19:23:28 +01:00
Matt
b0ca9ff7c5 Prevent replay manager from recording nested commands. 2018-12-29 19:23:28 +01:00
Matt
bf03de4755 Focus camera on last replay event. 2018-12-29 19:23:28 +01:00
Matt
d3a20df682 Fix track designs ignoring ghost/preview flags. 2018-12-29 19:23:28 +01:00
Matt
14695e9b41 Fix game actions with ghost flags being recorded to replays. 2018-12-29 19:23:28 +01:00
Matt
d1ee19efd4 Fix track design previews not passing flags down. 2018-12-29 19:23:28 +01:00
Matt
5a8b611b83 Update. 2018-12-29 19:23:28 +01:00
Michael Steenbeek
4993c9ff7c Fix Xcode project 2018-12-29 19:23:28 +01:00
Matt
711d93cb30 Update replay test. 2018-12-29 19:23:27 +01:00
Matt
5cfc06573e Ignore replay test when network is disabled. 2018-12-29 19:23:27 +01:00
Matt
ccc3227113 Cleanup. 2018-12-29 19:23:27 +01:00
Matt
669fbd62dd Add missing source file. 2018-12-29 19:23:27 +01:00
Matt
040522b708 Fix include. 2018-12-29 19:23:27 +01:00
Matt
017f190a52 Add basic regression tests via the replay system. 2018-12-29 19:23:27 +01:00