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.
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.
Yeah: under edit there is the merge option. Once merged - they will act as one!
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.
Starcraft Universe lead programmer
Strange. I don't see why it would fail at all if shapes are more complex.
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:
Quote from Bilxor: Gowhen 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.
Malum Ruina: SC2Mapster
Eternal Exile: SC2Mapster
Spine Crawler Madness: SC2Mapster
Xeno Crisis: SC2Mapster
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.
You must login to post a comment. Don't have an account? Register to get one!