Steve Exploring Stuff: June 2011

2011-06-16

A Quick Death and Building a Sample Pack

I was just browsing the Unity roadmap for 2011.  Oh look!  Navigation mesh generation, pathfinding, and local steering is planned for version 3.5!  The fact they they are adding built-in pathfinding isn't a big surprise.  They've been advertising for AI programmers for a while now, and the first task for AI is almost always pathfinding.  What I'm surprised at is that we may get it by the end of the year.

So, CAINav may have a lifespan of only about 6 months.  At least in Unity.  Luckily, most of my reasons for creating CAINav still apply.  For example, it has been a great project for becoming comfortable with C++, .NET/C++ interop, and Unity plug-in development.

Don't worry, I'm not halting work on CAINav.  Even if it dies with Unity 3.5 I still need its functionality now.  And there is still a lot of good exploration and personal training benefit to continuing development.

On that front, I've been experimenting with CrowdManager. (Local steering.)  It is nice.  When I add animation and locomotion, the agents look quite natural.  Better locomotion handling, such as the ability to side-step and back away, rather than just turning, and it will look great.

The big thing to remember about CrowdManger is that it isn't a silver bullet.  It is one part of the navigation puzzle and has its limits.  Don't succumb to the temptation to just add agents, set targets, and expect it to do everything for you.

It won't do long distance planning.  You will need to implement that separately. In my prototype I plan the long distance path, perform a partial string-pull, then feed CrowdManager a target several waypoints out from the agent's current location.

You also have to build in some edge case handling, such as when slow moving agents meet head on at corners.  They can block each other.

And remember, CrowdManager isn't meant to be used with large crowds.  The goal is to support up to 20 agents in a moderately complex environment, and that seems to be working out.

If you want to see CrowdManger in action, it is available in the new SamplePack.  This is how I'll release most demo's, tutorials, and samples in the future; packaged together in one download.

The demo allows you to add up to 25 agents to the scene and watch their behavior as they wander around at different speeds.  Clicking on an agent will toggle it's debug visualizations.  So you can see the world as CrowdManger see's it.

Still no sample code I'm afraid.  Beside the fact that I am still learning the best ways of using CAINav, there are some licensing and format issues I need to figure out for the models, animations, and support code.

Enjoy the new demo, and stay away from Arizona.

-Steve

2011-06-08

Kicked out the Door: Recast Navigation for .NET and Unity Pro

CAINav is out in the wild.  I kicked it out the door yesterday.

As mentioned in my last post, CAINav gives .NET and Unity Pro users access to almost all of Recast Navigation's features.

It's always fun trying to decide when the first version of new project is ready for release.  Which features to includes is not too difficult.  It just needs to do something useful and do it well.  In CAINav's case, I just had to decide which of Recast Navigation's features to include.  Documentation is another matter.  A project's code and API may be great, but without good documentation its usefulness will be limited.  Especially when the project offers a wide range of complex features.

This release includes API documentation for all features I understand, which is luckily almost all of the mesh generation and pathfinding features. The local steering features are another matter. (Anyone know what 'weightToi' or 'adaptiveDivisions' means?  Me neither. More research needed.) 

Also included is a decent overview of CAINav's structure, some 'getting started' documentation, and a feature explorer application for the pathfinding component.  What I gave up on including in this release is a proper Unity sample/tutorial project.  That's a bummer.  But I can add that over the next month or two.

There are three main reasons CAINav remains in an alpha state:

The local steering features, and some minor features in the other components, need more rigorous automated testing.  Some of these features only have smoke/sanity tests.

I need to add more optimized features.  Low level access is great and necessary.  But there are more efficient ways of marshalling data between the managed code and the native Recast Navigation code.

The Unity Editor ease-of-use components need more work.  I'm not sure how I'm going to implement them all yet, but I'd like to support the more advanced features such as off-mesh connections, areas, and per polygon flags.

Anyway...enjoy, report bugs, ask questions, and don't blame the martians.