1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Welcome to the new Hive! Be advised that we're still working on the site. There are still many rough edges, so please bear with us.
    Dismiss Notice
  3. The 14th Icon Contest is still in progress (and may be extended). You can still make it in time.
    Dismiss Notice
  4. The 25th Texturing Contest has started! Contestants are to create a skin representing a dark elf person/being or any construct related to it using the vanilla models or the custom ones found on the site.
    Dismiss Notice
  5. The poll for Terraining Contest #18 is finally up! Play through the maps and cast your vote on your favourite.
    Dismiss Notice
  6. Buy it, use it, break it, fix it, trash it, change it, mail - upgrade it. Join (Optionally) Paired Techtree Contest #11 - Techno Magic now!
    Dismiss Notice
  7. Voting squad, line up! Cast your vote on the poll for Modeling Contest #29 - Squads!
    Dismiss Notice
  8. 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
  9. The poll for the theme of our StarCraft II Terraining Contest is up. Cast your note now!
    Dismiss Notice
  10. The ninth Concept Art Contest has launched. Enter now!
    Dismiss Notice
  11. The member Kam is making HIVE coasters. Take a look. For every coaster you buy, Hive gets $1.
    Dismiss Notice

[Snippet] IsPathBlocked

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

  1. Bribe

    Bribe

    Code Moderator

    Joined:
    Sep 26, 2009
    Messages:
    7,335
    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,101
    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,335
    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,101
    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,101
    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,101
    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,027
    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,101
    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,101
    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,101
    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,027
    Note: A resource can only be approved if it's requirements are approved ;)
     
  14. Bribe

    Bribe

    Code Moderator

    Joined:
    Sep 26, 2009
    Messages:
    7,335
    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,101
    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,335
    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,101
    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,335
    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,027
    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,101
    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.