Page 1 of 4

Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 12:57 pm
by syedhs
Hi,

Actually last month I stumbled upon this website (MIT license anyone :) ) - http://code.google.com/p/recastnavigation/.

Has anyone actually used this and thus, can give comment on usage, correctness etc? I also found this quite nice 'review' by Pierre Terdiman - http://www.codercorner.com/blog/?p=325.

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 3:07 pm
by jacmoe
I am using it. :)
Was lucky enough to try the preview version of it.
It's really good - though still pretty young.
Zero tolerance with input meshes, which means I had to clean up every single one of the stock Ogre meshes..
I think he's working on that..

Yet, it's by far the best implementation of navmesh generation I'd be able to find - if not the only one which actually works. :D
With time, this will make hand-editing of navigation meshes for indie projects a rare thing.

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 3:22 pm
by nikki
jacmoe, did you manage to compile the demo under Linux?

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 4:42 pm
by jacmoe
I works in OSX, so why not on Linux?
But, I haven't - yet. :)

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 6:43 pm
by xavier
jacmoe wrote:I works in OSX, so why not on Linux?
Probably because they are two completely different source build configuration and package management systems and philosophies?

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 8:09 pm
by nikki
Yup.

He didn't give any makefiles, so I'll probably have to make some myself. :roll: Or ask him whether he could. Maybe Code::Blocks has a VS 2008 -> Code::Blocks I could use though. I don't have Code::Blocks installed, but I'll go get it now.

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 9:53 pm
by jacmoe
xavier wrote:
jacmoe wrote:I works in OSX, so why not on Linux?
Probably because they are two completely different source build configuration and package management systems and philosophies?
Probably because both OSX and Linux is *nix ?

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 9:57 pm
by nikki
Hm, I was talking more about the project management system. The project itself seems to be in C/C++ and uses only standard libraries so I'm sure it'll compile in any decent environment.

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 10:53 pm
by jacmoe
That's what I meant.
That it works on Windows and Mac indicates that the code is portable.
Maybe I can put together a CMake script for it.. :wink:

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 11:47 pm
by nikki
jacmoe wrote:Maybe I can put together a CMake script for it.. :wink:
Good. I hate writing makefiles (and similar stuff). :)

Re: Recast - Open Source Alternative to PathEngine

Posted: Thu Sep 10, 2009 11:48 pm
by xavier
nikki wrote:
jacmoe wrote:Maybe I can put together a CMake script for it.. :wink:
Good. I hate writing makefiles (and similar stuff). :)
Bah nobody writes makefiles anymore :P

Re: Recast - Open Source Alternative to PathEngine

Posted: Fri Sep 11, 2009 12:01 am
by jacmoe
I actually managed to maintain build scripts for VC7, VC8, Code::Blocks windows, Code::Blocks Linux and plain old makefiles, until I discovered CMake.
You can say what you want about CMake, but it sure makes it a whole lot easier to manage. :)

Re: Recast - Open Source Alternative to PathEngine

Posted: Fri Sep 11, 2009 12:12 am
by RedEyeCoder
This is really cool...
I played with the demo and was impressed. Look out PE!

Re: Recast - Open Source Alternative to PathEngine

Posted: Fri Sep 11, 2009 12:33 am
by nikki
xavier wrote:
nikki wrote:
jacmoe wrote:Maybe I can put together a CMake script for it.. :wink:
Good. I hate writing makefiles (and similar stuff). :)
Bah nobody writes makefiles anymore :P
Yeah well, I used 'makefile' as a kind of synecdoche.

And jacmoe, get done withe the CMake script already! I wanna play with this thing. :P

Re: Recast - Open Source Alternative to PathEngine

Posted: Fri Sep 11, 2009 2:32 pm
by jacmoe
I need to do one because it's going into Ogitor as a plugin.. :wink:

Re: Recast - Open Source Alternative to PathEngine

Posted: Fri Sep 11, 2009 5:15 pm
by xadhoom
jacmoe wrote:I need to do one because it's going into Ogitor as a plugin.. :wink:
Yeehaaa! :D

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 8:54 am
by jacmoe
nikki wrote:And jacmoe, get done withe the CMake script already! I wanna play with this thing. :P
I have it ready now. :wink:
recast_linux.png
recast_linux.png (200.35 KiB) Viewed 10163 times
I had to fix some scoping issues (jump to label crosses initialization of var blah..), a couple case sensivity fixes, and then I had to comment out a call to qsort_r which apparently is implemented differently on each platform..

Put this in project root:

Code: Select all

######################################################################
# Recast BUILD SYSTEM
######################################################################

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

# Works around warnings libraries linked against that don't
# have absolute paths (e.g. -lOgreMain)
cmake_policy(SET CMP0003 NEW)

# Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements.
cmake_policy(SET CMP0005 NEW)

Project (Recast)

if (CMAKE_BUILD_TYPE STREQUAL "")
  # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
  # differentiation between debug and release builds.
  set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()

SET(CMAKE_DEBUG_POSTFIX "_d")

FIND_PACKAGE(OpenGL REQUIRED)

Find_Package ( SDL REQUIRED )
#Find_Package ( SDL_image REQUIRED ) # if using SDL_image

# Workaround for the non-working REQUIRED flag
if ( NOT SDL_FOUND )
   message ( FATAL_ERROR "SDL not found!" )
endif ( NOT SDL_FOUND )

include_directories(${OPENGL_INCLUDE_DIR})
include_directories(${SDL_INCLUDE_DIR})
include_directories(Recast/Include)
include_directories(Detour/Include)
include_directories(RecastDemo/Include)
include_directories(RecastDemo/Contrib)

add_subdirectory(RecastDemo)

And this goes in the RecastDemo directory:

Code: Select all

file(GLOB RECAST_H_FILES ../Recast/Include/*.h)
file(GLOB RECAST_CPP_FILES ../Recast/Source/*.cpp)
file(GLOB DETOUR_H_FILES ../Detour/Include/*.h)
file(GLOB DETOUR_CPP_FILES ../Detour/Source/*.cpp)
file(GLOB RECAST_DEMO_H_FILES Include/*.h)
file(GLOB RECAST_DEMO_CPP_FILES Source/*.cpp)

SET(RECAST_DEMO_SOURCES
    ${RECAST_H_FILES}
    ${RECAST_CPP_FILES}
    ${DETOUR_H_FILES}
    ${DETOUR_CPP_FILES}
    ${RECAST_DEMO_H_FILES}
    ${RECAST_DEMO_CPP_FILES}
)
ADD_EXECUTABLE(RecastDemo WIN32 ${RECAST_DEMO_SOURCES})

TARGET_LINK_LIBRARIES(RecastDemo ${OPENGL_LIBRARIES} ${SDL_LIBRARY})

A quick CMake script, but enough to get started.
I now need to hook it up with my Ogre code, and put in a CMake flag to allow us to turn SDL off and Ogre on.

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 9:10 am
by jacmoe
And the patch:
recast_linux_patch.txt.tar.gz
(2.06 KiB) Downloaded 267 times

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 11:22 am
by jacmoe
It is still using libSDL, but I plan to make a flag in the CMake script and toss in an Ogre debug render module.
The GUI will probably be done using AntTweakBar. :wink:

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 3:01 pm
by nikki
He's assumed everyone's on 32bit. :?

In 64bit, sizeof(int) != sizeof(int*), so I get this:

Code: Select all

RecastFilter.cpp:49: error: cast from ‘rcSpan*’ to ‘int’ loses precision

...

RecastFilter.cpp:

48: const int bot = (int)s->smax;
49: const int top = (int)s->next ? (int)s->next->smin : MAX_HEIGHT;
50:

...

I can edit out the casts, but still...

EDIT: Ok, built it, now when I try to run the demo, I get: "Could not init GUI renderer.".

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 3:11 pm
by jacmoe
Move it to Recast source RecastDemo/bin. :wink:

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 3:13 pm
by jacmoe
nikki wrote:He's assumed everyone's on 32bit. :?
Scratch your itch. :wink:
It's a bit hard to develop for 64bit when you're not on that platform.

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 3:18 pm
by nikki
jacmoe wrote:
nikki wrote:He's assumed everyone's on 32bit. :?
Scratch your itch. :wink:
It's a bit hard to develop for 64bit when you're not on that platform.
True to an extent. :roll: "it compiles? ship it!" doesn't sound like a very good idea though...

Anyway, this is some awesome stuff, so I'm fine with it. :) I got the demo working. Maybe I should put some pathfinding enemies in GraLL 2 now.

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 3:52 pm
by jacmoe
nikki wrote:True to an extent. :roll: "it compiles? ship it!" doesn't sound like a very good idea though...
Oh - is that all you can muster, Mr. Hot Shot ? :)
I've noticed that you're getting more and more cocky lately - does Git do that to people? Or maybe 64 bit Linux?
If you're so clever, why not help out by sending a patch or two?

I admit openly that I am utterly impressed by this project - and I find it very hard to believe that it's put up on Google Code under the MIT license.

Whats wrong with Release Early, Release Often - ever heard of that? :P

<edit>I noticed that Memoni just registered - so watch out Nikki. :) </edit>

<edit2>
nikki wrote:And jacmoe, get done withe the CMake script already! I wanna play with this thing. :P
And not even a thank you do I get ... :cry:
</edit2>

Re: Recast - Open Source Alternative to PathEngine

Posted: Sat Sep 12, 2009 3:59 pm
by nikki
You're right, I'm sorry. :(

I said I'm fine with it. I like the project too, as I said already. :mrgreen: Of course he'd rather concentrate on the actual meat than portability and stuff, sure. Can't wait to see the progress. :)

Thanks a lot for the CMake script!

...

C'mon nikki is your good Ogre friend don't take him too seriously, it makes him feel bad. :cry:

BTW,
I've noticed that you're getting more and more cocky lately - does Git do that to people? Or maybe 64 bit Linux?
Do you have any links to other posts I've done that? I can't improve without seeing what the problem is..