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



Reply
 
Thread Tools Search this Thread
Old 11-22-2009, 04:43 PM   #46
Iron_Doors
User
 
Join Date: Aug 2007
Posts: 50

Submissions (1)

Iron_Doors will become famous soon enough (31)Iron_Doors will become famous soon enough (31)

Default

I'd like to suggest a little change to your IsTerrainWalkable function, that works the same but does so without the public X and Y variables:
Expand JASS:

PS: I tested this using your testmap.

Last edited by Iron_Doors : 11-22-2009 at 04:44 PM.
Iron_Doors is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-22-2009, 06:03 PM   #47
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

The public X/Y variables are both useful and valuable. I don't want to remove them. IsUnitInRangeXY is not a good choice for this library because it basically makes the threshold COLLISION+MAX_RANGE, whereas it's actually rather important that the unit not move a lot. I'd rather it be totally controlled by just MAX_RANGE.

The only suggestion I kind of like is the one that doesn't use SetUnitPosition if the unit is over deep water. Even then, the X/Y public vars are so important I like the way it currently is.
__________________

Last edited by Rising_Dusk : 11-22-2009 at 06:25 PM.
Rising_Dusk is offline   Reply With Quote
Old 11-22-2009, 08:06 PM   #48
Iron_Doors
User
 
Join Date: Aug 2007
Posts: 50

Submissions (1)

Iron_Doors will become famous soon enough (31)Iron_Doors will become famous soon enough (31)

Default

Quote:
Originally Posted by Rising_Dusk
The public X/Y variables are both useful and valuable. I don't want to remove them. IsUnitInRangeXY is not a good choice for this library because it basically makes the threshold COLLISION+MAX_RANGE, whereas it's actually rather important that the unit not move a lot. I'd rather it be totally controlled by just MAX_RANGE.
--
You can solve that range issue if you make the dummy's COLLISION equal 0. Anyhow I must agree the X/Y may be useful.
Iron_Doors is offline   Reply With Quote
Old 11-22-2009, 08:12 PM   #49
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

The dummy's collision can't be 0, though, because the premise of the whole windwalk method of pathing checks requires a non-zero ground collision in the first place. (Otherwise it never moves away from the unpathable point) That also requires the user edit the dummy unit. It's real convenient right now that you can just use 'hfoo' and it works great.
__________________

Last edited by Rising_Dusk : 11-22-2009 at 08:12 PM.
Rising_Dusk is offline   Reply With Quote
Old 12-05-2009, 09:37 AM   #50
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 did some benchmarking of this vs. this script's IsTerrainWalkable (windwalk method) and had a good laugh.
2500 Calls, No Items In the Way:
Ani's0.338
Dusk's1.260
1000 Calls, 10 Items In the Way:
Ani's0.285
Dusk's0.409
The only thing Ani's version sucks at is if you run it 1500 times in a row with 10 items in the way it thread crashes, whereas the WW'd unit version won't up to 3500 calls. But no one cares about that anyways, so the item method is a f*ckton better in all test cases.
__________________

Last edited by Rising_Dusk : 12-06-2009 at 06:15 PM.
Rising_Dusk is offline   Reply With Quote
Old 12-06-2009, 06:15 PM   #51
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

This has been updated to use the item method of walkability detection as suggested by Anitarf. I think this will then just absorb his library, and become the general standard for this stuff since it includes deep water, shallow water, and land. He's also doing some more research on the matter and will probably make a post somewhere about his findings. (We spent most of yesterday working on it together)

Cheers.
__________________

Last edited by Rising_Dusk : 12-06-2009 at 06:17 PM.
Rising_Dusk is offline   Reply With Quote
Old 12-07-2009, 02:16 AM   #52
Anitarf
Procrastination Incarnate


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

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

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

Default

I might as well just post our findings here, since they mostly pertain to this specific resource.

The IsTerrainPathable() native, which is one of the two foundations of this resource, has some peculiar quirks. The first and most obvious of those is the fact that it's return value is the opposite of what you would expect it to be: The native returns true if the terrain is not pathable and false if it is. So, rather than answering the question "Is the terrain pathable here?", it answers the question "Is pathing blocked here?".

The second important property of the native is that it ignores dynamic objects when doing the pathing check, it only considers the map's static pathing map, which is affected by cliffs, water and doodads. Destructables and buildings, being dynamic objects, do not affect this, so if a point of flat terrain is blocked by a tree, the pathing natives will still say that point is pathable for ground units and buildable.

This brings us to the second foundation of this resource, the item pathing check. If you try moving an item to an unpathable point, it will be moved to the nearest pathable point instead. With this discrepancy, we can detect all unpathable points, even those caused by destructables and structures. Note however that items can be moved into deep water which is otherwise unpathable for ground units, so besides the item position check we still need an additional pathing check in the IsTerrainWalkable function.

Getting back to the IsTerrainPathable(), or more precisely, the static pathing map it reads from. Normally, dynamic objects like destructables can only block passable areas on the static pathing map, but they can not unblock blocked areas. Using a trigger to create a bridge over a cliff in-game will not allow ground units to cross that cliff. How do the bridges work then? Simple:

Any destructable with it's "Pathing - Is Walkable" property set to true that you pre-place in the editor will affect how the editor writes the map's static pathing map. Areas where such destructables are placed are made fully pathable (air, ground, naval) and buildable. It is then entirely up to the destructable to do the pathing blocking. Killing a bridge causes it to switch to it's dead pathing texture which is unpassable for ground units, however completely removing a bridge will leave the cliffs where it once stood perfectly pathable and buildable.

The other thing that the "Pathing - Is Walkable" field does is it makes the destructable affect the terrain z, causing units to walk on it instead of through it as well as affecting the return value of GetLocationZ(). If you do this with animated destructables, this can cause a server split (since animations are not synced) unless you only use location z values for only graphical stuff like changing unit flying height and not gameplay stuff like calculating projectile bounce angles.
__________________
Anitarf is offline   Reply With Quote
Old 12-04-2010, 05:32 PM   #53
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

(X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE

If the item has shifted even a little, isn't that a problem? Maybe it should be that the item coord's are perfectly identical to the polled coord's?
Bribe is offline   Reply With Quote
Old 12-04-2010, 06:01 PM   #54
Anitarf
Procrastination Incarnate


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

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

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

Default

Quote:
Originally Posted by Bribe
(X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE

If the item has shifted even a little, isn't that a problem? Maybe it should be that the item coord's are perfectly identical to the polled coord's?
The original implementation made long before mine had this tolerance, so I included it just in case, although MAX_RANGE could probably be set to 0.0 without bugs. Probably. Feel free to change it if you want to, that's what calibration constants are there for.
__________________
Anitarf is offline   Reply With Quote
Old 07-20-2011, 08:23 AM   #55
Jaakko
User
 
Jaakko's Avatar
 
Join Date: Sep 2006
Posts: 164

Jaakko is on a distinguished road (14)

Default

The test map doesn't open in world editor, help.
__________________
Jaakko is offline   Reply With Quote
Old 07-20-2011, 09:03 AM   #56
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

It doesn't open in World Editor because it requires JNGP to open.
Bribe is offline   Reply With Quote
Old 04-30-2014, 03:41 PM   #57
pandawins
User
 
Join Date: Apr 2014
Posts: 1

pandawins has little to show at this moment (0)

Default

Why does his error? something wont work for for me on my map....
pandawins 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 02:53 AM.


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