Sign in to follow this  
Hayer

Stuck with some 2d pathfinding

Recommended Posts

Hayer    122
Hi

A problem that has been on my mind lately is pathfinding in my new game. Its a 2d platformer and uses Chipmunk for physics.

In my other small projects when I implented pathfinding I had something like
bool[SizeX,SizeY] Map;

which decided which tile was empty or not.
So here is my problem;

Scenario:
Barrel falling down(cause of gravity) and overlapps two tiles?


I was thinking something like collision-meshes-alike system, but how would I use that for a pathfinding function?

Share this post


Link to post
Share on other sites
LorenzoGatti    4443
The halfway barrel counts either as an obstacle in both tiles, or an obstacle in one tile and negligible in the other.
You need to check for moving obstacles in addition to the static obstacles stored in the mentioned boolean array.
Really smart pathfinding would predict the future positions of barrels: a barrel that falls out of the way before it can be reached is no obstacle at all, while distant barrels can become obstacles in a far future part of the path being computed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this