Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Way to detect unit position?
Way to detect unit position?
Feb 1 2010, 5:43 am
By: stickynote  

Feb 1 2010, 5:43 am stickynote Post #1



Aight. I'm trying to figure out which direction a unit is facing. Right now, I'm using a mobile grid to detect where it's last position was relative to it's current position to determine that. It works, but it causes unt slow down, and the movement gets a little jerky due to mobile grid creation. It's just one unit I need to detect.



None.

Feb 1 2010, 6:15 am Kenoli Post #2



Locations alone could be used to track the unit's movement. Example here.



None.

Feb 1 2010, 10:35 am JaFF Post #3



Depends on how accurate you want it to be. Not a very accurate, but a very simple solution would be to use a basic coordinate detection system.



None.

Feb 1 2010, 5:31 pm CecilSunkure Post #4



Yeah, I think you would just have to compare the previous coordinate with the current one, and then guess the unit's direction off of that.



None.

Feb 1 2010, 6:06 pm JaFF Post #5



Quote from CecilSunkure
Yeah, I think you would just have to compare the previous coordinate with the current one, and then guess the unit's direction off of that.
Yup. I should elaborate a bit. For better results, constantly scan the unit's coordinates and record the last N positions. The greater the unit's speed, the less positions you have to record. Having a finer coordinate definition would help, too. Once you have the data, ignore everything before an acceleration change. Then subtract the current position from the last applicable one in the storage. This gives you the approximate vector of direction. You could simplify this and just compare the last observation and the current position, but it will give you less accurate results.

This is all purely theoretical; it might or might not be useful or practical for your case. If you're seriously considering using something like this, you might as well consider doing a pixel-perfect coordinate detection, because it will make this process almost unnecessary and give you loads of other benefits from the pixel-perfect coordinates you'll have. Then again, the pixel-perfect coordinate system might not be practical, too. So yeah, you have to decide what's better.



None.

Feb 1 2010, 6:21 pm ImagoDeo Post #6



http://www.staredit.net/topic/8993/

http://www.staredit.net/topic/9155/ uses this system.



None.

Feb 2 2010, 2:20 am stickynote Post #7



Ok. I got it to work. I don't know if this is the same syste kenoli used, but I'll just share my findings.

As stated in the topic linked to in Kenoli's post, locations do not center exactly on a unit since the smallest unit is 1 pixel. I used 4 inverted locations. 1 that was the width of the unit, 1 that was the height of the unit, 1 that was the unit's width minus 1 pixel, and the last was the height of the unit minus 1 pixel.

All 4 locations are centered on it, but the two that are 1 pixel smaller are centered at the top and left of the unit, with 1 side not toughing the unit edge.

So, if the unit leaves both width locations, it has moved right. If it has left the larger location but is still in the smaller one, it has moved left. It is the same with the heght locations except for down and up, respectively.
Hope that was understandable.

Post has been edited 1 time(s), last time on Feb 2 2010, 2:23 am by stickynote. Reason: Making it easier to read



None.

Feb 2 2010, 4:50 pm Kaias Post #8



Quote from stickynote
Ok. I got it to work. I don't know if this is the same syste kenoli used, but I'll just share my findings.

As stated in the topic linked to in Kenoli's post, locations do not center exactly on a unit since the smallest unit is 1 pixel. I used 4 inverted locations. 1 that was the width of the unit, 1 that was the height of the unit, 1 that was the unit's width minus 1 pixel, and the last was the height of the unit minus 1 pixel.

All 4 locations are centered on it, but the two that are 1 pixel smaller are centered at the top and left of the unit, with 1 side not toughing the unit edge.

So, if the unit leaves both width locations, it has moved right. If it has left the larger location but is still in the smaller one, it has moved left. It is the same with the heght locations except for down and up, respectively.
Hope that was understandable.
Indeed that is Kenoli's method. It's quite ingenious.



None.

Feb 2 2010, 5:52 pm CecilSunkure Post #9



Oh? It will always center to the top left, since the smallest increment of distance is 1 pixel? Referring to the two smaller locations. No units move too fast for this to not work?



None.

Feb 3 2010, 3:35 am stickynote Post #10



I have no idea. Maybe vultures with speed upgrade, but I haven't tested that.



None.

Feb 3 2010, 1:29 pm rockz Post #11

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote from rockz
Here's my theoretical list: (* indicates speed upgrade).
Nuclear Missile
Scarab
Spider Mine
Interceptor
Vulture*
Zergling*
Ultralisk*
Scourge
Broodling
Zealot*
Marine*
Firebat*
Infested Terran
Hydralisk*
Zergling
Dragoon
Dark Templar (Unit)
Infested Kerrigan
Dark Templar (Hero)
Zealot
Civilian
Firebat
Ghost
Sarah Kerrigan
Hydralisk




"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:29 am]
DarkenedFantasies -- Probably just didn't care. For example, at some point before release, they've updated the graphics of some of the Protoss buildings (Forge, CyberCore, Citadel, Observatory, Arbiter Tribunal), but instead of properly re-rendering them with edited 3D models, they did crappy copy-paste jobs on the rendered graphics.
[08:35 pm]
Ultraviolet -- :wob:
[2026-6-21. : 11:38 pm]
Symmetry -- :wob:
[2026-6-21. : 4:56 am]
Ultraviolet -- I suppose we'll likely never know, but my guess would be that they already saw it operating successfully and there was no monetary incentive to finish the original work. And the dev cycle in old school Blizzard was so hectic, it's possible it just got forgotten about after the original game got released. Plus there's an element of existing MPQ files that were packaged with the original discs becoming outdated if they updated it. And it's not like they remade the original MPQs, they just made new ones for BW specifically
[2026-6-21. : 4:26 am]
Oh_Man -- so that makes me think maybe the theory they are unfinished is not true and its a deliberate design decision, coz why not finish them wen ur making brood war?
[2026-6-21. : 4:25 am]
Oh_Man -- the thing is thos buildings are from classic. that means they went ahead and made brood war without ever finishing the 'unfinished' buildings
[2026-6-20. : 6:15 pm]
Ultraviolet -- Yeah he's talked about a lot of that stuff in his casts before. It seems plausible. Especially knowing how Blizzard of yesteryear operated.
[2026-6-20. : 3:47 pm]
NudeRaider -- to clarify: couldn't recall the behavior for every single Protoss building but I was aware the disparity exists.
[2026-6-20. : 3:43 pm]
NudeRaider -- Contained nothing new for me. Didn't know all building's behavior, but very much all unit's. Also Terran balance whine - also nothing new :lol:
[2026-6-19. : 9:57 am]
Oh_Man -- makes me wonder if SEN knows anything about the topic
Please log in to shout.


Members Online: jun3hong, Roy