Thread Tools Display Modes
04-22-08, 11:18 AM   #1
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
Question Relative position of raid members in a instance

Hello WoW UI experts,

Short question: Is there a way to get distances between raid members in a instance?

Long question: I'm writing addon for priests that will suggest casting Circle of Healing to a raid member. Circle of Healing heals target and all its party members within 18 yards. So my addon should know distances between different members of raid. I can implement it if all raid members have addon that checks distances between "player" and "partyX" and sends it to other addons. But I don't want to force raid members to install my addon.

Speculation: Minimap shows location of nearby raid members. Maybe there is a way to extract this information?

Any suggestions and hints are appreciated.
  Reply With Quote
04-23-08, 06:19 AM   #2
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by romkatv View Post
Short question: Is there a way to get distances between raid members in a instance?
In an instance, you cannot recover a player's coordinate. The only thing you can recover is the position of the last minimap ping compared to you. If a player uses Minimap:PingLocation(0,0) to ping herself/himself on the minimap, then you can know precisely where he stood when he did so.

It's a very, very, very restrictive way to know player's positions, because everyone has to use the addon, and you have to properly hook the pings so that they don't show if they are only meant to be a position update, and things like that. But it's still something doable to some extend.

I started coding something for Kalecgos for my guild that pops a "Tomtom"-like arrow (hear "Crazy Taxi" if you don't know Tomtom), pointing to the portal, whenever a member of your "team" (which is defined in another guild-addon) gets a portal on himself. It uses this strategy, and it works decently on debug sessions when I test it with my own spells in Shattrah. As we downed Kalecgos in 1 try last week and it didn't work directly, I cannot really tell you that it works now, but it should. I hope it gives you an idea of what's possible to do.

There may be other workarounds, but I doubt it. As you see, it's pretty hard to do anything that isn't completely shared among guild members, and even then, keeping updates very frequent would be a bad thing, I think.


Edit:
Speculation: Minimap shows location of nearby raid members. Maybe there is a way to extract this information?
Oh, and no, that isn't possible. The only thing you can recover is the ping, I think. Things like the position of your corpse, or your raid's members, are coded at a lower level than what you can reach with the API.
  Reply With Quote
04-23-08, 07:00 AM   #3
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by Layrajha View Post

Edit:
Oh, and no, that isn't possible. The only thing you can recover is the ping, I think. Things like the position of your corpse, or your raid's members, are coded at a lower level than what you can reach with the API.
You could have the cursor periodically moving over the minimap and parsing the tooltips.
  Reply With Quote
04-23-08, 08:01 AM   #4
Arkive
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 242
Layrajha,

If each member is required to use the addon (which breaks the usefulness of most mods imo), instead of using ping to define coordinates, why not just use a hidden channel to broadcast coordinates and parse that out instead?

Since I imagine there are quite a few mod ideas that could make use of something like this, I iamgine this would be a great idea for a shared library. However, that said, it would be even better if GET_UNIT_COORD existed in the API
  Reply With Quote
04-23-08, 09:25 AM   #5
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
Originally Posted by Layrajha View Post
In an instance, you cannot recover a player's coordinate. The only thing you can recover is the position of the last minimap ping compared to you. If a player uses Minimap:PingLocation(0,0) to ping herself/himself on the minimap, then you can know precisely where he stood when he did so.

It's a very, very, very restrictive way to know player's positions, because everyone has to use the addon, and you have to properly hook the pings so that they don't show if they are only meant to be a position update, and things like that. But it's still something doable to some extend.

I started coding something for Kalecgos for my guild that pops a "Tomtom"-like arrow (hear "Crazy Taxi" if you don't know Tomtom), pointing to the portal, whenever a member of your "team" (which is defined in another guild-addon) gets a portal on himself. It uses this strategy, and it works decently on debug sessions when I test it with my own spells in Shattrah. As we downed Kalecgos in 1 try last week and it didn't work directly, I cannot really tell you that it works now, but it should. I hope it gives you an idea of what's possible to do.

There may be other workarounds, but I doubt it. As you see, it's pretty hard to do anything that isn't completely shared among guild members, and even then, keeping updates very frequent would be a bad thing, I think.
Cool, can you share you code so that I can play with it?

P.S.
What addon do you use on Kalecgos to form "teams"? I was going do write similar addon because people are always confused and don't know when they should jump in the portal. If it's your addon could you share it?

P.P.S.
It is possible to get distance from "player" to "partyX". Do you know if we can get direction as well? If we could then it's possible to calculate position of every raid member by doing triangulation (but it requires each raid member to broadcast distances to other members of the raid and directions to them).
  Reply With Quote
04-23-08, 09:26 AM   #6
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
Originally Posted by Arkive View Post
Layrajha,

If each member is required to use the addon (which breaks the usefulness of most mods imo), instead of using ping to define coordinates, why not just use a hidden channel to broadcast coordinates and parse that out instead?
Because in a instance you can't get coordinates even for "player".
  Reply With Quote
04-23-08, 09:28 AM   #7
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
Originally Posted by Slakah View Post
You could have the cursor periodically moving over the minimap and parsing the tooltips.
How can I do that? Is it possible to move cursor from addon code? Can you give me some pointers? And if my cursor is already above some raid member on minimap then how can I parse the tooltip that is popped up?
  Reply With Quote
04-23-08, 09:38 AM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by romkatv View Post
Because in a instance you can't get coordinates even for "player".
Right - coordinates don't exist in an instance.

Originally Posted by romkatv View Post
How can I do that? Is it possible to move cursor from addon code? Can you give me some pointers? And if my cursor is already above some raid member on minimap then how can I parse the tooltip that is popped up?
No, you'd have to move the minimap under your mouse periodically. This was an idea that was thought up to make a sound whenever an herb or ore popped up on the minimap - to make it really small and put it under your cursor. As for this type of idea... I don't know what you would gain from scanning the minimap in that fashion for raid members...
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-24-08, 01:27 AM   #9
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
Originally Posted by Seerah View Post
No, you'd have to move the minimap under your mouse periodically. This was an idea that was thought up to make a sound whenever an herb or ore popped up on the minimap - to make it really small and put it under your cursor. As for this type of idea... I don't know what you would gain from scanning the minimap in that fashion for raid members...
Sounds promising! Was it implemented? If yes then can I look at code? If it wasn't implemented then could you explain a bit on how I can extract information from tooltip under the cursor?
  Reply With Quote
04-24-08, 03:51 AM   #10
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by romkatv View Post
Sounds promising! Was it implemented? If yes then can I look at code? If it wasn't implemented then could you explain a bit on how I can extract information from tooltip under the cursor?
Well, this code is really a great idea to do what it does: recovering data from the content of the possible tooltips of minimap dots. I'm not sure how the minimap tooltips work if two items other than like, 2 veins, are one on each other, but assuming that it works well and that you can recover the list of everything displayed on the minimap (and not only gathering stuff), you still cannot know where they were, because what you did was to reduce the size of the minimap to a few pixels under your cursor (with some additional code to make the whole work smoothly, playing with the minimap every now and then, actually recovering tooltip data etc), but you have no idea about where everything was.
Anyway, about parsing tooltips, I don't know how people do it. You can probably hook all the gametooltip:set[something] methods ( http://www.wowwiki.com/Widget_API#GameTooltip ). If you need more about how the tooltips work, read things like http://wdnaddons.com/2418124/FrameXML/GameTooltip.xml and http://wdnaddons.com/2418124/FrameXML/GameTooltip.lua .
Or if that's still too unclear, try to find an addon that parses tooltip data and looks simple to read (as in, you think that it probably parses tooltip data, and almost only does that ^^).


Originally Posted by romkatv View Post
Cool, can you share you code so that I can play with it?

P.S.
What addon do you use on Kalecgos to form "teams"? I was going do write similar addon because people are always confused and don't know when they should jump in the portal. If it's your addon could you share it?

P.P.S.
It is possible to get distance from "player" to "partyX". Do you know if we can get direction as well? If we could then it's possible to calculate position of every raid member by doing triangulation (but it requires each raid member to broadcast distances to other members of the raid and directions to them).
The code is only semi-functional, and quite messy, ugly, and in a version that I'd be ashamed to post on wowi. But I can give you a link to it nonetheless. I am still working on it from time to time, so that I can indeed release something, someday, maybe.

to the PS:
It is a part of the same addon. Basically, the addon is a guild-compilation. The addon for the teams is not functional yet either. Or... partially, but full of bug. It's stupidly boring to test addons which require a full raid group, the ability to move members in the raid, with some addon communication involved etc :<

to the PPS:
You can get the exact distance (without pings, and in an instance)? How? If you can, I'm interested in that. If you meant that you can estimate the distance using "IsSpellInRange" and stuff like that, then the problem is that triangulation suffers too much from these variations. There are probably clever optimization algorithms that would gather all the distance data from everyone in the raid and compute the most probably map, but it'd be really expensive, CPU-wise, I believe. I am not very good in non-exact algorithmics, but I don't think it would be possible to do something like that which would be more or less precise, real-time, and lag-free. Unless, like, you use another comp with another (26th) player (not raiding), to which everybody sends data, and he does the maths and sends back the results every now and then, trading CPU for latency ^_^
  Reply With Quote
04-24-08, 11:04 AM   #11
romkatv
A Deviate Faerie Dragon
Join Date: May 2006
Posts: 15
Thanks, Layrajha. I'll investigate what I can do with tooltips parsing.

Originally Posted by Layrajha View Post
to the PPS:
You can get the exact distance (without pings, and in an instance)? How? If you can, I'm interested in that. If you meant that you can estimate the distance using "IsSpellInRange" and stuff like that, then the problem is that triangulation suffers too much from these variations. There are probably clever optimization algorithms that would gather all the distance data from everyone in the raid and compute the most probably map, but it'd be really expensive, CPU-wise, I believe. I am not very good in non-exact algorithmics, but I don't think it would be possible to do something like that which would be more or less precise, real-time, and lag-free. Unless, like, you use another comp with another (26th) player (not raiding), to which everybody sends data, and he does the maths and sends back the results every now and then, trading CPU for latency ^_^
Yes, I meant estimate distance, not exact. IMHO, it's an interesting algorithmic problem to calculate positions given only rough distances between players

But if it's possible to extract directions where other players located then we can do triangulation without distances at all. But I failed to find a way to get directions...
  Reply With Quote
04-25-08, 09:19 AM   #12
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Well, it's indeed not possible to get the directions (unless you simply know where people are, as you can know where you're facing, but well, it doesn't really help ).

About the algorithm with imperfect data, yes, I think it's a very interesting problem as well. I guess that some "turbo" function, starting with the average possible distance for everyone (as in, you usually know they are like, "between 10 and 30 yards", and if so, just assume it's 20), slightly optimizing a cost value once, and doing it again and again until you have done a certain number of steps, or unless your cost function has reached a threshold.

Finding a clever cost function is probably not too hard, coding the structure of the algorithm isn't either. But finding a way to actually give a consistent though not perfect "first draft" of a map with such imprecise data really looks hard. I'd probably try to place the players that are furthest away from each other...

And anyway, whatever you do, you'll never have absolute positions: if you look your minimap in a mirror, the distances are the same. I mean that you cannot distinguish between mirror-equivalent maps unless you're given a hint by something that I haven't thought about.

And after finding that, remains the coding part, the communication part between clients, etc

Would really be a huge project, I think.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Relative position of raid members in a instance


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off