Credits to cmangos and trinitycore projects. https://github.com/cmangos/mangos-classic/commit/fd6c640c6ef4afe028180e2d9b8ffc73a20ec902 https://github.com/cmangos/mangos-classic/commit/9b48da5237c90f5be471599f594ccfda4fd07eb9 https://github.com/cmangos/mangos-classic/commit/a391308caf0220f3058ccfc5ab77c3e0b0dff3df https://github.com/cmangos/mangos-classic/commit/def10c862b818c01d947de53167d0c8ed7d81001 https://github.com/cmangos/mangos-classic/commit/46229bb28c6a4362dc4f4ee88e8bdaf962cb1d58 https://github.com/cmangos/mangos-classic/commit/2e7af8455566d7b289c8fa8b00472a9f21ca1494 https://github.com/cmangos/mangos-classic/commit/9cc773b719ddb2498ff91ae9ae90f9cea71f3528 https://github.com/cmangos/mangos-classic/commit/c1d97517b0673769bad1343a0c9f9b24d24ab738 https://github.com/cmangos/mangos-classic/commit/74b1e01542ea3ea65239d1762662134abae43f13 https://github.com/cmangos/mangos-classic/commit/5442ad1d79efc7e3442fd01fdeda9cc7f60b6b64 https://github.com/cmangos/mangos-classic/commit/bfff02bd0eb383c635bf4375695d096080d5c2e0 https://github.com/cmangos/mangos-classic/commit/8daa3ffb6687d38b0912cd19905d03328de82e61 https://github.com/cmangos/mangos-classic/commit/1ede0a03aa61a9d84a883f113baa2c32d27f1a6b https://github.com/cmangos/mangos-classic/commit/ac5a8a60b8a54da9c3b1739307c14ca0a053f738 https://github.com/cmangos/mangos-classic/commit/48a84fbfb6c30d81fb1b7467b071a1512112d50a https://github.com/cmangos/mangos-classic/commit/9d4bc6efa615849aa4f936d90fd3f0b40c0a64d2 https://github.com/cmangos/mangos-classic/commit/3db7b9313c52b415230a29d19ddd256d47019a4a https://github.com/cmangos/mangos-classic/commit/866ec2d489c06c48750774198c2f1ad893c706b3 https://github.com/cmangos/mangos-classic/commit/256cbefafd46a30cc86ab284e86590a469296a14 https://github.com/cmangos/mangos-classic/commit/4b39ff359de2c5a88387634819e58b476ab05202 https://github.com/cmangos/mangos-classic/commit/c6854d16a597fbba3cc27cd8046e418c5cb33d13 https://github.com/cmangos/mangos-classic/commit/7f15528cfc745f38ac23eb4041bb756bdd44234a https://github.com/cmangos/mangos-classic/commit/1b15fa34d3469a16c7df78a37505d9b5f2bd097e https://github.com/cmangos/mangos-classic/commit/64a77261091b408d8dcfbbd7869c173263a23efb https://github.com/cmangos/mangos-classic/commit/7cb695c95826aa7491416fbc285b827c3ff3ebb9 https://github.com/cmangos/mangos-classic/commit/0587095290ce956e42c2d614a83262ae756cc935 https://github.com/cmangos/mangos-classic/commit/09034fb082cca3d60a2cd25aac01a8032c1163e7 https://github.com/cmangos/mangos-classic/commit/9ae1e8bebf36bf94162379c0b4aac27bc2b99636 https://github.com/cmangos/mangos-classic/commit/be83b98f01d5f71e7464bc41c49f74ef0fde009a https://github.com/cmangos/mangos-classic/commit/26c0877cec74c30498d553f2f933012d7a5aecb2 https://github.com/cmangos/mangos-classic/commit/1b3c8ee3c2dc90b0b0082bf2df640d48c9bcb96c https://github.com/cmangos/mangos-classic/commit/6a96d69e839fba35d984835b43af7ca37f4b2688 https://github.com/cmangos/mangos-classic/commit/d9853f1d0e11dcd6ca65f911e38227befdcb691b https://github.com/cmangos/mangos-classic/commit/5afd6a6fd04eec9b61e1bd604b2ef0d910f0b7c2 https://github.com/cmangos/mangos-classic/commit/c3ea0498239e86a6f310458db86ef77090e01eab https://github.com/cmangos/mangos-classic/commit/35bc62ac2b7bf3c97e780724cc4d14b14837660c https://github.com/cmangos/mangos-classic/commit/95fcec8517340f729af08d1397728d0552120f88 https://github.com/cmangos/mangos-classic/commit/a09d1e523b59ba33543a64660555a9e990eacfb9 https://github.com/cmangos/mangos-classic/commit/f6107dfc34fc7c2a2fb27f37678d6fc6f8b96802 https://github.com/cmangos/mangos-classic/commit/af2437976b2e5685f9a5e605d92da4088a402f48 https://github.com/cmangos/mangos-classic/commit/e0c98be3e7ea6e00dd2e23dc0d4cbbb5b308521b https://github.com/cmangos/mangos-classic/commit/ac70b0ef1aec0425e23deca77d761dcf3e9a9a66 https://github.com/cmangos/mangos-classic/commit/0d3fd0d5b8a0710e56a56703e0d8338e33863078 https://github.com/cmangos/mangos-classic/commit/a9393d27649b15398cebaaba01ef05436c6f5ab5 https://github.com/cmangos/mangos-classic/commit/9b38ef751b83cd091267140153a1c383b7c769c4 https://github.com/cmangos/mangos-classic/commit/3208a5e7a722e6d9bd1ee8fae6fc539b55078a7f https://github.com/TrinityCore/TrinityCore/commit/7ddbc18aafe61434971013ed6126f5666011ab43 https://github.com/TrinityCore/TrinityCore/commit/c602220e02bed1ad76c9e60064eeec5fd97bfe80 https://github.com/TrinityCore/TrinityCore/commit/5a980226497605b18f1855fa39f340c10ee9dd53
Recast & Detour
Recast
Recast is state of the art navigation mesh construction toolset for games.
- It is automatic, which means that you can throw any level geometry at it and you will get robust mesh out
- It is fast which means swift turnaround times for level designers
- It is open source so it comes with full source and you can customize it to your heart's content.
The Recast process starts with constructing a voxel mold from a level geometry and then casting a navigation mesh over it. The process consists of three steps, building the voxel mold, partitioning the mold into simple regions, peeling off the regions as simple polygons.
- The voxel mold is built from the input triangle mesh by rasterizing the triangles into a multi-layer heightfield. Some simple filters are then applied to the mold to prune out locations where the character would not be able to move.
- The walkable areas described by the mold are divided into simple overlayed 2D regions. The resulting regions have only one non-overlapping contour, which simplifies the final step of the process tremendously.
- The navigation polygons are peeled off from the regions by first tracing the boundaries and then simplifying them. The resulting polygons are finally converted to convex polygons which makes them perfect for pathfinding and spatial reasoning about the level.
Detour
Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly.
Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows you to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes.
Recast Demo
You can find a comprehensive demo project in RecastDemo folder. It is a kitchen sink demo containing all the functionality of the library. If you are new to Recast & Detour, check out Sample_SoloMesh.cpp to get started with building navmeshes and NavMeshTesterTool.cpp to see how Detour can be used to find paths.
Building RecastDemo
RecastDemo uses premake5 to build platform specific projects. Download it and make sure it's available on your path, or specify the path to it.
Linux
- Install SDL2 and its dependencies according to your distro's guidelines.
- run
premake5 gmakefrom theRecastDemofolder. cd Build/gmakethenmake- Run
RecastDemo\Bin\RecastDemo
OSX
- Grab the latest SDL2 development library dmg from here and place
SDL2.frameworkin/Library/Frameworks/ - Navigate to the
RecastDemofolder and runpremake5 xcode4 - Open
Build/xcode4/recastnavigation.xcworkspace - Select the "RecastDemo" project in the left pane, go to the "BuildPhases" tab and expand "Link Binary With Libraries"
- Remove the existing entry for SDL2 (it should have a white box icon) and re-add it by hitting the plus, selecting "Add Other", and selecting
/Library/Frameworks/SDL2.framework. It should now have a suitcase icon. - Set the RecastDemo project as the target and build.
Windows
- Grab the latest SDL2 development library release from here and unzip it
RecastDemo\Contrib. Rename the SDL folder such that the pathRecastDemo\Contrib\SDL\lib\x86is valid. - Run
"premake5" vs2015from theRecastDemofolder - Open the solution, build, and run.
Running Unit tests
- Follow the instructions to build RecastDemo above. Premake should generate another build target called "Tests".
- Build the "Tests" project. This will generate an executable named "Tests" in
RecastDemo/Bin/ - Run the "Tests" executable. It will execute all the unit tests, indicate those that failed, and display a count of those that succeeded.
Integrating with your own project
It is recommended to add the source directories DebugUtils, Detour, DetourCrowd, DetourTileCache, and Recast into your own project depending on which parts of the project you need. For example your level building tool could include DebugUtils, Recast, and Detour, and your game runtime could just include Detour.
Contributing
See the Contributing document for guidelines for making contributions.
Discuss
- Discuss Recast & Detour: http://groups.google.com/group/recastnavigation
- Development blog: http://digestingduck.blogspot.com/
License
Recast & Detour is licensed under ZLib license, see License.txt for more information.
