The Daily Click ::. Forums ::. Klik Coding Help ::. Trouble with the pathfinding object
 

Post Reply  Post Oekaki 
 

Posted By Message

Tristan Clark



Registered
  28/07/2003
Points
  159
26th February, 2005 at 03:13:08 -

Hi guys,
I've just got the pathfinding object working, but there's two problems:
First, after clicking around a few times on the screen, with the main guy following ok, the whole thing freezes. This seems to be the pathfinding object calculating a path, because sometimes it unfreezes, but usually not. Is there anything wrong I'm doing?
Second, it seems to sometimes take some crazy routes. Is this avoidable?
Here's my code to show you what I'm doing: http://www.geocities.com/mcalphabet/b.zip

Cheers.

Image Edited by the Author.

Possibly the reason is because my start and destination points are always changing, and it can't handle it after a while. Problem is, I need it to do that, because otehrwise it doesn't work properly...

Image Edited by the Author.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
26th February, 2005 at 12:19:29 -

this works for me at least;

http://free.angeltowns.com/spacecadet/b2.zip

personally, i use mohktars grid object as it has some extra features.

 
n/a

Tristan Clark



Registered
  28/07/2003
Points
  159
26th February, 2005 at 15:17:59 -

Hey, that works, cheers!

I started using the grid object, but it seemed to crash all the time. Are there any exmaples floating around that work?

Edit: Actually, it still sometimes freezes, and the pathfinding can still be wildly innacurate. So maybe examples for the grid object would be great.

Image Edited by the Author.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
26th February, 2005 at 19:41:43 -

the grid object isnt really very different in the way you use it, and it even has a decent help file included.

the main difference is that you have one expression (evaluate path) that sets the start & destination points, and searches for a path, instead of 3 separate ones. the string you use is just a unique name to let you store several paths at once.

if you want to make obstacles you use the "define map tile" condition and set the weight to a number higher than the one you specify as the "impassable weight" when you evaluate a path.

if you can use the pathfinding extension you shouldnt have any trouble with the grid one. i've always found it pretty stable for what i've been trying to do (check the help though cos some features arent available as its only a beta). not sure if there are any examples - i know there i spent ages looking in vain for them myself when i was experimenting with it, but that was a long time ago. i might try and redo yours using the grid instead if i get time (no promises though).

i've tested my "fix" some more, and i still cant get it to crash or behave erratically - no idea why it doesnt work on yours (and i have a seriously slow pc so i dont think its anything to do with that).

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
26th February, 2005 at 20:17:55 -

The example you gave SpaceCadet still seems to glitch sometimes. The object will take an extremely long route and then go diagonally for some reason. I can't see why though.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Tristan Clark



Registered
  28/07/2003
Points
  159
27th February, 2005 at 00:20:05 -

I've stuck in the grid object - problem now is, whenever i click on somewhere, my object just gets sent to 0,0. I'm sure it's something obvious i've forgotten. Here's my code:
http://www.geocities.com/mcalphabet/b3.zip

Cheers.

 
n/a

Tristan Clark



Registered
  28/07/2003
Points
  159
27th February, 2005 at 04:21:52 -

Never mind, I think I've got it now.
Thanks for all yer help SpaceCadet!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click