SC2Mapster Forums

Development > Triggers

question about regions

  • 8 posts
    #1 Jan 29, 2013 at 06:16 UTC - 0 likes

    when you have a region of 2 circles that partially overlap, and then you spawn an event at a "random point within that region," will the overlapped area be twice as likely to spawn the unit as the un-overlapped area? I've done some testing but it's hard to say because it's all based on probability.

    #2 Jan 29, 2013 at 07:05 UTC - 0 likes

    Interesting question, but I would guess that when you combine two regions like that they become one as far as the game is concerned and it is unlikely the chances will increase.

    #3 Jan 29, 2013 at 11:27 UTC - 0 likes

    @rtschutter: Go

    Yeah: under edit there is the merge option. Once merged - they will act as one!

    #4 Jan 29, 2013 at 12:42 UTC - 0 likes

    Quoting from natives.galaxy:

    // RegionRandomPoint attempts to find a random point somewhere within the region.  For regions
    // containing only a single positive shape, this is guaranteed to work, but for more complex
    // sets of shapes it may give up after a maximum number of tries and return (0, 0).
    //
    native point RegionRandomPoint (region r);
    

    Be careful with random points within merged regions, since it might return 0,0.

    Last edited Jan 29, 2013 by Mille25

    http://i55.tinypic.com/wio5t0.jpg

    Starcraft Universe lead programmer

    #5 Jan 29, 2013 at 14:58 UTC - 0 likes

    @Mille25: Go

    Strange. I don't see why it would fail at all if shapes are more complex.

    #6 Jan 29, 2013 at 15:01 UTC - 0 likes

    Yeah, that actually is pretty interesting, I didn't know that.

    Does anyone know how frequently it happens and what kind of regions you would merge to maximize the chance of getting a (0, 0) return?


    Check out my project:
    MechCraft

    #7 Jan 29, 2013 at 15:04 UTC - 0 likes
    Quote from Bilxor: Go

    when you have a region of 2 circles that partially overlap, and then you spawn an event at a "random point within that region," will the overlapped area be twice as likely to spawn the unit as the un-overlapped area? I've done some testing but it's hard to say because it's all based on probability.

    The probability that a point within the overlapped area is selected over a point in the non-overlapped area depends on the size of the overlap area compared to the size of the non-overlapped area.

    That, at least, sounds correct in my head.

    EDIT: This is considering that the two regions are not merged.

    Last edited Jan 29, 2013 by BasharTeg

    My Projects:
    Malum Ruina: SC2Mapster
    Eternal Exile: SC2Mapster
    Spine Crawler Madness: SC2Mapster
    Xeno Crisis: SC2Mapster

    #8 Jan 30, 2013 at 00:14 UTC - 0 likes

    @BasharTeg: Go

    Correct :) It would depend on the amount of overlapped space compared to non-overlapped space. So let's say that you had 2 separate regions of the same size, and they were overlapping by half. If you're choosing to spawn a unit into just one of those regions, then the odds are 50/50 that it will be in the area that is overlapping, because half of the whole region is. If you're spawning a unit into one of the two regions randomly, you're still getting 50/50 odds, because that would imply 4 possible outcomes, 2 of which being in the overlapping section.

    If it's a merged region, then it's being treated as one region and there is no overlapping area anymore.

  • 8 posts

You must login to post a comment. Don't have an account? Register to get one!