Commit Graph

155 Commits

Author SHA1 Message Date
Shauren
d778d5ec7c Core/Misc: Include cleanup - remove MapUtils.h from Containers.h 2024-12-31 18:12:36 +01:00
Shauren
b13b5142f1 Core/Utilities: Extend make_unique_ptr_with_deleter functionality to allow it to create deleters with compile time constant functions (reduces its size to just sizeof(void*)) 2024-10-01 21:03:44 +02:00
Shauren
7ac0c685dd Build: Add WITH_WARNINGS_AS_ERRORS cmake option that turns compile warnings into compile errors 2024-09-20 13:19:42 +02:00
Shauren
a21e7c738e Build: Automatically include WindowsSettings.manifest in all executables instead of listing it separately as source file in every target 2024-09-15 12:55:50 +02:00
Shauren
fd0a7ba871 Core/CrashHandler: Compile WheatyExceptionReport only once and moved its global variable initializer to all projects using it 2024-09-15 12:13:54 +02:00
Shauren
d05dbaaecb Core/Vmaps: Fixed use after free and deadlocks when loading a model file fails 2024-07-06 22:52:11 +02:00
Shauren
08778dc1c8 Tools/mmaps_generator: Fixed executable name and default values in --help 2024-06-30 22:48:51 +02:00
Shauren
fd4ffc81b2 Core/Misc: Fixed windows _UNICODE incompatibilities 2024-06-02 14:21:13 +02:00
thesillyone
a59f7351dd Tools/mmaps_generator: Only initialize memory for inds mesh when it will be read (#29795)
* this change does NOT require re-generating mmaps
2024-03-25 23:35:40 +01:00
Shauren
a70e758ba5 Tools/vmap_extractor: Move information about model type from spawns in vmap tiles to model file itself 2024-03-06 00:04:19 +01:00
Shauren
1aa04cabe1 Tools/mmaps_generator: Added const on some functions interfacing with vmaps 2024-03-06 00:04:19 +01:00
Shauren
67244a1f70 Core/Misc: Replace sprintf with safer alternatives (Trinity::StringFormat or snprintf) 2024-03-01 16:05:34 +01:00
Shauren
333630b7de Core/Misc: Added windows version checks during startup to avoid confusion about crashes when running on unsupported OS 2023-12-01 19:53:13 +01:00
Shauren
b299902881 Core/Locales: Set active code page and locale used by c string functions to utf8
Closes #29455
2023-11-24 20:01:17 +01:00
Shauren
348e29c79f Tools/mmaps_generator: Allow specifying custom offmesh area/flags 2023-10-16 10:55:34 +02:00
Shauren
b6a0fa3518 Tools: Updated db2 metadata used by extractors 2023-07-12 20:51:39 +02:00
Giacomo Pozzoni
3bc9825b0d Revert "MMAP: Build ADT floor just like WMO floor below liquid (#27503)" (#28392)
This reverts commit 8a779268b6.

(cherry picked from commit b69870630d)
2023-01-12 22:55:16 +01:00
Shauren
d791afae1d Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api) 2023-01-08 21:16:53 +01:00
Shauren
92ed5e8af1 Core/Misc: Include cleanup, 2023 edition 2023-01-07 22:38:21 +01:00
Shauren
16a06346ae Core/Maps: Move terrain data handling out of Map class
Partial port of cmangos/mangos-wotlk@ff5232c648
2022-07-23 19:13:33 +02:00
robinsch
364796dc3b Tool/MMAP: Fixed invalid check causing certain tiles not to build (#27833)
example: mmaps_generator 230 will cause tile 33, 29 to not build because of the check. causing NPCs to not have mmap information in some parts of the map.

.go xyz 1380 -831 -88 230 has no mmap tile information because of above check.
https://i.imgur.com/Pypeu4f.png

(cherry picked from commit e898b6e794)
2022-03-26 15:28:07 +01:00
Kargatum
373ed8f46b Core: whitespace cleanup, reduce double blank line to single (#25795)
* Core/Misc: fix double empty line

* worldserver.conf

(cherry picked from commit a32b6b8ac4)
2022-03-05 20:07:57 +01:00
Shauren
439b027d48 Core/Misc: Cleanup unused includes 2022-02-13 15:07:00 +01:00
Shauren
473f3db0ab Core/CrashHandler: #ifdef cleanup to make VS not choke when parsing, fixed file being all red in editor
(cherry picked from commit 39c5e03b74)
2022-01-26 18:46:43 +01:00
ipriver
bde36062b7 fixed indentation for cmake files
(cherry picked from commit a46d047f94)
2022-01-06 23:40:39 +01:00
killerwife
c9b13f1897 MMAP: Build ADT floor just like WMO floor below liquid (#27503)
Fixes ocean floor pathfinding

(cherry picked from commit 8a779268b6)
2022-01-04 20:44:26 +01:00
Giacomo Pozzoni
feb36f3f7d Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode (#27412)
* Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode

* Fix GCC build

(cherry picked from commit 8c80f28581)
2022-01-04 20:44:26 +01:00
jackpoz
071a8b5b7d Core/Misc: Remove whitespace
(cherry picked from commit 869fb748cd)
2022-01-04 20:44:26 +01:00
jackpoz
be7acb2527 Core/MMAPs: Reduce chances of breaking tile connections
Reduce chances of breaking tile connections caused by floating point rounding issues.

(cherry picked from commit e615e2ddef)
2022-01-04 20:44:26 +01:00
Giacomo Pozzoni
1ba940b17a Core/Maps: Change .map file version from FourCC to uint32 (#26326)
(cherry picked from commit 42877e75e2)
2022-01-04 20:44:25 +01:00
Giacomo Pozzoni
89e183704c Improve multithreading of mmaps_generator (#25625)
* Build/Misc: Add a few *San CMake flags

Add the following flags for the related tools:
- MSAN for Memory Sanitizer
- UBSAN for Undefined Behavior Sanitizer
- TSAN for Thread Sanitizer

* Remove unused parameter

* Fix UBSan reported issue

* Disable G3D buffer pools when using Thread Sanitizer as it has its custom locking mechanisms

* Code cleanup

* Move threads from maps to tiles

* Move tile building logic to TileBuilder class

* Fix memory leak in TileBuilder

* Fix build

* Store TileBuilder as raw pointer for now, it will be changed later on to use modern C++ constructs

* Fix crash on shutdown

* Revert pvs-studio change

* Fix generating 1 single tile not closing the program

(cherry picked from commit a4e93d779c)
2022-01-04 20:44:25 +01:00
Shauren
1d0ca1106f Tools/mmaps_generator: Made loading vmaps by mmaps_generator threadsafe 2022-01-04 20:44:22 +01:00
jackpoz
3820aabcd8 Core/MMAPs: Restore single slope angle of 55°
Re-generating MMAPs IS required.
Partially reverts 995a443da2 .

Having 2 different slope angles of 55° and 85° created too many polygons to fit in the current mmtile structure. This caused some polygons to become disconnected from each other, creating the old "invisible walls" effect. Because of this and because of the performance hit when loading a mmtile caused by the increase of polygon numbers, this commit reverts the recent changes and sets by default the slope angle to 55°.
Feel free to restore the previous behaviour by running .\mmaps_generator --maxAngle 85 --maxAngleNotSteep 55 , specifying the map id as number if a single map should have different slope values.
This is the last commit that will change MMAPs version to force re-generating them. Any future change that will affect only the generation settings will be optional (but recommended).

(cherry picked from commit 3947e4cb57)
2022-01-04 20:44:02 +01:00
Giacomo Pozzoni
782a943b38 Tools/MMapsGenerator: Add some more input parameters to improve mmaps load performances (#25520)
* Some research about mmaps load performances

* Tools/MMapsGenerator: Add some more input parameters

Add some more input parameters which affect the resulting mmaps:
- --smallOutputSize: sets both walkableSlopeAngle and walkableSlopeAngleNotSteep to 55°, reducing by a lot the .mmtile size and the number of polys. A rcFilterLedgeSpans() call is included too to filter out some polys. Default to false.
- --maxAngle: Restore this parameter removed some commits ago. Specifies the max walkable angle of a Creature when in combat. Default to 85
- --maxAngleNotSteep: Max walkable angle of a Player and of a Creature out of combat. Must be less or equal than --maxAngle. Default to 55.

A performance profiling comparison highlighted that .mmtile load grows exponential with the number of polys. A small server with GridUnload enabled and without preloading all grids on startup will be more affected than a big server with GridUnload disabled and preloading grids on startup.

(cherry picked from commit b6e205f7ef)
2022-01-04 20:44:02 +01:00
Giacomo Pozzoni
d58d0e895c 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

(cherry picked from commit 995a443da2)
2022-01-04 20:44:02 +01:00
jackpoz
bafd22104c Tools/MMAPs: Output the time spent in a human readable format
(cherry picked from commit 6e34e07c48)
2022-01-04 20:44:00 +01:00
Giacomo Pozzoni
89afeed41b 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>
(cherry picked from commit c0b75bf40d)
2022-01-04 15:33:04 +01:00
jackpoz
2f30a9986c Tools/MMaps: Fix strange paths in Blackfathom Deeps
Increase the agent height by x2 to reduce the chance of having underground mmap layers wrongly picked by recast.

(cherry picked from commit 3b0a89a2ea)
2021-12-22 13:03:21 +01:00
Shauren
bfde919694 Tools/mmaps_generator: Replace hardcoded map ids with db2 data checks 2021-12-20 20:50:28 +01:00
Giacomo Pozzoni
dd929665e5 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

(cherry picked from commit 29bf280e34)
2021-12-20 20:35:37 +01:00
jackpoz
2318013278 Core/MMaps: Add rcMedianFilterWalkableArea() to mmaps generation process
Add rcMedianFilterWalkableArea() to mmaps generation process to simplify some ground/water areas

(cherry picked from commit 7ddbc18aaf)
2021-11-23 23:43:55 +01:00
jackpoz
3f4bedd803 Tools/MMaps: Allow to specify different Recast settings for different maps
Allow to specify different Recast settings for different maps, currently handled in GetMapSpecificConfig() as a switch statement.
Set walkableRadius to 0 in Blade's Edge Arena (Map ID 562) so the pets can walk on the thin rope between the bridge and the pillar.

(cherry picked from commit e4658a1307)
2021-11-22 23:54:43 +01:00
Shauren
453b59de57 Core/Maps: Adjusted logic in GetFullTerrainStatusForPosition to closer match what the client does regarding being inside WMOs
Closes #21625
Closes #21624
Closes #21516

(cherry picked from commit b9c6bbb51d)
2021-09-25 01:04:21 +02:00
Shauren
6ecfe58cae Core/Maps & Extractors: Move copypasted map file headers into a single shared file and replace #defines with enums 2021-05-29 21:21:37 +02:00
Shauren
2de6e56d29 Core/Misc: Rename MapDefines.h to MMapDefines.h as it contains mmap defines exclusively 2021-05-29 14:48:18 +02:00
Shauren
fb6c1dc295 Dep/bzip2: Remove dependency 2021-05-15 02:14:37 +02:00
Shauren
e821693c16 Core/Vmaps: Reduce memory used by vmaps, part 2 2021-04-25 00:11:42 +02:00
jackpoz
875c5bcade Tools/MMaps: Improve MMaps quality
Lower Detail Sample Distance and Detail Sample Max Error to get more accurate MMap data, in particular mmap height.
More info about Detail Mesh at http://digestingduck.blogspot.it/2009_07_01_archive.html and http://digestingduck.blogspot.it/2009_08_01_archive.html

(cherry picked from commit f8fd0b7a2c)
2021-02-15 19:13:25 +01:00
Shauren
7a406db506 Core/Collision: Fixed false positive errors in console about vmap loading 2020-12-08 18:16:47 +01:00
Shauren
b231903932 Core/Misc: Port all the refactors sneaked in master to 3.3.5 include cleanup port 2020-09-04 13:38:24 +02:00