Horde3D

Next-Generation Graphics Engine
It is currently 24.11.2024, 05:18

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 26.11.2012, 13:17 
Offline

Joined: 23.07.2009, 21:03
Posts: 51
Location: Germany
Hello everybody.
I just committed a first version of my RecastNavigation Demo Project into the public GameEngine SVN. I started the project because I needed global-pathfinding support in my master's thesis and the RecastNavigation project by Mikko Mononen provided the solution for this. Thanks to the support of HCM department at the University of Augsburg I've now been able to take the time to clean up the code and migrate it to the public SVN.

The project is an integration of the original RecastDemo into a Hord3D application. The original RecastNavigation project can be found here. There is an .exe file in the RecastDemo/bin folder if you want to check out the original demo.


Pictures:
Image Image Image Image Image


So, what is this:
A copy of the original demo with a few changes:
  • Horde3D is used to render Horde3D-models
  • All the OpenGL code and the GUI of the original RecastDemo gets drawn after the Horde3D renderer finalized its frame.
  • Instead of loading .obj files, the demo can load Horde3D Editor scene files (using the modified GUI).
  • Navigation meshes can be build by specifying which Horde3D nodes or Horde3D meshes should be used for the navmesh generation (using a xml file).
  • All the original demo's variables, settings, navmesh-testing capabilities (e.g. by using the crowd module), and saving/loading functionalities should be working.
  • Like the original demo, this project can be used to generate a navmesh for a scene, add Off-Mesh Links or Convex Volumes, and save it as a binary file.

Instructions (VisualStudio 2010/2012 only):
  • You can find a Visual Studio 2010/2012 solution in the Tools/RecastNavigation folder.
  • Open the solution and make sure the RecastNavigationSample project is set up as the startup project.
  • Build and run the solution.
  • Chose a sample mesh from the list.
  • Chose one of the navMesh config files.
  • Once the files are loaded you can build the navmesh by scrolling down in the properties window and hitting "Build".

Some stuff to play with:
  • When using the beergarden scenario: In the Properties window, use the TileMesh as Sample. Select InputMesh as the Draw Mode at the bottom of the Properties window. Change the Agent's Max Slope setting to see the InputMesh changing (dependent on the terrains slope). Try 17 and rebuild the navmesh to get a nice path up the hill (change the draw mode back to NavmeshTrans).
  • Use the Tools window to create some agents to test the navmesh.

How to use your own scene generated with the Horde3D Editor: (If you never used the Editor before, have a look at this )
  • Have a look at the navMesh_X_.config.xml files in the Demo's project folder: Tools/RecastNavigation/Applications/RecastNavigationSample/Content
  • Copy one of those files and replace the ContentDirectory with the path to your scene's content folder. You can use an absolute path.
  • Replace the SceneXMLFile path with your scene file, relative to the content folder (e.g. models/myTetrisClone.scene.xml).
  • Set the nodes and/or meshes in the <NavigationMeshResources> group. You need to know your nodes/meshes names for this. Pressing F2 in the demo should help with that :) .
  • You can edit and save the config file while the application is running. Just load the config file again after saving it outside of the demo.
  • The scene's scale is important. It makes sense to have your scene scaled in a realistic way (e.g. a character's height ~ 1.8 meters). The Horde3D Editor can display a 1 meter grid to help with that.

Implementation Details:
Since the global pathfinding is only a small part of my thesis I tried to reuse as much of the existing code as possible. Integrating the NavMesh generation into the Editor would have been an option, but would have meant a lot of Qt/GUI work. Thus, I decided to make a new application that could be seen as a stand alone "NavigationMesh Editor" for Horde3D".
So what I did is compiling the RecastDemo project as a static lib and replacing the main.cpp with a MyRecastDemo.cpp/.h, which meant copy-pasting a lot of the main.cpp code by Mikko Mononen and adding a interface. I used one of the Horde3D samples as the base application and replaced all the original RecastDemo's SDL dependencies with GLFW. The project's app.cpp and the MyRecastDemo.h in the RecastDemo project handle all the communication between the Horde3D app and the original RecastDemo.
MeshLoaderH3DGeo.cpp (\Tools\Dependencies\RecastNavigation\RecastDemo\Source) handles the Horde3D geometry and is obviously based on the original obj-file MeshLoader. Here, the navMesh_X_.config.xml file gets parsed for HordeNodes/-Meshes, which have been loaded before using the extended recast GUI (loading happens in the MyRecastDemo.cpp ).
The time consuming parts were: understanding the demo's architecture, finding out what code to migrate into new files, writing a working Horde3D geometry loader, and finding a working solution for all the linking/including/dependency problems that needed to be taken care of ;) .


General Recast & Detour information:

Todo:
  • Linux/Mac support. I currently only have a Windows environment set up using VS 2010/2012. Linux support would be nice, but I don't have the time/experience to provide a solution at the moment.
  • Support for a GameEngine attachment (search for these attachments instead of specifying the nodes/meshes in the config file). And adding this attachment to the Horde3D Editor.
  • There is a problem with the round table model (in the beergarden scenario). I'm not sure whether it's a problem with my Horde3D-geometry loading code, or whether the model is 'defect' in some way. If anybody detects problems with other geometry files, please let me know.
  • Publish GameEngine Components that can use a saved navmesh. I have some basic components working in my personal project, as shown in this thread: viewtopic.php?f=4&t=1685 . I'll start integrating these components into the AdvancedAgentAnimation project and publish them 'soon'.

Cheers


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group