Tuesday, April 19, 2011

Huzzah!

Prior to my beta review, I had been struggling to understand how the agent behavior tree would direct changes in the agent's path.  Feedback from my beta review helped to clarify this.  The behavior tree will simply change the edge weights in the graph representation of the world.  My agent will recalculate its path every frame to react to these weight changes.

The first step in implementing this design is to have my agent recalculate its path every frame.  At first, I ran into some memory issues.. eek.


I resolved this by revising my pathfinder code.  Instead of returning the entire path, the pathfinder function now only returns the next node in the path.  This is sufficient since the path will be recalculated every frame (so returning the entire path is excessive).  Out of memory error fixed.

I still had to tackle my bug from my previous post, where the agent would stop before arriving at the target.  I identified the bug in my graph representation, where I was handling obstacle corners incorrectly.  I was creating a diagonal edge around a corner when I shouldn't have.  I fixed this bug, and huzzah!  See the video to watch my agent arrive at its target location.  (Again, the non-smooth movement is an issue with the recording's frame rate.)

No comments:

Post a Comment