Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-31-2003, 12:02 PM
Soul-Blade Soul-Blade is offline
US Marine
Soul-Blade's Avatar
Join Date: Jul 2001
Location: Coeur d'Alene, ID
Posts: 945
Soul-Blade is an unknown quantity at this point
Send a message via AIM to Soul-Blade
Behold Pathfinding!

Alrighty, I was working on pathfinding. I haven't touched this script up, so it is a direct integration of A* pathfinding...or in other words, I haven't optimized the script to the best of my abilities yet, mainly because of the errors I am going to tell you about soon.

Anyway, I am posting this because 1) If not a scripter, be amazed by pathfinding and 2) If a scripter, and want to help make a pathfinding function for people to use, then you have a chance.

I've done all the hard parts (I think) on this pathfinding script, but I ran into a few problems I will outline here.

The biggest problem, as you will see in the script, is that the while loops are not functioning correctly. If I do not place a sleep 0.05 after the while, then the while loops oddly end early, among other strange effects. But if I put a sleep 0.05 after the while, the script obviously takes ages to complete calculation (about 3 minutes on average, actually). It is tricky, and if you have a solution please tell me.

Another error, though not nearly as large as the above, is moving the Start location around. I haven't found a pattern yet, but if you move it to the right of the level is skips most of the loops, and well, it is just weird. Have a look yourself.

Another error, though not so much a error as a little glitch, is the "diagnal movement" stuff. You'll see...it is caused by the script when going backwards from the end point choosing a random direction of a smaller number, when it choose there are usually about 3 possible choices, usually 1 of which being straight up and done, and 2 of which being diagnal. Anyway, you'll see.

This pathfinding script is currently far from usable, but we could all learn a thing of turn making it work (and would make me very happy =P).

Well, I actually do need to get it to work for my own projects of course, but the reason I've posted this rather then using my sources on AIM, is so people can use this. After working on this pathfinding, I have discovered it to be a rather complicated script to complete, and I doubt many people wanted this could do it. So as a benefit to graal, here it is...(though I am warning once again, it is needing to be completed so it works 100% nicely).

Thats about it...though I know I forgot something. Be patient, in its current state it will take a few minutes to calculate as I said before.
Attached Files
File Type: zip pathfinding test.zip (3.3 KB, 400 views)
Reply With Quote
  #2  
Old 07-31-2003, 01:31 PM
Snakeandy7 Snakeandy7 is offline
"Member ID=2610"
Snakeandy7's Avatar
Join Date: Mar 2003
Posts: 987
Snakeandy7 is on a distinguished road
I don t really understand it sorry.. Some nice scripting tho
Sorry, i'm not good at scripting so i carnt help
__________________
"Freedom is best I tell thee
of all things to be won
then never live within the bond
of slavery my son".


Reply With Quote
  #3  
Old 07-31-2003, 08:16 PM
marcoR marcoR is offline
Registered User
Join Date: Jul 2003
Posts: 1,349
marcoR is on a distinguished road
I can't open this zip folder... Im not a scripter but im still interested...
__________________
If this is your account, contact me.
- loriel
email, jabber: [email protected]
icq: 67530805
aim: lorielvictrix
Reply With Quote
  #4  
Old 07-31-2003, 09:26 PM
Soul-Blade Soul-Blade is offline
US Marine
Soul-Blade's Avatar
Join Date: Jul 2001
Location: Coeur d'Alene, ID
Posts: 945
Soul-Blade is an unknown quantity at this point
Send a message via AIM to Soul-Blade
Quote:
Originally posted by marcoR
I can't open this zip folder... Im not a scripter but im still interested...
Eh...thats odd. I can open it fine.
Reply With Quote
  #5  
Old 07-31-2003, 11:24 PM
TribulationStaff TribulationStaff is offline
Registered User
Join Date: Jul 2003
Location: Pennsylvania
Posts: 368
TribulationStaff is on a distinguished road
Send a message via AIM to TribulationStaff
Quote:
The biggest problem, as you will see in the script, is that the while loops are not functioning correctly. If I do not place a sleep 0.05 after the while, then the while loops oddly end early, among other strange effects. But if I put a sleep 0.05 after the while, the script obviously takes ages to complete calculation (about 3 minutes on average, actually). It is tricky, and if you have a solution please tell me.
Have you considered an if that sleeps it every, say, ten iterations?


Also, why didn't I think to look for open source pathfinding code? C'est la vie. Well, my little lost newbie script will certainly work well enough for marketplaces and such.

Lastly, if you can do this, I am surprised you needed to call on my services at all for SA, good work.

[edit] What the? n 0 0 b is censored? [/edit]
__________________


Help me keep scripting
Reply With Quote
  #6  
Old 07-31-2003, 11:45 PM
Thought Thought is offline
PipBoy Extraordinaire!
Thought's Avatar
Join Date: Nov 2001
Location: Long Beach, California.
Posts: 692
Thought is on a distinguished road
This would work well if we could get Stefan to implement it serverside and clientside (for speed reasons).
__________________
Rick ([email protected])
#gscript on FreeNode (#gscript Guild, #gscript Information)
Graal User Statistics

I am now using my new account, Rick.
Reply With Quote
  #7  
Old 07-31-2003, 11:52 PM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
I couldnt see anything, whats it doing.
__________________
--Spark911
Reply With Quote
  #8  
Old 07-31-2003, 11:54 PM
Thought Thought is offline
PipBoy Extraordinaire!
Thought's Avatar
Join Date: Nov 2001
Location: Long Beach, California.
Posts: 692
Thought is on a distinguished road
At the beginning it's calculating the path, because Graal Script is very slow (and the 0.05 delay), it takes about 5 minutes before the NPC starts walking.
__________________
Rick ([email protected])
#gscript on FreeNode (#gscript Guild, #gscript Information)
Graal User Statistics

I am now using my new account, Rick.

Last edited by Thought; 08-01-2003 at 12:06 AM..
Reply With Quote
  #9  
Old 07-31-2003, 11:55 PM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
I hate you Soul-Blade .
__________________
new account: Trevor
Reply With Quote
  #10  
Old 08-01-2003, 12:02 AM
Thought Thought is offline
PipBoy Extraordinaire!
Thought's Avatar
Join Date: Nov 2001
Location: Long Beach, California.
Posts: 692
Thought is on a distinguished road
The diagonal pathing bug really shows
Attached Thumbnails
Click image for larger version

Name:	astar.png
Views:	388
Size:	49.5 KB
ID:	24659  
__________________
Rick ([email protected])
#gscript on FreeNode (#gscript Guild, #gscript Information)
Graal User Statistics

I am now using my new account, Rick.
Reply With Quote
  #11  
Old 08-01-2003, 12:09 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by Thought
This would work well if we could get Stefan to implement it serverside and clientside (for speed reasons).
Hehe, we tried that back when I was on NW. Stefan didn't seem too keen. I wrote a similar algorithm over two years ago - one of the sample scripts the NW guys required involved an NPC with a daily schedule, so I invented and wrote a full pathfinding algorithm for him (at that point, I had never even heard of A*). Overkill, I know, but that's my style

In any case, tile-by-tile methods are horribly inefficient when navigating over any large distance. Predefined nodes are the way to go.
__________________
Reply With Quote
  #12  
Old 08-01-2003, 12:33 AM
TribulationStaff TribulationStaff is offline
Registered User
Join Date: Jul 2003
Location: Pennsylvania
Posts: 368
TribulationStaff is on a distinguished road
Send a message via AIM to TribulationStaff
Quote:
In any case, tile-by-tile methods are horribly inefficient when navigating over any large distance. Predefined nodes are the way to go.
Hooray! My little lost newbie isn't so bad after all!
__________________


Help me keep scripting
Reply With Quote
  #13  
Old 08-01-2003, 05:36 AM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
I'm about to take a look, and judging by that screenie and what people are saying, it sounds really good. I'm very impressed to say the least. Konidias asked me how to make one, and it was like 3 am in the morning so I didn't have time nor the will to do it then
Nice work m8.
---SHifter
__________________
Who has time for life these days?
Reply With Quote
  #14  
Old 08-01-2003, 05:44 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
:-/ this is pretty dang hard.

Mine will sometimes find the path, but he keeps blocking himself in, becouse I made it so he can't go back on tiles he already crossed.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #15  
Old 08-01-2003, 08:05 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Behold! if you don't move them it works.


(Yes I know I used the other fella's start and end graphics)
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.