Recast - Open Source Alternative to PathEngine

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 47

Recast - Open Source Alternative to PathEngine

Post 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.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post by nikki »

jacmoe, did you manage to compile the demo under Linux?

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post by jacmoe »

I works in OSX, so why not on Linux?
But, I haven't - yet. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Recast - Open Source Alternative to PathEngine

Post 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?
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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 ?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post by nikki »

jacmoe wrote:Maybe I can put together a CMake script for it.. :wink:
Good. I hate writing makefiles (and similar stuff). :)

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Recast - Open Source Alternative to PathEngine

Post 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
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
RedEyeCoder
Gnome
Posts: 344
Joined: Sat Jun 16, 2007 7:29 am
Location: Brisbane, Australia

Re: Recast - Open Source Alternative to PathEngine

Post by RedEyeCoder »

This is really cool...
I played with the demo and was impressed. Look out PE!

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post by jacmoe »

I need to do one because it's going into Ogitor as a plugin.. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: Recast - Open Source Alternative to PathEngine

Post by xadhoom »

jacmoe wrote:I need to do one because it's going into Ogitor as a plugin.. :wink:
Yeehaaa! :D

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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 6532 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.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post by jacmoe »

And the patch:
recast_linux_patch.txt.tar.gz
(2.06 KiB) Downloaded 107 times
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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.".

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post by jacmoe »

Move it to Recast source RecastDemo/bin. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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>
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: Princeton, New Jersey, USA
x 13
Contact:

Re: Recast - Open Source Alternative to PathEngine

Post 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..

Post Reply