Advertisement

Platformer Path Planning

Started by May 28, 2010 06:49 AM
1 comment, last by SIAS87 14 years, 8 months ago
Hi, I am currently developing a 2d platformer type game. In this game there will feature NPC characters which need to traverse the various platforms by jumping. Each NPC will have different capabilities, especially in their maximum jump height, maximum speed and other factors which directly impact their jumping abilities and ultimately the jump trajectory. I was planning to use a waypoint graph along with A* to plan paths to locations within the level. The problem i am stuck on is trying to represent jumps to platforms. And determining whether a particular NPC can reach a platform based on the NPC's capabilities. In my waypoint graph should i link platforms together and then test each edge against the NPC to see whether it can be traversed? I was wondering if this was a good way to approach the problem or is there any more suitable techniques? Any help would be greatly appreciated John
Quote:
In my waypoint graph should i link platforms together and then test each edge against the NPC to see whether it can be traversed?
For static platforms, this seems like a reasonable solution.

You could, for example, associate data with each edge such as its 'type' (e.g. from one point on a platform to another point on the same platform, or from one platform to another platform), and for platform-to-platform edges, whether it's a jump down or up, and the horizontal and vertical distances for the jump. Your A* code would then examine this data to determine whether an edge is traversable (e.g. based on a character's maximum jump height and jump distance), and what the cost is (for example, some characters might have a preference for 'easier' jumps).
Advertisement
Thanks for the reply. I like the idea of defining different edges and contained within them are the jump requirements, seems a nice approach.

I hadn't even considered moving platforms though, which I would want to integrate further down the line. Any ideas for how you would perform that?
I suppose it would require dynamic testing of points on the platform and other platforms nearby and then add platform to platform edges to the pathplanning graph at run time.
Or i suppose i could create the edges to other platforms on loading the map then just update the jump requirements at each update based on the platforms current position.

Thanks for your help

This topic is closed to new replies.

Advertisement