Okay, here's the problem, I have 2 units on the map, both different units, (not like it matters much anyway), and what I need to do is detect which direction the second unit is relative to the first, like is it up and to the right, etc, so does anyone have any ideas for a conservative but fast system?
Currently I have only 2 ideas, both of which aren't as conservative/fast as I'd like, here they are:
1. Have long map-length locations for horizontal and vertical, and then send out devourer mobile grids in all directions, centering the long locations on the outermost devourers until both locations touch the other unit, then I know which direction it is based on which two directions it took for the long locations to touch it.
2. Make a small mobile grid around first unit, create an observer and order it to the second unit, see which location the observer goes to.
Any other ideas?
None.
Drop locations all over the map. The less precise you need to be, the easier it is. (40 locations used, accuracy within 40 squares on a 256x256 map) Obviously this one can be improved with some preplaced burrowed units, and only use 1 location.
Alternatively, do some not so precise x/y calculations with ~10 horizontal and vertical locations each on each unit (40 locations used, accuracy within 13 squares on a 256x256 map).
"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"
This needs to be somewhat precise, within 5 or so squares of the destination location, also, using burrowed units isn't an option, because about 50% of my map is covered in water(this is Mystic Islands RPG), and observers aren't an option because they would block mobile grids(In my second one I actually plan on using a cloaked/stacked zergling).
Any others?
None.
You could simply store the direction with use of quickly putting a burrowed unit under each of the two end points. Its obviously completely useless if you're trying to do some calculations with death counts or something, but if you need to order a unit in that direction later you'll have the direct positions of the origin and destination stored in the burrowed units.
Can we detect the intersection of two locations in any way? If we could then you could use a long thin vertical on one unit and a long thin horizontal on the other and find the intersection... but I don't think that works.
None.
I don't need to store their locations, I need to figure out the distance between the two points, and for that I first need to know which direction the second point is in(at least to do it quickly, anyway).
None.
You could use Inverted locations to track the two units' movements, and thereby know their coordinates (see attachment). That way, the difference could be found by a mere binary count off.
A more grotesque method would be to center a location on both of the units, create a scourge over one and order it to the other. Mobile grid two locations to the right and below to see which direction the scourge went. It would take only 1 loop (the scourge would be briefly visible though) with precise location measurements.
One way to find out which on was leftmore easily by creating two identical (unique) burrowed units under these two units, centering a location on said burrowed units and seeing which of the two units is in that location. Finding which of them is upmore would be a lot more heinous.
Obviously map resources are an issue here. You could always use
a Location Grid and get all the benefits of it if you're willing to put a bit of effort into it.
None.
Okay, Kaias, you were the one who I thought
might have a more elegant solution, but I see there really is none, so I'll go with my second idea, it should work the best. A mod can lock this now
None.
Okay, Kaias, you were the one who I thought
might have a more elegant solution, but I see there really is none, so I'll go with my second idea, it should work the best. A mod can lock this now
Frankly there is no Starcraft mechanic that would easily allow for detecting which unit is above the other. I also didn't notice your number 2 (as you probably guessed since I suggested the exact thing).
However, I can improve on the movement idea. Use the burrowed unit method to detect which unit is leftmost, then
left shift two locations from the two units and mobile grid a location below one of them and create/order the scourge from there (I say below because it is the easiest direction to mobile grid); this way the detection is completely invisible. It would cost just as many locations, as well (one to left shift, one to be the proper size to quickly detect the scourge movement direction), and that is only if you want it to be detected within 84 milliseconds.
None.
Well, I don't really need to do it out of sight if I'm using an observer, also, I plan on using a permacloaked ground unit to do it, so it doesn't mess up any other possible mobile grids.
None.
Well, I don't really need to do it out of sight if I'm using an observer, also, I plan on using a permacloaked ground unit to do it, so it doesn't mess up any other possible mobile grids.
Using an observer on screen is both tacky and still visible and left shifting solves the mobile grid problem. Using a permacloaked ground unit is a mistake unless there are no possible obstructions between the two units, since ground units are subject to pathfinding.
Edit: You can even bypass the slowdown caused by the burrowed unit method for detecting leftmost by doing the same thing upshifted. That issue is rather minor though, since you aren't doing it constantly.
Post has been edited 1 time(s), last time on Oct 12 2009, 12:22 am by Kaias.
None.
Hmm, I don't have the patience to understand this, but this might work for you.
http://www.staredit.net/maplantis/index.php?sid=29ed2156c4;map=31
"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"
Kaias, you're right, pathfinding issues will be bad, however, I cannot use observers, because they cannot possibly mess up my mobile grids.
rockz, too trigger intensive for my liking, I know how it works, and this can be done much simpler.
My final solution: Use burrowed units underneath(Kaias' suggestion) to detect which one is leftmost, and I'll also use a long vertical location, in case they're on the same X coordinate, and then just use a devourer mobile grid to figure out the top or bottom, (I have a pretty efficient way of covering large distances with devourers), and that should do it
Also, I need to figure out the distance, so I can get that at the same time as I'm figuring out whether it's high or low
None.