Time really flies you’re eagerly awaiting something.

I haven’t been working on Gonna Catcha as much this past week, mostly because I was distracted by the Toronto Game Jam that is happening next weekend: coming up with ideas and eagerly awaiting the confirmation email.  Today, I received note that my team was still on the waiting list of participants (they received ~100 more registrations than spots available).  Here’s hoping that additional spots will become available in the coming week.

I’ve been working on some ideas for the theme music for the TOJam project, this is what I have so far:

Now back to our regularly scheduled programming…

The last thing I was working on for Gonna Catcha was the pathfinding for the Vengeful (left) and Bashful (right) spirits.

As described in this post, Vengeful spirits move toward the position of the player while Bashful spirits move away from the player.  For the former, GameMaker has built-in functions for grid-based pathfinding.  “This will make my job a whole lot easier”, or so I thought. *DUN DUN DUUUUN*
It turned out that the grid-based pathfinding system makes some assumptions on how you’ve setup you sprites, objects and levels (the wording in the documentation does hint to this).  To get the best results, you’ll need to design your game to accommodate the pathfinding system.  Unfortunately, Gonna Catcha is not one of those games.  It bows down to no one.

Below are some screenshots of different test cases with the pathfinding system.  I varied different attributes such as grid cell size and sprite origins.  The paths the Vengeful spirit takes are drawn in white (click to expand):
One of the major issues that I saw in the tests was that the Vengeful spirit sprites were overlapping the walls as they moved through the maze.  This is because the pathfinding algorithm doesn’t take the size or origin of the sprite into account when finding the optimal path.  I did manage to find a combination of sprite settings and cell size that eliminated the overlap (in the bottom-right image), the latter happened to be the old 16×16 cells that I previously abandoned for stifling my creativity.  
There were other nit-picky things that didn’t make the built-in pathfinding system suitable for Gonna Catcha, so I ended up coding my own.  It’s not as sophisticated as the built-in system, but it gets the job done.  In addition, it solved the problem of coming up with a pathfinding algorithm for the fleeing Bashful spirits (which GameMaker doesn’t have natively).  All I did was invert the Vengeful spirits’ algorithm.
Copyright © Quadolor Games. All rights reserved.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.