Re: [pygame] Pathfinding

2009-01-29 Thread Patrick Mullen
On Wed, Jan 28, 2009 at 4:09 PM, Yanom Mobis ya...@rocketmail.com 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

Re: [pygame] Pathfinding

2009-01-29 Thread Yanom Mobis
so I make a tile-based game, then trick the player into believing it's not tile-based? --- On Thu, 1/29/09, Patrick Mullen saluk64...@gmail.com wrote: From: Patrick Mullen saluk64...@gmail.com Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Thursday, January 29, 2009, 12:57 PM

Re: [pygame] Pathfinding

2009-01-29 Thread James Paige
wrote: From: Patrick Mullen saluk64...@gmail.com Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org

Re: [pygame] Pathfinding

2009-01-29 Thread Yanom Mobis
oh --- On Thu, 1/29/09, James Paige b...@hamsterrepublic.com wrote: From: James Paige b...@hamsterrepublic.com Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Thursday, January 29, 2009, 5:00 PM -Inline Attachment Follows- Any 2D space can be divided into tiles

Re: [pygame] Pathfinding

2009-01-28 Thread Michael George
Yanom Mobis wrote: ok, i didn't get any of that There's a mask module in pygame with a Mask class that contains one bit per pixel. It's not in the online docs yet, but in svn head there's a method called convolve that takes in another Mask. If you start with a Mask (lets call it map) which

Re: [pygame] Pathfinding

2009-01-28 Thread Yanom Mobis
I'm just going to make my game tile-based, I guess. --- On Wed, 1/28/09, Michael George mdgeo...@cs.cornell.edu wrote: From: Michael George mdgeo...@cs.cornell.edu Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Wednesday, January 28, 2009, 8:41 AM Yanom Mobis wrote: ok

Re: [pygame] Pathfinding

2009-01-27 Thread Eli Bendersky
Here's a tutorial of pathfinding with A*, specifically for PyGame: http://eli.thegreenplace.net/2009/01/09/writing-a-game-in-python-with-pygame-part-iii/ On Mon, Jan 26, 2009 at 19:01, Michael George mdgeo...@cs.cornell.eduwrote: Marius Gedminas wrote: My personal snag with A* is that the

Re: [pygame] Pathfinding

2009-01-27 Thread Yanom Mobis
ninmonk...@gmail.com Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Monday, January 26, 2009, 10:43 PM Have you played any of the unreal tournament games? The way it pathfinds is like what you're asking. It uses a graph ( a bunch of nodes connecting to each other. It actually pre

Re: [pygame] Pathfinding

2009-01-27 Thread Michael George
Yanom Mobis wrote: is it easier to make the game tile-based? if I make every pixel a node, and there are 2 obstacles really close together, how will I make sure something 20 pixels wide doesn't try to go into a 2 pixel wide opening? One possibility is to use the new convolution code in

Re: [pygame] Pathfinding

2009-01-27 Thread Yanom Mobis
ok, i didn't get any of that --- On Tue, 1/27/09, Michael George mdgeo...@cs.cornell.edu wrote: From: Michael George mdgeo...@cs.cornell.edu Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Tuesday, January 27, 2009, 4:38 PM Yanom Mobis wrote: is it easier to make the game

Re: [pygame] Pathfinding

2009-01-27 Thread Casey Duncan
On Jan 27, 2009, at 3:36 PM, Yanom Mobis wrote: is it easier to make the game tile-based? Probably, but it really depends on the details. if I make every pixel a node, and there are 2 obstacles really close together, how will I make sure something 20 pixels wide doesn't try to go

Re: [pygame] Pathfinding

2009-01-27 Thread Yanom Mobis
Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Tuesday, January 27, 2009, 5:06 PM On Jan 27, 2009, at 3:36 PM, Yanom Mobis wrote: is it easier to make the game tile-based? Probably, but it really depends on the details. if I make every pixel a node, and there are 2

Re: [pygame] Pathfinding

2009-01-27 Thread Casey Duncan
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

Re: [pygame] Pathfinding

2009-01-27 Thread Brian Fisher
Hey Yanom, Hmm... your game is probably not tile-based? sounds like you aren't very far along yet... I think you may be worrying a bit too much about pathfinding now. The truth of the matter is there is no single solution to pathfinding. There isn't even a best solution. There are some common

Re: [pygame] Pathfinding

2009-01-26 Thread Marius Gedminas
On Sun, Jan 25, 2009 at 07:16:38PM -0800, Yanom Mobis wrote: 1) How is pathfinding done? There are algorithms for it. Breadth-first search is the simplest one and works well for grids where the distance between nearby cells is the same. Dijkstra is a generalization that works for arbitrary

Re: [pygame] Pathfinding

2009-01-26 Thread evil monkey
I used this AStar in some of my games, and it works very well: http://www.pygame.org/projects/9/195/ On Sun, 25 Jan 2009 19:16:38 -0800 (PST) Yanom Mobis ya...@rocketmail.com wrote: 1) How is pathfinding done? 2) How do you prevent a moving sprite from being caught in a v-shaped rut made

Re: [pygame] Pathfinding

2009-01-26 Thread Michael George
Marius Gedminas wrote: My personal snag with A* is that the NPCs seem to know too much about the map and directly walk the most optimal path without exploration. One possibility to solving this is to have the npc move as it's performing the algorithm. i.e. as your search explores a path,

Re: [pygame] Pathfinding

2009-01-26 Thread Jake b
This is the best A* Pathfinding tutorial, ever: http://theory.stanford.edu/~amitp/GameProgramming/http://theory.stanford.edu/%7Eamitp/GameProgramming/ -- Jake

Re: [pygame] Pathfinding

2009-01-26 Thread John Eikenberry
evil monkey wrote: I used this AStar in some of my games, and it works very well: http://www.pygame.org/projects/9/195/ I wrote an A* implementation awhile back for civil that might make another good example. Mine is a little different from the others I've seen as it can handle a few

Re: [pygame] Pathfinding

2009-01-26 Thread Brian Fisher
On Sun, Jan 25, 2009 at 7:16 PM, Yanom Mobis ya...@rocketmail.com wrote: 1) How is pathfinding done? So what are your pathfinding needs? what exactly is the character or game element that you need pathfinding for doing? or is this just research for you? On Mon, Jan 26, 2009 at 12:53 AM, Marius

Re: [pygame] Pathfinding

2009-01-26 Thread Michael George
Brian Fisher wrote: On Mon, Jan 26, 2009 at 9:01 AM, Michael George mdgeo...@cs.cornell.edu mailto:mdgeo...@cs.cornell.edu wrote: One possibility to solving this is to have the npc move as it's performing the algorithm. i.e. as your search explores a path, the character walks along that

Re: [pygame] Pathfinding

2009-01-26 Thread Mike C. Fletcher
John Eikenberry wrote: evil monkey wrote: I used this AStar in some of my games, and it works very well: http://www.pygame.org/projects/9/195/ ... http://zhar.net/projects/gameai/ There are a few other python implementations of A* that I know of as well. They are also linked to

Re: [pygame] Pathfinding

2009-01-26 Thread René Dudfield
hi, the pygame.org page has a few pathfinding things here: http://pygame.org/tags/pathfinding Also, using the google search of the pygame website, you can find games that also use pathfinding in them. A lot of the classic algorithms are represented... Dijkstra's, A*, and breadth first.

Re: [pygame] Pathfinding

2009-01-26 Thread Yanom Mobis
it seems to me that A* only works on tile-based games. What if my game isn't tile-based? --- On Sun, 1/25/09, Noah Kantrowitz n...@coderanger.net wrote: From: Noah Kantrowitz n...@coderanger.net Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Sunday, January 25, 2009, 9:20 PM

Re: [pygame] Pathfinding

2009-01-26 Thread Yanom Mobis
and the like. --- On Mon, 1/26/09, Brian Fisher br...@hamsterrepublic.com wrote: From: Brian Fisher br...@hamsterrepublic.com Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Monday, January 26, 2009, 11:55 AM On Sun, Jan 25, 2009 at 7:16 PM, Yanom Mobis ya...@rocketmail.com wrote: 1

Re: [pygame] Pathfinding

2009-01-26 Thread Douglas Bagnall
Yanom Mobis wrote: I need to have an npc take a relatively short route from a to b. First priority isn't the shortest distance, it's getting there without getting stuck My game is in a futuristic setting, so taking the shortest path without exploring too much is reasonable because

Re: [pygame] Pathfinding

2009-01-26 Thread NBarnes
it seems to me that A* only works on tile-based games. What if my game isn't tile-based? A* works on 'nodes', where a node is just some location defined in the game space. Tile-based games have a very obvious node structure to them, and so A* is very easily adapted to them. But, really,

RE: [pygame] Pathfinding

2009-01-26 Thread Noah Kantrowitz
is a vast understatement. --Noah From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On Behalf Of Yanom Mobis Sent: Monday, January 26, 2009 3:39 PM To: pygame-users@seul.org Subject: Re: [pygame] Pathfinding it seems to me that A* only works on tile-based games. What

Re: [pygame] Pathfinding

2009-01-26 Thread Bill Coderre
On Sun, Jan 25, 2009 at 09:13:28PM -0800, Bill Coderre wrote: There are still ways that this can get confused or beaten, of course. Until someone comes out with a low-cost traveling-salesman solver, however, whatever algorithm you find will have some snags. On Jan 26, 2009, at 12:53 AM,

Re: [pygame] Pathfinding

2009-01-26 Thread Joe Strout
Yanom Mobis wrote: it seems to me that A* only works on tile-based games. What if my game isn't tile-based? I'm not sure you think that. A* (or any other pathfinding algorithm) will work for any search tree. You do need some sort of heuristic, though, that estimates how far any given

Re: [pygame] Pathfinding

2009-01-26 Thread Kris Schnee
Yanom Mobis wrote: 1) How is pathfinding done? 2) How do you prevent a moving sprite from being caught in a v-shaped rut made of obstacles? Like this: __ A - # | B __| Others have already talked about the A* Algorithm

RE: [pygame] Pathfinding

2009-01-26 Thread Yanom Mobis
a graph, as in just a regular x, y kind of thing? I don't need an overly complex library, is something less complex available? --- On Mon, 1/26/09, Noah Kantrowitz n...@coderanger.net wrote: From: Noah Kantrowitz n...@coderanger.net Subject: RE: [pygame] Pathfinding To: pygame-users@seul.org

Re: [pygame] Pathfinding

2009-01-26 Thread Yanom Mobis
Complex distance evaluation isn't necessary, but the sprite never getting stuck is. --- On Mon, 1/26/09, Joe Strout j...@strout.net wrote: From: Joe Strout j...@strout.net Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Monday, January 26, 2009, 6:11 PM Yanom Mobis wrote

Re: [pygame] Pathfinding

2009-01-26 Thread Yanom Mobis
My game isn't tile-based (probably, I haven't made it yet), but it is 2-d --- On Mon, 1/26/09, NBarnes nbar...@gmail.com wrote: From: NBarnes nbar...@gmail.com Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Monday, January 26, 2009, 6:10 PM it seems to me that A* only works

Re: [pygame] Pathfinding

2009-01-26 Thread René Dudfield
: From: Joe Strout j...@strout.net Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Monday, January 26, 2009, 6:11 PM Yanom Mobis wrote: it seems to me that A* only works on tile-based games. What if my game isn't tile-based? I'm not sure you think that. A* (or any

RE: [pygame] Pathfinding

2009-01-26 Thread Noah Kantrowitz
: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On Behalf Of Yanom Mobis Sent: Monday, January 26, 2009 5:12 PM To: pygame-users@seul.org Subject: RE: [pygame] Pathfinding a graph, as in just a regular x, y kind of thing? I don't need an overly complex library, is something less

Re: [pygame] Pathfinding

2009-01-26 Thread Joe Strout
Yanom Mobis wrote: Complex distance evaluation isn't necessary, but the sprite never getting stuck is. The sprite will never get stuck with any of the algorithms we have discussed. And you're right, you don't need a complex distance evaluation for A* -- a simple one will do. (Though the

Re: [pygame] Pathfinding

2009-01-26 Thread Yanom Mobis
so is A* the easiest to use? --- On Mon, 1/26/09, Joe Strout j...@strout.net wrote: From: Joe Strout j...@strout.net Subject: Re: [pygame] Pathfinding To: pygame-users@seul.org Date: Monday, January 26, 2009, 8:14 PM Yanom Mobis wrote: Complex distance evaluation isn't necessary

Re: [pygame] Pathfinding

2009-01-26 Thread Joe Strout
Yanom Mobis wrote: so is A* the easiest to use? They're all about the same; they differ only in what order new nodes are examined. If you have a cost function (which you do), you can do a least-cost search. If you also have a heuristic (which I think you do), you can do A*. They'll both

Re: [pygame] Pathfinding

2009-01-26 Thread Jake b
Have you played any of the unreal tournament games? The way it pathfinds is like what you're asking. It uses a graph ( a bunch of nodes connecting to each other. It actually pre-calculates pathfinding, but you don't need to worry about that at first ) The link posted has a good image:

[pygame] Pathfinding

2009-01-25 Thread Yanom Mobis
1) How is pathfinding done? 2) How do you prevent a moving sprite from being caught in a v-shaped rut made of obstacles? Like this: __ A - # | B __| Where A and B are the points the sprite needs to travel, # is the sprite, - is the direction the

Re: [pygame] Pathfinding

2009-01-25 Thread Noah Kantrowitz
1) People can, and do, get PhDs in pathfinding algorithms. A* (pronounced a-star) is the most commonly used algorithm in games though. 2) Alter the chain length score computation to reduce exploitation. --Noah On Jan 25, 2009, at 7:16 PM, Yanom Mobis wrote: 1) How is pathfinding done? 2)

Re: [pygame] Pathfinding

2009-01-25 Thread Bill Coderre
On Jan 25, 2009, at 7:16 PM, Yanom Mobis wrote: 1) How is pathfinding done? 2) How do you prevent a moving sprite from being caught in a v- shaped rut made of obstacles? Like this: __ A - # | B __| Where A and B are the points the sprite needs