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 > Code Resources > Samples
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 12-20-2006, 11:34 PM   #16
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 (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Sorry for the double-post, but can someone please go over the system and either approve it or tell me what to fix? I'm going on holidays Saturday and wont be able to change anything until new years.

Thanks in advance.
__________________
Ammorth is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 12-23-2006, 05:14 AM   #17
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

Despite understanding how it's supposed to work and spending 45 minutes staring at it, I still can't make sense of it. However, it's cool, seems to work and likely follows the rules, so I have no reason to discourage another mod from approving it.
__________________
PipeDream is offline   Reply With Quote
Old 12-23-2006, 06:05 AM   #18
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 (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default Trying to explain how it works...

Okay, lets see if I can help you understand the system. Please bare with me, as I'm not the best teacher in the world.

On map init, the system takes all the information that was inputted by the user and constructs a system of nodes into integer arrays. It gets all the nodes every other node links to, as well as the game distance between each node. This is all done in the PAS sys CREATE NODES trigger. The reason for this is to remove the number of distance between point calls made, thus increasing the speed of the actual calculations.

Now, once all the variables are nice and happy with their values, the player can start getting paths for his units.

All the calculations are done in the PAS sys MAIN FUNCTION (hence the name ). It starts off by setting all the variable values back to their default settings. This is to ensure the system runs off a clean script and doesn't have any information from previous calculations. Once that is done, the system enters a conditional loop. This loop is just an integer loop (in GUI) that has a condition check at the end. If the condition is met, the variable used for the loop will be increased over the loop end, thus terminating the loop. If the condition is not met, it reduces the variable so then the loop will loop again. The condition is to see if there are any "Open nodes" left.

An open node is just a node that has been reached by the system and has the path and distance calculated, relative to the beginning node.

Closed nodes are nodes that have been calculated and have a path, but have no other unknown nodes linking to it.

Zoom (requires log in)

Edit: Node 1 is the starting node and node 8 is the ending node in this exmaple.

As you can see in the example, nodes 1, 2, 3, 11 and 12 are closed. They do not have any unknown nodes left that attach to them.

Nodes 4 and 10 are still open, because there are unknown nodes attached to them.

Back to the trigger. Now the system loops through all the open nodes and then through all the unknown nodes linked to the open nodes and locates the shortest node. Once it finds a possible node, it gives it 2 settings: the node that it was linked off of, and the current node it is in that series.

Once we loop through all possible candidates, we takes the shortest one, and open it. That way, any nodes attached to it are able to be picked on the next loop through.

Since the algorithm always picks the shortest path first, if we have have reached the end node, we must have found the shortest path. We then exit the conditional loop, and construct the path.

The path is constructed by going backwards (starting at the end node) through the "node we reached the node from variable" (PAS_NodePathArray) and we can go backwards to our starting node. The node number in the series variable is required to start the loop in the proper location. All this info is stored in a game cache for the movement system to use.

If the end node was not located, the condition loop takes the system back to the beginning. Now, if there is no possible path (there are no open nodes left to pick unknown nodes from) the system exit the loop, with an error stating there is no path.

If you want an explanation of the movement trigger, just ask, but I'm assuming it was only on this portion.
Attached Images
File Type: jpg explain1.jpg (29.6 KB, 227 views)
__________________

Last edited by Ammorth : 12-23-2006 at 06:09 AM.
Ammorth is offline   Reply With Quote
Old 12-26-2006, 08:39 AM   #19
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

This system wouldn't addapt to a campaigns AI, since it uses pre-created nodes, so It would help that much to find pathing options.
BlinkBoy is offline   Reply With Quote
Old 12-27-2006, 01:33 AM   #20
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 (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by BlinkBoy
This system wouldn't addapt to a campaigns AI, since it uses pre-created nodes, so It would help that much to find pathing options.

I don't understand the last run-on sentence.

Why wouldn't it adapt? Whats wrong with pre-created nodes? Instead of just ordering units to move to regions, tell each unit (through the system) to go to certain nodes instead. How would you recommend I would set-up the nodes otherwise? Randomly guess where players want nodes and place a node in the middle of a forest (like node 42 in the demo map)?

If you are too impatient to set-up atleast 40 nodes, I couldn't believe how you would be able to make a campaign. 30 minutes is all it took me.

Edit: @PIPEDREAM and other mods

When I get back from my holidays I'll look into making a JASS version. Hopefully it will be easier to follow, and it will be more stream-line.
__________________

Last edited by Ammorth : 12-27-2006 at 05:42 AM.
Ammorth is offline   Reply With Quote
Old 12-30-2006, 03:10 PM   #21
iNfraNe
PhD
 
iNfraNe's Avatar


Cinematics Moderator
 
Join Date: Dec 2003
Posts: 2,283

Submissions (7)

iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)

Approved Map: Mortar Ball

Send a message via MSN to iNfraNe
Default

that would be nice :) I like it so far but it is indeed a pain to read.
__________________
Ever so slightly active.
Table:
Past Projects:
The Spirit of Vengeance (Cinematic, Blizzard contest winner)
Elimination Tournament
Mortar Ball
iNfraNe is offline   Reply With Quote
Old 01-01-2007, 01:09 AM   #22
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 (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Yes, I know exactly what you mean INfraNe! When I was adding the comments, I was wondering what each section did, and why I did it.

I am back from holidays now, but I'm heading to a New Years Eve party tonight. Hopefully in the morning I will start working on it. Happy New Years!
__________________
Ammorth is offline   Reply With Quote
Old 01-08-2007, 04:42 PM   #23
iNfraNe
PhD
 
iNfraNe's Avatar


Cinematics Moderator
 
Join Date: Dec 2003
Posts: 2,283

Submissions (7)

iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)iNfraNe is just really nice (266)

Approved Map: Mortar Ball

Send a message via MSN to iNfraNe
Default

So, hows that going?
__________________
Ever so slightly active.
Table:
Past Projects:
The Spirit of Vengeance (Cinematic, Blizzard contest winner)
Elimination Tournament
Mortar Ball
iNfraNe is offline   Reply With Quote
Old 01-08-2007, 05:00 PM   #24
Rising_Dusk
Obscurity, the Art


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

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 think that it's in GUI is the only reason it hasn't been approved already.
Looking through it, it's practically impossible to follow if you don't know exactly how it works, which is a pain.
In jass, you could follow the algorithm a lot easier.

I mean, it's easily a useful and great system, but a little too much for the casual GUI user. :P
__________________
Rising_Dusk is offline   Reply With Quote
Old 01-08-2007, 11:03 PM   #25
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 (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

It has been converted to JASS. Sorry, I guess I forgot to edit my last post...

I must admit, even in GUI, its slightly hard to follow. I added more comments to the current version that should hopefully smooth out any questions on my implementation.
__________________
Ammorth is offline   Reply With Quote
Old 01-18-2007, 02:59 PM   #26
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

Had some problems so I haven't actually been able to look at all this stuff. Basically, if you're going to do it in JASS, do it properly. The stupid GUI conditions, tons of useless BJ's and other random stuff like being able to replace if ( CountUnitsInGroup(udg_PAS_TempUnitGroup) == 0 ) then with if FirstOfGroup(udg_PAS_TempUnitGroup) == null then.
blu_da_noob is offline   Reply With Quote
Old 01-18-2007, 11:54 PM   #27
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 (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Okay, I normally don't code in JASS, so I don't know the most streamline methods, but I have already removed the BJs (except for one, String2OrderIdBJ("")) because I'm not sure how to not make it BJ. I also changed the one condition mentioned, and checked for any other faults.

I hope thats it. Edit: Updated at first post.
__________________

Last edited by Ammorth : 01-19-2007 at 12:08 AM.
Ammorth is offline   Reply With Quote
Old 01-20-2007, 07:07 AM   #28
Xlightscreen
User
 
Xlightscreen's Avatar
 
Join Date: Oct 2006
Posts: 197

Submissions (2)

Xlightscreen is on a distinguished road (19)

Send a message via MSN to Xlightscreen
Default

Lol its kinda funny to see all these jassers which is supposly more advance then GUI not be able to understand GUI lol. anyways I might acutly have use for this system in my project in later future so keep polishing!
__________________
Gmax Questions?, Request? Send me a PM!

Xlightscreen is offline   Reply With Quote
Old 02-11-2007, 05:27 PM   #29
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 (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Can someone either approve this or tell me what to fix/change?
__________________
Ammorth is offline   Reply With Quote
Old 02-11-2007, 06:12 PM   #30
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

Sorry, I have been busy lately and reading through this thing can get painful .

You're still using BJ's (functions and conditions) all over the place. Remove them please.
There are many random places where you could remove lines of code and make it easier to read. Things like
Collapse JASS:
if (x) then
//do stuff
call do(y)
else
//do stuff
call do(y)
endif
Where the do(y) could just be outside the if/then/else.

Just start udg_PAS_MoveTimer as a repeating timer instead of starting it as a one-shot over and over again.

Converting the last GUI trigger to JASS really couldn't hurt either.
blu_da_noob 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 03:00 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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