Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 16 posts ] 
    ForeverZer0
  Thu Jun 30, 2011 12:57 am
ARC Developer
User avatar
Sponsor


Location: United tates
Advanced Pathfinding Version: 1.1
By: ForeverZer0

Introduction

This is an advanced an highly intelligent pathfinding system. It allows for the user to either through script or script call quickly and easily have events or the game player automatically walk a path to a given set of coordinates. The system is smart enough to quickly find paths through relatively complex areas, and adjust on the fly for any obstacle that moves to block its path. I used the A* algorithm, basic search algorithm used often for robotics. More on this algorithm can be read about here: A* Search Algorithm

Features
  • Fast and intelligent pathfinding
  • Easy to use script calls
  • Optional "range" parameter can have character find alternate locations if the preferred one is blocked and they are within the given range.
  • Optional callbacks can be given to have something execute if when the character reaches its goal, or when it fails to do so.

Screenshots

Can quickly and easily navigate a maps like these, lag-free:
Content Hidden

Content Hidden


Demo

Demo Link

Script

Expand to see the code.


Instructions

Place script below default scripts and above "Main".
Further instructions are within the script and demo.

Compatibility

Highly compatible. Only issue may be with other custom movement scripts.

Credits and Thanks

Special thanks to Jragyn for help making the big maze for the demo and help testing.
Credit goes to the Peter Hart, Nils Nilsson and Bertram Raphael for the original search algorithm that was implemented

Author's Notes

Please report any bugs/issues so that they can be resolved. Enjoy!

Terms and Conditions

Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
Content Hidden

_________________
Use DropBox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account. ;)

Looking for a more powerful RMXP? Check out Image

My complete script list on Pastebin


Last edited by ForeverZer0 on Thu Feb 02, 2012 3:24 am, edited 1 time in total.

Top Top
Profile      
 

    BlueScope
  Thu Jun 30, 2011 12:04 pm
The Third Man
User avatar



Location: Germany
Now, this is by far not the first A* pathfinding script for XP... so the difference is that this one is better in performance? Lag-free on the above-shown map is indeed not too bad for the number of checks required, so I have to wonder: Lag-free on what system? ^^

On a completely unrelated note, entirely focussed on my fight for proper scripting style: The reason why there has to be a username tag in alias zer0_pathfinding_init initialize, while class Pathfind is apparently not endangered to be taken by any other scripter at all is completely beyond me.

_________________
Image

If you have a slightly positive memory of my Power Shift contest game,
you might be interested in this development screenshot...
More info about that soon!


Top Top
Profile      
 

    Atoa
  Thu Jun 30, 2011 7:13 pm
Victor Sant
User avatar
Member


Location: Brazil
@BlueScope
The alias is on the class Game_Character initialize, not on the class Pathfinding.

Also i think that "telling the proper scripting style" is like telling people what clothes they must use. Unless it's an gross error, each one have it own style. And if it don't make an noticeable performance loss, or make things a lot confusing, who cares how the script was coded?

@ForeverZer0
The script is quite good, and it have an great compatibility. Something hard to find in an script like this.

_________________
Image


Last edited by Atoa on Fri Jul 01, 2011 7:33 pm, edited 1 time in total.

Top Top
Profile      
 

    Draycos Goldaryn
  Fri Jul 01, 2011 4:19 pm
The Goldyn Scaly One
User avatar
Member


Location: My own Phantasy Realm
I'd be willing to use this, if it had 8 directional support.

For myself, that seems to be the major flaw and failing in all pathfinding scripts I've found for rpgmaker. they all only use 4 directions.

_________________
Scripts that I made

And now for some fun:
Popular Quotes with a Goldaryn Twist! (Updated 2011-08-25)


Top Top
Profile      
 

    Phoenixia
  Wed Jul 13, 2011 8:33 pm
User avatar
Member

I don't have rmxp with me right now to try this, but I do have a question about lag. Would this generate lag on a complex 100 x 100 map if multiple events, say 20, were using it? I am very sleepy right now, so I apologize if that has a rude sounding tone to it, I'm honestly just curious. Thanks :-)


Top Top
Profile      
 

    ForeverZer0
  Wed Jul 13, 2011 11:08 pm
ARC Developer
User avatar
Sponsor


Location: United tates
I honestly never tried it with 20 events at the same time. For the most part, lag will only occur at the actual point of the script call when the path is calculated. From that point, the event is just walking the path. If they hit a collision that blocks their defined route, then it recalculates again from the current point.

_________________
Use DropBox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account. ;)

Looking for a more powerful RMXP? Check out Image

My complete script list on Pastebin


Top Top
Profile      
 

    ShadowMainZERO
  Tue Jul 26, 2011 3:57 am
The Shadow Assassin
User avatar
Member


Location: A Little Place I Like to Call Earth.
Is it possible to use this script to get events to chase the player if the player is within a certain area?

_________________
The ultimate power is found in the incorruptible light hidden deep in the darkness. You must delve into the darkest part of your heart and find that light. Once you do, never let go of it. Remember: Your heart is the strongest weapon of all.


Top Top
Profile      
 

    ForeverZer0
  Thu Jul 28, 2011 1:04 am
ARC Developer
User avatar
Sponsor


Location: United tates
Just set the X and Y to the player's x and y.

The only problem I foresee is that it will want to complete that route, and really won't be chasing the player. If the player moves, the event will still move to the original coordinates. You could fix this by clearing the paths and resetting them each time the character moves, which would work, though not very efficient.

_________________
Use DropBox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account. ;)

Looking for a more powerful RMXP? Check out Image

My complete script list on Pastebin


Top Top
Profile      
 

    ShadowMainZERO
  Thu Jul 28, 2011 9:14 am
The Shadow Assassin
User avatar
Member


Location: A Little Place I Like to Call Earth.
Alright, thanks. I'll see if there's a more efficient way to do it.

_________________
The ultimate power is found in the incorruptible light hidden deep in the darkness. You must delve into the darkest part of your heart and find that light. Once you do, never let go of it. Remember: Your heart is the strongest weapon of all.


Top Top
Profile      
 

    SPN
  Fri Jul 29, 2011 3:27 am
Lemon Meringue Pie
User avatar
Member


Location: Canada
@ShadowMainZERO
Not sure if this is exactly what you were looking for, but I was figuring out chase-related ideas today, and posted a quick how-to in the basics of it. Combining it with this script could give you some interesting options. Feel free to check it out!

Check it!


Top Top
Profile      
 

    mouse_std
  Sun Aug 28, 2011 2:10 pm
Member

this is very nice script , could be used for many things :biggrin:
can i ask a question?
is there a way for it to activate switch as soon as finished path?
x = 1
y = 3
id = 5
range = 0
s = <<<<------ dunno what to put here to activate certain switch. ex: switch 4
f =
pathfind(x, y, id, range, s, f)

and 2nd question, is there a way to forcefully deactivate path of a certain event char ? thx :smile:


Top Top
Profile      
 

    ForeverZer0
  Tue Aug 30, 2011 4:19 am
ARC Developer
User avatar
Sponsor


Location: United tates
Expand to see the code.


What do you mean by deactivate? You mean cancel the route and stopping once it has already started? If so, then "no" there is no built-in way, which is an oversight of mine. I have not tested this, but I think it should work:

Expand to see the code.


Just within a script call use "cancel_pathfind(CHARACTER_ID)". If no argument is supplied, it will work on the event that it is called in. Use -1 as an ID for the player. Let me know if it works.

_________________
Use DropBox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account. ;)

Looking for a more powerful RMXP? Check out Image

My complete script list on Pastebin


Top Top
Profile      
 

    mouse_std
  Tue Aug 30, 2011 7:07 am
Member

Expand to see the code.

it work nicely , now its even more awesome , thx :biggrin:

Expand to see the code.

this work too , but i had to press f9 for the switch to work or it'll just stand there , does it need some kind of refresh?

*edit* : im sorry i should be more specific , i use switch to activate another pathfind script so after he arrive to lets say point A i want him to move to point B , but for that to happen i have to press F9 for it to work.

*edit no.2* : sorry it actually work , :tongue: i put another script that clash with yours that need to press f9 for it to work, is there any script call that can refresh? or has some function as pressing f9 ?


Top Top
Profile      
 

    ForeverZer0
  Fri Sep 02, 2011 2:09 am
ARC Developer
User avatar
Sponsor


Location: United tates
Expand to see the code.


This will virtually press the F9 key.

_________________
Use DropBox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account. ;)

Looking for a more powerful RMXP? Check out Image

My complete script list on Pastebin


Top Top
Profile      
 

    Kingdom Ablaze
  Fri Sep 02, 2011 4:43 am
Smile, you never know when you are on camera!
User avatar



Location: Usa
ive used alot of path finding scripts, but i like this one alot so far, more info after i play with it more.

_________________
Image
Kingdom Ablaze Twitter: https://twitter.com/KingdomAblaze
Kingdom Ablaze Deviant Art: http://kingdomablaze.deviantart.com/
Kingdom Ablaze: Facebook: https://www.facebook.com/KingdomAblazeTradingCardGame


Top Top
Profile      
 

    ForeverZer0
  Thu Feb 02, 2012 3:25 am
ARC Developer
User avatar
Sponsor


Location: United tates
Small update.

Fixed a little bug that would occasionally pop up when an event finished a move route. Just forgot to add an additional condition to a branch.

_________________
Use DropBox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account. ;)

Looking for a more powerful RMXP? Check out Image

My complete script list on Pastebin


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 


Who is online

Users browsing this forum: No users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group