Commit Graph
115 Commits
Author SHA1 Message Date
Shauren 7b4371e25d Core/MMaps: Implemented a way to enable/disable certain terrain types for movement on the entire map 2023-10-18 21:55:21 +02:00
Ovahlord 5a62d6c570 Core/Movement: fixed edge cases in which hovering units were considered far from poly during path generation, resulting in incomplete paths getting returned 2023-08-24 21:35:05 +02:00
Ovahlord ff3beb0e92 Core/Movement: added some overloads to PathGenerator::CalculatePath 2023-08-24 20:51:15 +02:00
Shauren bfd31d59c2 Core/MMaps: Fixed pathing for objects that have terrain swaps active 2023-08-08 00:21:48 +02:00
Shauren eeb2f63b65 Core/Maps: Fixed retrieving terrain info when on child maps 2023-01-02 15:23:21 +01:00
Shauren 0ba58aeb6e Core/Maps: Move terrain data handling out of Map class
Partial port of cmangos/mangos-wotlk@ff5232c648
2022-10-08 00:25:32 +02:00
Shauren 21e9854686 Core/Maps & Extractors: Move copypasted map file headers into a single shared file and replace #defines with enums 2022-10-07 22:16:46 +02:00
Ovahlord f72b3c64b3 Revert "Core/PathFinding: calculate pathing with 0.5f steps and convert them to blizzlike splines later in the process to get more precise results" 2021-03-31 21:37:24 +02:00
Ovahlord 45e1dd7376 Core/PathFinding: re-added a accidentally dropped path length limit sanitizer 2021-01-24 10:18:29 +01:00
Ovahlord 71fe0ed943 Core/PathFinding: calculate pathing with 0.5f steps and convert them to blizzlike splines later in the process to get more precise results 2021-01-22 18:34:09 +01:00
Ovahlord d5f9b8c26f Core/Movement: implement smooth waypoints
* delays can now be negative to support sniffed transition times from one waypoint path to another
* early transitions will now pick up the ongoing spline destination and start calculating their path from that point on
* waypoints may now use db side spline pathings in a new db table to support special spline shapes are not generated by normal pathfinding (e.g. scripted flight paths)
* current waypoints will still the work the way they did before for legacy and custom support
2021-01-15 12:10:49 +01:00
Giacomo Pozzoni 5e3b57bae7 Core/Unit: Fix movement hiccups in water
* Core/Unit: Allow to define Units which can enter water but cannot swim

Allow to define Units which can enter water but cannot swim, i.e. crabs walking at the bottom of a sea.

* Add UNIT_FLAG_SWIMMING to creatures when entering combat

* Fix charmed creatures not entering water

* Always allow Creatures controlled by players to enter water

* Add swimming flag when possessing a unit and remove it properly at the end, even if the creature engaged combat before and after.
When adding/removing UNIT_FLAG_SWIMMING manually calling Creature::RefreshSwimmingFlag(true) might be required.
2021-01-11 12:33:54 +01:00
xvwyh 6342b0def2 Core/PathFinding: Fix GetPathPolyByPosition() using only 2D distance instead of 3D
Signed-off-by: jackpoz <giacomopoz@gmail.com>
2020-09-19 21:41:31 +02:00
Ovahlord b6ea5033fa Core/Movement: 5cc2b41146 codestyle followup 2020-09-11 21:13:01 +02:00
Ovahlord 5cc2b41146 Core/Movement: setting path length limits will now round the amount of smooth path points up instead of down to reduce edge cases in which charge effects close to their maximum cast range would return no path 2020-09-11 20:50:57 +02:00
Giacomo Pozzoni 85532de2e9 Handle different slopes in mmaps (#24765)
* Tools/MMAPs: Remove input argument --maxAngle

Remove input argument --maxAngle . This should be just hardcoded in MapBuilder::GetMapSpecificConfig() so all settings are easily found in the same place instead of being spread around.

* Tools/MMAPs: Add new area type NAV_AREA_GROUND_STEEP

Add new area type NAV_AREA_GROUND_STEEP for ground with slope in the range (55, 70] .
NAV_AREA_GROUND is used for ground with range [0, 55] .
NAV_AREA_GROUND_STEEP takes priority over NAV_AREA_GROUND.

* Tools/MMAPs: Fix NAV_GROUND_STEEP flag not being saved in the mmtile

* Core/PathFinding: Implement NAV_GROUND_STEEP flag

Implement NAV_GROUND_STEEP flag, used only by Creatures that are in combat or evading.

* Distinguish between RC_WALKABLE_AREA and NAV_AREA_GROUND.

* Allow mobs in combat to walk on steeps up to 80°

* Allow mobs in combat to walk on steeps up to 85°.
Disable rcFilterLedgeSpans() filter as it removed long steep spans.

* Increase cost of steep spans to try making creatures walk around obstacles instead of walking on them

* Revert last commit
# Conflicts:
#	src/server/game/Movement/PathGenerator.cpp
2020-06-18 02:16:11 +02:00
Ovahlord 813b82efa3 Core/Units: CanFly and CanHover will now return positive results when the creature has the according movement flags dispite not having the template movement field set as enabled. This fixes several edge cases with manually enabled flight movement
* renamed IsLevitating to IsGravityDisabled for consistency
2020-05-16 19:21:27 +02:00
Ovahlord d91fa5023e Core/Objects: fixed random destination selection for spells casted by flying units
* the path generator will now check for realtime movement flags instead of movement template data for units
2020-05-16 17:15:19 +02:00
Giacomo Pozzoni e3bab35d5e Core/MMAPs: Adjust walkable climb and fix a lot of mmap raycast issues (#24539)
* Core/MMAPs: Adjust walkable climb

Adjust walkable climb as recast using walkableClimb also to find the poly from a position, giving priority to polys that are below the position but closer than walkableClimb.

* Temporarily disable static collision (the whole check should be removed)

* Core/Spells: removed deprecated mmap path check for TARGET_DEST_CASTER_FRONT_LEAP

* Core/Objects: allow flying units to use the helper as well (flying units casting radius based spells)

* Code refactor

* Handle raycasts that end in a point with no height in the mmap mesh as PATHFIND_NOPATH

* Walk back a bit from raycast hitpoints as sometime the 2D result point is outside of the polygons due to floating point errors.

* Remove whitespace

* Revert 4a197ba22a as a raycast point path should have the Z retrieved with getPolyHeight(). Raycast will only return a 2-point path with Start and Hitpoint/End

* Cleanup PathGenerator raycast case

* Fix PathGenerator raycast broken if start and end are on same poly.
Fix PathGenerator raycast broken if no wall is hit.
Remove unused case of using raycast with an existing previous path (can be added back properly if needed).
Remove forcing poly length to 2 when we actually have already the right number.

* Use closestPointOnPolyBoundary on the second try of finding a point on poly for raycast.
Note that in this case the mesh height is not used which might cause issues. The poly boundary height will be used instead.

* Handle cases where getPolyHeight() fails because the point is on polygon border (and caused by floating point imprecision)

* Add far from poly flags

* Set PATHFIND_INCOMPLETE in raycast case if startFarFromPoly or endFarFromPoly

* Fix blink close to walls with no valid polygon behind the wall

* Require to re-extract mmaps

Co-authored-by: Ovah <dreadkiller@gmx.de>
# Conflicts:
#	src/server/game/Entities/Object/Object.cpp
2020-05-16 13:45:57 +02:00
Ovah 1a85f82edd Core/Objects: further improvements for MovePositionToFirstCollision (#24523)
* Core/Objects: further improvements for MovePositionToFirstCollision

* the PathGenerator will now normalize incomplete destinations as well
* normalize destination positions before launching detour raycasts to get better direction data
* exclude unwanted pathfinding results from further use to avoid unintended behaivior

* Core/PathFinding: Split PATHFIND_FARFROMPOLY into PATHFIND_FARFROMPOLY_START and PATHFIND_FARFROMPOLY_END for start and end position

Handle PATHFIND_FARFROMPOLY_END as valid in MovePositionToFirstCollision

Co-authored-by: jackpoz <giacomopoz@gmail.com>
# Conflicts:
#	src/server/game/Entities/Object/Object.cpp
#	src/server/game/Movement/PathGenerator.h
2020-05-01 14:51:38 +02:00
jackpoz c5c99f1eea Core/PathFinding: Fix buffer overflow 2020-04-29 22:37:55 +02:00
jackpoz 9eafd794f8 Core/PathFinding: Fix mmaps raycast without hit
Update Z coordinate of end position when casting a mmap raycast that doesn't hit the target
2020-03-05 18:20:40 +01:00
jackpoz a378f23d80 Core/PathFinding: Add support to WorldObject pathfinding 2020-02-20 21:45:36 +01:00
jackpoz e9318828b5 Core/MMaps: Handle path on same position
Handle path on the same polygon between 2 very close positions as a normal path.
2020-02-20 21:36:13 +01:00
Giacomo Pozzoni 9c6514847f Core/PathGenerator: Fix path generator returning shortcuts when start and end are on the same polygon (#24083)
* Core/PathGenerator: Fix path generator returning shortcuts when start and end are on the same polygon

Second try of handling paths on same poly in a better way than just building a shortcut

* Fix movement generators using paths with start/end positions far from mmap polygons

* Include flag PATHFIND_FARFROMPOLY even with a normal path if start or end were far away from mmap poly
2020-02-20 21:34:33 +01:00
jackpoz e4dba606cb Core/PathGenerator: Temporarily revert 29bf280e3496cf13c24ccb20e37da29d3bfa74d9
Temporarily revert 29bf280e3496cf13c24ccb20e37da29d3bfa74d9 since our recast implementation always expects a path to have different polygons.
A proper fix will be implemented later on, splitting a path with 1 single polygons in smaller steps in a similar way of how FindSmoothPath() works
2020-02-20 21:31:26 +01:00
Giacomo Pozzoni cad41332ba Core/PathGenerator: Fix path generator returning shortcuts when start and end are on the same polygon (#24036)
* Core/PathGenerator: Fix path generator returning shortcuts when start and end are on the same polygon

Fix path generator returning shortcuts when start and end are on the same polygon by handling this case as if start and end were on 2 different polygons. This will ensure BuildPointPath() gets called which calls FindSmoothPath(), making sure each step is not longer than SMOOTH_PATH_STEP_SIZE (4 yards)

* Change ingame cast error message to SPELL_FAILED_NOPATH from SPELL_FAILED_OUT_OF_RANGE if the generated path is too long
2020-02-20 21:29:46 +01:00
Giacomo Pozzoni fbe4abf3be Core/MMaps: Fix charge underwater/falling (#24010)
* Core/MMaps: Fix charge underwater

Fix charge sometimes returning "no path available" when swimming/underwater.
Fix charge selecting a destination point 4 yards above swimming/underwater targets

* Allow falling units to charge targets that are below (lower Z coordinate)

* Disable "raycast" pathfinding as it's not blizzlike.

This might show some strange paths when charging with a target in front.
It also fixes some falling undermap issues.

This Reverts 272009ebee

* Remove Z offset when charging a target as it never made sense
2020-02-20 21:27:00 +01:00
jackpoz c3d2b2c6d5 Core/PathFinding: Return raycast hitpoint when specifying straightLine 2020-02-08 23:32:09 +01:00
Aokromes d6d3f06f06 New year 2020-01-04 18:32:38 +01:00
funjoker 6c56916b29 Misc: Update copyright information
Happy new year
2020-01-01 18:47:28 +01:00
Giacomo Pozzoni e8b9723b02 Core/Movement: Fix LoS issue of NPCs chasing targets
Add Line of Sight checks to ChaseMovementGenerator::Update(), fixing to ChaseMovementGenerator not reaching a point with valid LoS to the target.

Fix re-implements 8927a04253 after 2a84562dc85516f432bb1e5de9add23c28b26ce4 partially removed it.

Fix #23724
2019-09-14 02:58:53 +02:00
Ovahlord d7e79d1892 Core/Movement: fixed build 2019-08-18 12:53:29 +02:00
jackpoz 8a1828aa43 Core/Misc: Fix linux build 2019-08-18 11:53:01 +02:00
jackpoz b407e6da1c Core/MMaps: Fix mobs evading when target is out of MMap meshes
Fix mobs evading when target is out of MMap meshes causes by an overzealous check added in c602220e02bed1ad76c9e60064eeec5fd97bfe80 when trying to fix an infinite loop in Recast.
If the target is outside of the MMap mesh (for example very close to a wall which is an un-walkable area with current TrinityCore settings and that might be changed in the future) Detour will not be able to find the height of the poly and getPolyHeight() will return DT_FAILURE | DT_INVALID_PARAM . Most of the time this is ok and can be ignored and it's still better than having the Unit evade.
Fix #23613
2019-08-18 11:52:54 +02:00
Ovahlord ab95871811 Core/Objects: replaced another IsFlying check with CanFly to make sure that hovering creatures will get their ground height returned properly
*also fixed a small typo in path generator
2019-05-06 02:30:24 +02:00
jackpoz 5cb3e69e1e Core/MMaps: Simplify d182e5f7e73e614185f4470429467befd6e03981 and handle PATHFIND_INCOMPLETE in ChaseMovementGenerator as "cannot reach the target"
# Conflicts:
#	src/server/game/Movement/MovementGenerators/ChaseMovementGenerator.cpp
2019-04-14 12:13:59 +02:00
jackpoz 6552a00208 Core/MMaps: Fallback to shortcut for flying units if Detour returned an incomplete path.
Fallback to shortcut for flying units if Detour returned an incomplete path. This is needed when a flying unit should fly to the floor below to reach the target, but since Recastnavigation doesn't support "jumping down" the unit would not find a path to the target.
2019-04-14 12:12:15 +02:00
Ovahlord 13f7ee4235 Core/Logs: merged path generator log category cleanup 2019-04-04 17:36:26 +02:00
Ovahlord bd58cb3ab1 Core/MMaps: Fix infinite loop in Detour (ported commit: c602220e02bed1ad76c9e60064eeec5fd97bfe80) 2019-03-03 05:27:55 +01:00
Ovahlord b0c37b25cc Core/Movement: ported some undermap fixups from a TC pull request 2019-02-23 22:37:17 +01:00
Ovahlord 50a91bd590 Core/Movement: merged Collision height handling from 335 branch to reduce the probability that creatures are falling under the map 2019-02-17 23:40:24 +01:00
Ovahlord 7edabcbd88 Core/Movement: ported and merged Follow and Chase movement generator rewrite 2019-02-07 23:51:45 +01:00
Ovahlord cfee8a09a1 Core/Maps: Fixed loading vmaps and mmaps in instances
(ported commit b773d9997bdd723cad8c646170e025a48f140f1d)
2018-05-06 18:47:51 +02:00
Ovahlord fbcb423f60 Tools: merged Master tools updates 2018-04-24 18:45:23 +02:00
Ovahlord b49bb2fccd Core/Movement: Fixed PathGenerator::GetNavTerrain returning ground instead of water in fatigue area 2018-04-21 16:29:10 +02:00
ariel- 5ff847159c Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources 2018-03-28 04:41:59 -03:00
Ovah 60afe858e8 MMaps phasing 2018-03-12 18:19:19 +00:00
Ovahlord 27652214b5 Core/Phasing: Rewrite GetTerrainMapId *updated phasing with latest changes 2018-03-10 16:10:48 +01:00
Ovahlord ce4e137889 Core/Entities: Take terrain swaps into account when calculating LoS/height/area 2018-03-09 23:45:06 +01:00