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

Re: [pygame] Pathfinding



On Wed, Jan 28, 2009 at 4:09 PM, Yanom Mobis <yanom@xxxxxxxxxxxxxx> wrote:
> ...
> I'm just going to make my game tile-based, I guess.
>

Just a tip: you can have tile-based pathfinding without tile based
graphics.  And the tiles don't necessarily have to be the same size as
you might think of when you think "tile".

It depends on how tightly your game is packed, but if it is mostly
wide open spaces, you could have large tiles for pathfinding

------------------------
|             |   RR     |
|     n      |  R    R  |
|             |    RR    |
------------------------
|             |             |
|             |             |
|             |             |
------------------------

If the n needs to go somewhere in the lower right, he can't go through
the tile with the big rock.

If you have very tightly packed levels, you need finer tiles.  If you
have a mix, the tiles could be hierarchial, where pathfinding from far
distances first use the larger tiled map, but pathfinding within one
of those large tiles uses a higher resolution tilemap.

You can also have normal sized tiles for pathfinding.  But the method
used for pathfinding does not need to correspond with the method you
use for graphics.

Brian, I really like that method based on vision tests!  I'm going to
try it out next time I have a game that needs something like that.