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

Re: [pygame] AI Module (was: Perlin Noise Function)



On Wed, Jul 30, 2008 at 2:54 PM, kschnee <kschnee@xxxxxxxxxx> wrote:
I was playing recently with the A* pathfinding algorithm and made a
workable version of it:
http://kschnee.xepher.net/code/080721a_star_pathfinding.zip
http://kschnee.xepher.net/pics/080720a_star.jpg

Other things that I could see as useful for a modest AI library (not Pygame
itself) would be a flocking algorithm, and an NPC dialog system comparable
to the one used in "Morrowind." As for the first and A* itself, it's tricky
to make those generic for everyone because each coder will likely use their
own coordinate/movement system. The dialog system would be relatively easy
to make widely usable, as the only input and output would be strings plus
the NPC having access to world-state variables like "dragon_slain = True."
What else might be interesting?

Perhaps it is possible to make the pathfinding code pluggable in some way, allowing you to subclass
a 'Node' class, overriding getx() and gety() functions, as well as allowing you to specify a g() and h() function or something.
This is a level of abstraction higher than the function pygame now offers, so I could again raise the question wethers this belongs in the pygame core. But pathfinding is not an entirely uncommon task, so it might be usefull to integrate.
There's a couple separate python implementations floating around already though. Heck, I implemented it myself once, it's not that hard. It's another piece of code I think would fit quite well in the cookbook.

I think a dialog system qualifies as neither AI nor generalisable. What about customising dialog based on the main characters attributes, or perhaps NPC's speaking amongst eachother (with a player eavsedropping). What about game devs that like the final fantasy/zelda style of dialog more than the Elder Scrolls one? Maybe NPCs should say different things at different times.
And we're not even getting into graphical presentation. It's a very game-specific thing.

What you're proposing are all things that belong in a game engine more than in a lib like pygame.