[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pathfinding



On Jan 27, 2009, at 4:48 PM, Yanom Mobis wrote:

my game is 2d, but probably not tile-based.

Ok, in that case a rectangle with a width equal to the frontal width of the thing parallel to the path will do. Or you could march a rectangle or circle down the candidate path to check for collisions.

so your saying I can make it do only a few iterations per turn?

It would scale much better that way, but may not be necessary if you are pathfinding for a small number of things. It all becomes vastly faster in 2D anyway 8)

how about doing the whole calculation beforehand, then not having to do many calculations?

Depends on whether there are few enough possible paths to do this in a small enough amount of time and memory. Tiling can help here because paths can be constrained by simple rules, still there can be too many possible start and end points to calculate ahead.

-Casey