[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Does anyone have a python implementation of A*?



It's too bad stock python doesn't support continuations, cause they can 
make a big difference for something like A*, especially if you want to 
break processing over a few frames without using, or without the 
overhead and complications of, real threads.

The data structure you end up using for the priority queue is also 
pretty important.. you kinda just have to try a few (and probably a few 
different implementations of each) for your generic data set and see 
what ends up working best, especially in a language like python some of 
the normal optimization rules don't quite apply.

On Friday, February 15, 2002, at 10:26 PM, John Eikenberry wrote:

> Magnus Lie Hetland wrote:
>
>> It seems to me that if you want performance, perhaps a full A* is a
>> bit general? Or, at least, how about doing some preprocessing, or
>> adding some constraints on the terrain generation or something? After
>> all, once you have any kind of information about your problem domain,
>> you can probably do better than in the general case.
>
> I already do a bit of preprocessing. I assume a static map and
> pre-calculate all the terrain costs. I just stick them in a 2D list at
> the moment. I do a couple other small optimizations that aren't in full
> A*. And I am thinking about some game specific optimzations to add
> later.
>
> My goal is to get a base that's as fast as possible, while still being
> understandable, from which to work off. Thus I'm messing around with
> various ways of optimizing it as a general algorithm. I hope more people
> will find useful this way. I am 'planning' on doing a series of various
> AI tools like this (eg. influence maps, flocking algorithms, etc).
>
> --
>
> John Eikenberry
> [jae@zhar.net - http://zhar.net]
> ______________________________________________________________
> "They who can give up essential liberty to purchase a little temporary
>  safety, deserve neither liberty nor safety."
>                                           --B. Franklin
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org