Beaster’s Dungeon Revisited: Part III

When I last left off, I managed to get the trap placement mechanic working as designed. Of the core mechanics I needed to get working, the last one remaining was enemy platform pathfinding…

Platform Pathfinding Challenges

As previously stated, the game’s object is to ward off hoards of enemies trying to navigate their way to your treasure vault by placing traps and barriers in their way.

The player can navigate the environment by moving left, right, jumping, and falling.  I wanted to give the enemy a similar capability:

In this scenario, an enemy character can walk left or right and can clear obstacles up to two squares (32x32px tiles) high and three across. Each scenario is numbered and represents the following:

  1. All possible ‘jump’/walk movements from a platform (1-3 across, 2 up)
  2. Walk left or right 1 square
  3. Drop down left or right
  4. Jump up left or right 1 square
  5. Jump up left or right 2 squares
  6. Jump up left or right 2 squares, illustrating that the platform might be floating (i.e. allows free movement beneath it)
  7. Jump across left or right 1 square and up 2 squares
  8. Jump across 2 squares (same height)
  9. Jump across 2 squares and up 1 square
  10. Jump across 2 squares and up 2 squares
  11. Dropdown 1 square left or right from any height to a platform below (this is implied in 3, but I wanted to illustrate it explicitly)
  12. Drop down to a platform of any height, 1 square left or right across
  13. Drop down to a platform of any height, 2 squares left or right across

While I found a couple of examples of this working/implemented in GML using a modified version of the A* Search Algorithm, I could never get them to work within my project. I discussed the problem with my friend Jason, who created a working prototype for me that met all of the design specifications. But not fully understanding how the code worked, I failed to integrate it.

Now that I have the time to troubleshoot it, I’m reluctant to do as I fear that I don’t understand it well enough to support it. Instead, it might be better to build something simpler…

Possible Solutions

Thinking through the problem, there are many other ways I could have solved this. Wrecking Crew for the NES comes to mind:

Enemies (and the player) in Wrecking Crew use ladders to navigate up and down platform levels. Why couldn’t I implement a similar feature?

Ladders

For example, instead of trying to make the enemy AI smart enough to navigate obstacles with a preset of constraints/scenarios, I could have them wander left and right across vertical planes, moving up or down when they reach a ladder, depending on whether the vault was above or below them.

Alternately, rather than placing ladders in fixed places, perhaps some enemy types could create erect them?

Stairs

Another option would be to use teleportation in the form of background staircases:

In this example, the enemies could access specific floors using “staircase” objects that would move them from point A to B and B to C, and vice versa.

Either scenario would necessitate creating two extra animation frames for each enemy sprite. Not a deal breaker, but something to consider…

Published by

Yousef

IT Manager by trade, game developer by heart.

Leave a Reply

Your email address will not be published. Required fields are marked *

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