wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > - Submit a resource -
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 02-16-2010, 04:36 PM   #1
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)

Default [system] Pathing Algorithm System

NOTE: You have been redirected in order for our attachments to be made available to you. This will only last two minutes; these measures where taken to avoid hotlinking and bandwidth theft.
To avoid these restrictions Log in or Register

PAS v3.1 - by Ammorth

Zoom (requires log in)

Background:
Over a year ago, I wrote PAS 1.0 and updated it through to PAS 2.40 (2.40 was never released). I then took a break from modding wc3 and PAS has since become obsolete. With better syntax and modding experience, I have since re-wrote PAS from the ground up. PAS 3.0 is now born. The older version of PAS can be found here.
About PAS:
PAS is a framework for plugins that use the PAS system. It is a combination of nodes and edges, mixed in with an Astar algorithm that traverses the node. It can generate paths along the nodes which plugins can use.

PAS v3.1 includes 3 plugins:
  • PASMove
  • PASMoveSafety
  • PASGPS
There are many more possible plugins one could write to utilize PAS, these are only the beginning.
Requires:
Features:
  • PASMove will move units through the paths created by PAS
  • PASGPS creates a GPS-like Arrow which can guide players to locations within the PAS paths
  • PASMoveSafety is an added safety net for PASMove. It will check for stuck units as well as dead/removed units.

PAS Code:

Expand PAS:

Expand PASMove:

Expand PASMoveSafety:

Expand PASGPS:

If you notice any issues or have any improvements/suggestions, please speak up.
Attached Images
File Type: jpg PAS3.0.jpg (62.1 KB, 480 views)
Attached Files
File Type: w3x PAS3.1.w3x (117.9 KB, 65 views)
File Type: mdx PAS_GPS_Arrow.mdx (3.2 KB, 15 views)
File Type: blp PAS_GPS_Arrow.blp (4.2 KB, 14 views)
__________________

Last edited by Ammorth : 02-18-2010 at 10:24 PM.
Ammorth is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 02-16-2010, 09:00 PM   #2
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

I wish you could optionally require either LinkedList or Stack. That'd be great, but I don't think Vex ever added it to JassHelper.
__________________
Rising_Dusk is offline   Reply With Quote
Old 02-17-2010, 01:01 AM   #3
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)

Default

Quote:
Originally Posted by Rising_Dusk
I wish you could optionally require either LinkedList or Stack. That'd be great, but I don't think Vex ever added it to JassHelper.

My only thing is I need Linked Lists for PASMovementSafety (need to loop without disrupting). Stack can't do that. Aswell, providing a list of nodes which the user can loop through on their own is more user-friendly than a stack that has to be popped.

Currently writing the next version, so if you have improvements/updates, speak up!
__________________
Ammorth is offline   Reply With Quote
Old 02-17-2010, 01:48 AM   #4
TEC_Ghost
User
 
TEC_Ghost's Avatar
 
Join Date: Jul 2002
Posts: 416

TEC_Ghost will become famous soon enough (65)TEC_Ghost will become famous soon enough (65)TEC_Ghost will become famous soon enough (65)

Default

Would I be able to use this in a custom grid movement system?

Where I have a grid setup. say 20x20, with each tile indexed and each tile with a "passable" boolean. Would this system be able to integrate with my custom movement? Basically just give me an array of the shortest path nodes?
__________________

Projects
TEC_Ghost is offline   Reply With Quote
Old 02-17-2010, 04:05 AM   #5
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)

Default

Quote:
Originally Posted by TEC_Ghost
Would I be able to use this in a custom grid movement system?

Where I have a grid setup. say 20x20, with each tile indexed and each tile with a "passable" boolean. Would this system be able to integrate with my custom movement? Basically just give me an array of the shortest path nodes?

Version 3.1 will be able to do this.

It will support both modifying weights after setup (during the game) as well as disabling a link entirely. So its just a matter of looping through all linking nodes and disabling the link to the node you wish to turn off.

I am holding off on releasing the next version, in case I get more ideas/suggestions.

And with no current suggestions, version 3.1 is out.

changelog:

PAS 3.1
  • Added functionality for changing link weights after setup
  • Added functionality for enabling and disabling links after setup
  • Made objects private/read-only where applicable (mostly PAS_Node objects)
  • Added function lists to all the script and plugins
  • Added Object Merger macros to create units in the object editor
  • PASMove: Changed the plugin name from PASMovement to PASMove (shorter)
  • PASMoveSafety: Changed the plugin name from PASMovementSaftey to PASMoveSafety (shorter)
  • PASGPS: Added installation instruction about the custom model and changed the paths for the model
  • PASGPS: The system will now register arriving at the end even if you didn't take the recommended path

the changelog can always be found at the end of the README section of the PAS script.
__________________

Last edited by Ammorth : 02-18-2010 at 04:06 AM.
Ammorth is offline   Reply With Quote
Old 04-02-2010, 04:41 PM   #6
Element of Water
User
 
Element of Water's Avatar
 
Join Date: Mar 2009
Posts: 147

Submissions (2)

Element of Water is on a distinguished road (18)

Default

Why are we banned from adding nodes outside of PAS? It prevents me from making PASGrid...
Element of Water is offline   Reply With Quote
Old 04-02-2010, 04:55 PM   #7
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)

Default

PAS takes all the nodes you add within the system and does work on them during map init (in its onInit function). Once the onInit function runs, you cannot add nodes to PAS. Therefore, if you require PAS, it's onInit function will run before your library and the nodes will already be set. This is a limitation to the design of PAS. However, if you can provide me with some code and what you plan to do, I may be able to modify PAS to run your code to add nodes. PM or even here works great.
__________________
Ammorth is offline   Reply With Quote
Old 04-02-2010, 09:22 PM   #8
Element of Water
User
 
Element of Water's Avatar
 
Join Date: Mar 2009
Posts: 147

Submissions (2)

Element of Water is on a distinguished road (18)

Default

This would be the basis for the code (I hope you can read Zinc):

Collapse Zinc:
library PASGrid requires PAS
{
    public struct PAS_Grid
    {
        private constant integer MY_NODES = 0xFFFF;
        
        real x0, x1, y0, y1, gridSpace;
        
        integer width;
        integer height;
        
        private method create_child_child (real x, real y, integer w, integer h)
        {
            // notice I don't add any links here -- I'd like a separate "linkTo" 
            // function -- maybe your strings could be in a "linkToMulti" 
            //function that parses the strings?
            PAS_Node.add(MY_NODES + w + width * h, x, y, gridSpace);
            
            // <code to link this node to the ones around it -- will be a fairly
            // complicated loop, so I'm not going to work it out right now>
        }
        
        private method create_child (real x, integer w)
        {
            real y;
            for (y = x0; y0 <= y <= y1; y += gridSpace)
            {
                this.create_child_child.execute(x, y, w, R2I((y - y0) / gridSpace));
            }
        }
        
        static method create (real x0, real y0, real x1, real y1, real gridSpace) -> thistype
        {
            thistype this = thistype.allocate();
            
            real x;
            
            this.x0 = x0; this.x1 = x1;
            this.y0 = y0; this.y1 = y1;
            this.gridSpace = gridSpace;
            
            this.width  = R2I((x1 - x0) / gridSpace);
            this.height = R2I((y1 - y0) / gridSpace);
            
            for (x = x0; x0 <= x <= x1; x += gridSpace)
            {
                this.create_child.execute(x, R2I((x - x0) / gridSpace));
            }
            
            return this;
        }
    }
}

As you can see, I'd like to be able to dynamically add points and link them together. I could construct something like a pathmap by disabling some nodes when (for example) a tower is built over it.

I suppose I could just write a whole new system, but since you have this A* algorithm already included into your code, it'd be nice to utilise this library.
Element of Water is offline   Reply With Quote
Old 04-02-2010, 09:42 PM   #9
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)Ammorth is a glorious beacon of light (457)

Default

I sent you a PM.
__________________
Ammorth is offline   Reply With Quote
Old 02-13-2011, 04:08 PM   #10
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,074

Submissions (19)

Anitarf has a brilliant future (884)Anitarf has a brilliant future (884)Anitarf has a brilliant future (884)Anitarf has a brilliant future (884)Anitarf has a brilliant future (884)Anitarf has a brilliant future (884)Anitarf has a brilliant future (884)Anitarf has a brilliant future (884)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Let me see if I get this: you create nodes, giving each a unique id and a string that specifies which other nodes this node is linked to, and then your code parses these strings to create the links? This seems like a rather messy approach, why couldn't users create nodes first, store them in their own array, and then create links between them? Something like:
Collapse JASS:
library PAS_Init initializer Init requires PAS
    globals
        private PAS_Node array n
    endglobals
    private function Init takes nothing returns nothing
        set n[1]=PAS_Node.create(100,0)
        set n[2]=PAS_Node.create(200,0)
        set n[3]=PAS_Node.create(100,100)
        call PAS_Link.create(n[1], n[2])
        call PAS_Link.create(n[1], n[3])
    endfunction
endlibrary
__________________
Anitarf is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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


All times are GMT. The time now is 11:18 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services