Recast / Detour
Hi there,
I've been working on integrating the recast and detour libraries written by Mikko Mononen into the HPB template, to create a bot whose navigation and pathfinding is powered by it. The easy part has been done. I've written some code to read a Half-Life BSP, extract all the vertices, triangulate the faces and write the indices to a standard .OBJ file format. It also flips the Y and Z vertices around, and mirrors along the Z axis (as OpenGL, and therefore recast, uses a right-handed coordinate system where Y is up, and -Z is "forward"). It's not perfected yet as it still extracts the geometry for the sky and other redundant surfaces, and the bounding boxes for entities, but these will be stripped out next to leave only "real" geometry. I've then opened the level up using the RecastDetourDemo application available from the github here. The results are pretty good, as shown here: https://dl.dropboxusercontent.com/u/...Route_dust.png For anyone who is interested in trying it for themselves, I've made a pre-compiled version of the tool available (complete with examples for cs_italy and de_dust), as well as the source for my BSP-OBJ exporter here: https://dl.dropboxusercontent.com/u/...stDetourCS.zip The source is not fully drag and drop, you'll need to define your own functions for retrieving the BSP file path and the OBJ destination path, but that should be all. I'll update this thread as I make progress and I eventually want to release a bot template with the navmesh generation and pathfinding fully integrated. |
Re: Recast / Detour
Yay, nice work. I didn't knew that navmesh library even exist. :)
Looking forward to your progress. I wish PMB to see this. |
Re: Recast / Detour
Quote:
Recast is the library used to generate a nav mesh from a triangle soup, and Detour is a separate library for pathfinding. It has some interesting innovations around pathfinding in crowds to avoid "3 stooges syndrome" in doorways and narrow corridors. You can find a really good high level write-up of how Recast works here: http://critterai.org/projects/nmgen_study/ It's a Java port of the library but it does a great job of explaining the process. Ultimately I want to use Recast and Detour as a base, but add my own, Half-Life specific enhancements. I'll keep you posted :thumbsup: |
Re: Recast / Detour
Nice. I'm impatient. :)
|
Re: Recast / Detour
I managed to get the bot to internally generate a navmesh when the user types a command last night. De_dust takes about 2-3 seconds on my i7.
When I try exporting the generated mesh back out to an OBJ file to check it out however, the indices look a little messed up. It's probably just that I'm reading the data out of the detailed mesh incorrectly so I'll have a look at the Recast documentation and try again. Looks promising though! EDIT: Yep, Looks like piecing it back together into a triangle mesh is a little more involved. I'll figure it out when I have time. Once I've proven that the mesh generated is viable, I can start thinking about getting the bots moving around the map :) |
Re: Recast / Detour
Success! My bot now generates a viable navmesh, here is de_dust:
https://dl.dropboxusercontent.com/u/...st_navmesh.png You'll notice some odd little islands here and there, that's just where I've not quite culled the geometry that is inside the map, but not actually reachable by the player, like on top of pillars and walls etc. It's not really a big deal for the moment since they're disconnect and therefore wouldn't form any part of a path anyway. Now let's get the bots moving around :) |
Re: Recast / Detour
Nice, I remember PMB doing the same steps when he wrote his own implementation to generate navmesh. :)
|
Re: Recast / Detour
Quote:
|
Re: Recast / Detour
I'm not sure. He shows up from time to time about 1 time per 2 years. :D
|
Re: Recast / Detour
When I have more to show I'll try and get in touch. In the meantime I've been doing a bit of housekeeping and created a menu to generate the navmesh and export the map data into my bots own little directory. This will make debugging easier in the future as I had previously done it all in one process.
|
All times are GMT +2. The time now is 07:13. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.