Jimmy Chattin - I make better games.

Friday, March 23, 2012

Move Your AI - Mami Update

Did you know that basic AI algorithms are really easy to code?  Did you know that the difference between a global location and a local point in Flash Actionscript is a pain, especially when the loaded section of level is dynamically moving?  This is what has been happening on the code side of Mami this week.

Mr. Boyd (a fellow with much practice behind AS3, and Team Squaybies’s main programmer) and I have been teaming-up on getting the first iteration of game enemies to effectively patrol, chase, and return to their starting positions.  The patrolling is very easy, and the enemy scrolls effectively as the screen shifts position.  However, the main concern at the moment is handling chase sequences.

To chase the player, the enemy checks its global distance on updating to the player’s global position, and if it violates a range of attraction, the enemy is to go to the player’s location.  If the player runs away, after a set distance, the enemy is to return to where it started and continue patrolling its little area.  The issue is that there is an inconsistency between the difference of player and enemy on a global level; the quadtree design is not handled on any forum or board (at least those that show on Google’s first page!).

Even with a little bit of setback, Boyd and I are well on our way to finding the solution.  With various checks of location and difference, we are narrowing down the possible culprits of causation to our issue.  Hopefully on Monday we’ll be done with this story, and can move on to further programming needs!

Take care until that update.  Be prepared for a Perpetuam Memoriam (Global Game Jam ’12) update very soon!

No comments:

Post a Comment