1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice
  3. After a long wait, the results for Terraining Contest #18 are finally out! Drop by and congratulate the winners!
    Dismiss Notice
  4. The poll for Concept Art Contest #9 is up! Cast your vote for your favourite entry!
    Dismiss Notice
  5. Hero Contest #8 is up and running! This time it's a joint contest between artists and coders. Go here for team matchmaking.
    Dismiss Notice
  6. Our first StarCraft contest, The Galaxy Terraining Contest #1 - World Wonders has started. Enter to show off your Galaxy Editor skills and win a custom rank icon among other things.
    Dismiss Notice
  7. Ever wanted to get your sets ready for fast texturing while still having fun? Now it is possible with our newest Mini-Texturing Contest.
    The Skeleton Units need your dire help!
    Dismiss Notice
  8. The poll for Techtree Contest #11 is up! Cast your vote for your favorite entry.
    Dismiss Notice
  9. Take part in a Futuristic musical experience with our very own Music Contest. The 5th edition has finally arrived after a long time.
    Dismiss Notice
  10. Dismiss Notice

[Snippet] IsPathBlocked

Discussion in 'Graveyard' started by Nestharus, Feb 1, 2012.

  1. Bribe

    Bribe

    Code Moderator

    Joined:
    Sep 26, 2009
    Messages:
    7,339
    I am no rocket scientist, are you trying to kill me with this?

    First, what's with the bugs? That doesn't even make sense that those corners would block the map from functioning properly.

    Second, great work on reducing the in-game lag. Totally worth it because the in-game result will be free of lag.

    Third, why doesn't IsPathBlocked take any additional arguments any more? What unit is supposed to be passed as a parameter there?
     
  2. Dirac

    Dirac
    Joined:
    Jun 20, 2011
    Messages:
    249
    Bribe read the documentation.
    In a TD all you have to do is
    IsPathBlocked(tower)

    It checks if that "new" tower the user just built is blocking the way

    And I agree, the fact that corners bug the system is unacceptable
     
  3. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    actually if you read first post, corners don't bug system, you can just blanket rects that creeps have to touch with towers ;)
     
  4. Bribe

    Bribe

    Code Moderator

    Joined:
    Sep 26, 2009
    Messages:
    7,339
    So what exaclty is wrong with building a huge brick, if it doesn't corrupt the pathing algorithm everything is still fine, right?
     
  5. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    you can't build a huge brick from wall to wall... i was just thinking of blanketing rects specifically in my own wmw map, which would be a huge brick except for touching the opposite wall :\, so I was being silly in my super tired stupor of corners last night, lol. The instant you try to touch the other wall (an actual block), it'll detect it.


    To prevent users from blanketing the rect, just make one of the tiles unbuildable (only 1 is needed). In my case, I would make the corners unbuildable since people never build at those anyways. Not sure what to do about the back checkpoints tho ;o.
     
  6. jim7777

    jim7777
    Joined:
    May 27, 2009
    Messages:
    481
    does this snippet check if the path or line between two points are blocked?

    or just a radius around the unit is being checked?
     
  7. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    Path. It tries to get from one side of the tower to the other ^)^. If it can't make it to the other side, the path is blocked ;p.

    2 sides chosen are based on a set of if statements to check what path through the tower was possibly blocked (left -> right, bottom -> top, right -> top, etc).
     
  8. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    Fixed a bug with towers that are built 1 space apart from each other and a third tower built to possibly block the space in between. It would always read it as a block : ). Now it works properly.


    Thanks to magtheridon96 for his wmw noobiness as that allowed him to find the bug ; ).
     
  9. Magtheridon96

    Magtheridon96
    Joined:
    Dec 12, 2008
    Messages:
    6,022
    I'm improving D:
    And my score is pretty good compared to what you've seen other "pros" do D:
     
  10. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    Fixed bug with retrieving radius (was adding 16) and removed a debug message. Would have been updated last night, but my connection was down.
     
  11. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    This still has a bit of the bug mag found in it :\. I'm seeing noobs playing my wmw map encounter it over and over again. I'll investigate it tomorrow as I don't have time today.
     
  12. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    Fixed final band-aid bug
    Fixed 32x32 towers
    Made all collision sizes work (no longer hard coded)
    Fixed larger towers by making start and end points calculated while determining what is blocked around the tower


    So... I believe that this now has 0 bugs and it's uber fast. I could run it off of a minimum binary heap to minimize the loop sizes when the path isn't blocked, but that'd significantly increase overhead when the path is blocked (bad worst case scenario). I'm trying to keep the worst case scenario as good as possible as I think a freeze is much worse than a generally slower operation ;D.


    Anyways Bribe, you can go ahead and approve this for use in Tower War and Tower Defense maps now : D.
     
  13. Magtheridon96

    Magtheridon96
    Joined:
    Dec 12, 2008
    Messages:
    6,022
    Note: A resource can only be approved if it's requirements are approved ;)
     
  14. Bribe

    Bribe

    Code Moderator

    Joined:
    Sep 26, 2009
    Messages:
    7,339
    Approved. Fun resource.

    Edit: The RegisterPlayerUnitEvent in your map that "AnitBlock" uses is the suck, what's the point in adding verbosity by requiring boolexpr instead of code? That's a sucky change.
     
  15. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    Uh, I follow JASS standards. If you look at the actual resource, it does not have the Condition stuff in there ; ).
     
  16. Bribe

    Bribe

    Code Moderator

    Joined:
    Sep 26, 2009
    Messages:
    7,339
    If you really followed JASS standards your programming structure would be way more readable.

    Earlier this morning your code looked different, you just changed it ;)

    You originally wrote
    Code (vJASS):

    call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_CONSTRUCT_START, @Condition(@function thistype.checkBlock@)@)
     
  17. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    Uh huh, because I had forgotten to change it back. It's Condition( ) in my maps ; ).
     
  18. Bribe

    Bribe

    Code Moderator

    Joined:
    Sep 26, 2009
    Messages:
    7,339
    And in my WarChasers 2 map it only registers for players 0, 1, 5 and 6 (provided they are also playing).

    To each his/her own ;)
     
  19. Magtheridon96

    Magtheridon96
    Joined:
    Dec 12, 2008
    Messages:
    6,022
    And in my map, I use a dynamic version of RegisterPlayerUnitEvent that allows me to use multiple triggers so I can enable and disable certain boolexprs :p
     
  20. Nestharus

    Nestharus
    Joined:
    Jul 10, 2007
    Messages:
    6,106
    Fixed final bugs... I think IsPathable was bugging it up, so get the updated IsPathable objects.

    This also uses better stuff now for generating the pathing map, so it's a little bit faster on load time ^)^.


    Also, it is 100% official.. if players are allowed to build on all corners in a playable map area, they will be able to blanket the entire area. As long as you make it so one corner is unbuildable, you will be ok ^)^.


    This is due to how the preprocessing stuff works. Sadly, there is no way to resolve this issue, it's 100% impossible. Resolving this issue would make it impossible to build bricks of towers, which don't technically block >.>. The preprocessing was done purposefully to allow for bricks (in wmw, air guards are always bricks of towers). So just make one corner in each playable area unbuildable and you'll be golden.