Monday, December 19, 2011

Finally Chapter 3 Beta Port Source

For those who are impatient here is a beta version of my port so far. Following behaviors work:

  • Seek
  • Arrive
  • Pursuit
  • Wander
  • Evade
  • Flee
  • Hide
  • Wall Avoidance
  • Obstacle Avoidance
The way to test all of these for now is to edit the BehaviorTests.h file. You uncomment each behavior, build and run.  Just make sure you uncomment only one behavior. Rest should remain commented!


All of the behaviors work as expected as far as I know. Wander behavior is part of the tests so its not explicitly listed in the tests.


The only quirky behavior is Hide. When you have two agents hiding from a pursuer, at some point the two merge into one. I am not sure how to tweak the settings to keep them apart. Mat's hide executable shows them always separate. Probably needs fine tuning of parameters.


There is much more to code in this chapter. There are still couple of other behaviors and then rest of the render aids like cells rendering, neighbor rendering. And right now the SteeringForce calculated is by using the weighted_sum method. The other two methods which are supposed to be less calculation intensive are yet to be coded.


Its amazing that just by doing vector calculations you can get such realistic behaviors! Have fun staring at the swimming triangles!


SteeringBehavior Objective-C Beta Port : Updated Code with Full source on my next blog...

3 comments:

  1. Hey, this looks great! I'll have to download this and give it a go - think I might have broken the timer implementation in my port, so hopefully yours will get me going again :)

    ReplyDelete
  2. @jawzapps Thanks@. I think I may also revisit my own timer implementation to make the frame rate smoother. It would be interesting to see the performance difference on your iPad between the objective-c port and the c++ version. I only have an iPod touch (3rd gen) to test on and I see frame rates drop on Big Shoal when the agents go above 30-35.

    ReplyDelete
  3. Fantastic! Can't wait to have a look through this!

    ReplyDelete