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

Re: [pygame] Pathfinding



Any 2D space can be divided into tiles, even if it is not really made of 
tiles.

So maybe a better way of looking at it is to make a non-tile-based game 
and trick the pathfinding code into believing it is tile-based.

---
James Paige

On Thu, Jan 29, 2009 at 02:42:56PM -0800, Yanom Mobis wrote:
>    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 <saluk64007@xxxxxxxxx> wrote:          
>                                                                               
>      From: Patrick Mullen <saluk64007@xxxxxxxxx>                              
>      Subject: Re: [pygame] Pathfinding                                        
>      To: pygame-users@xxxxxxxx                                                
>      Date: Thursday, January 29, 2009, 12:57 PM                               
>                                                                               
>      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.