(edited by Archomeda.6472)
Mumble Link position incorrect
You have one of the characters in the sylvari home area. Although i know nothing about mumble or the APIs of gw2, i think i did read somewhere that you couldn’t check in wich level the character was. Positioning of altitude was a problem and could mess up some stuff. (sorry about my broken english).
Try to search more info about that, maybe the altittude is a problem since the sylvari home place have so many different levels.
Aens / Ellantriel / Nao To Mori / Saelyth. Commander
Guias de Raids en español / Spanish raiding guides
You’re correct about not being able to get the level where your character is at currently. But that’s irrelevant here. If I would forget parsing some levels specified in a specific map in maps.json, I would be missing waypoints, not waypoints/POIs that are slightly off (believe me, I encountered that already a few days ago when I only parsed the default floor and not all of them).
Let me explain something else too. The position of POIs/etc. are defined as 2D (x,y) coordinates only, which gives something like this:
{"poi_id":308,"name":"Astorea Waypoint","type":"waypoint","floor":1,"coord":[9955.92,
19833.2]}
The coordinates you get from Mumble Link, are defined as 3D (x,y,z). After some conversions to get it in the right units, you can compare the (x,z) with the (x,y) of the POI. The “y” in (x,y,z) is the vertical axis a.k.a. the height. I completely neglect that value when comparing, because I have nothing else to compare it with.
Long story short: I only compare the coordinates in a 2D field because that’s the only option that’s available.
Nevertheless, I appreciate your reply but I think the problem lies somewhere else.
My thoughts are: either the client writes incorrect positioning data to Mumble Link, or the API incorrectly defines the map_rect or continent_rect of Caledon Forest (because that’s what the units conversions depend on), or I am doing something horribly wrong. That’s why I really want someone else to try confirming this with their own code. This way the odds that my code is wrong will be significantly less than what it is now if I’m indeed correct about this.
Also, a small note, I went to see if the coordinates of the waypoints of Caledon Forest are incorrectly defined in the API, but I can confirm visually with the help of some snippet that Cliff made and the ingame map that those coordinates are correct.
Have you tried checking it with our Location Tracker? I haven’t yet, but it might give you a glimpse if you have an error in your code or the coordinates for the waypoint are somehow wrong in the API (i doubt the latter). You can also check out the code of our tool which is written in C/C++ over here: https://gw2apicpp.codeplex.com/SourceControl/latest
Oh btw. it would be great if your TS plugin would also feature sending the location data to a specified server too
(edited by smiley.1438)
For Astorea Waypoint, I get the coordinates:
-6819.29x, -39774.16y, -192.28z
According to the API:
continent_rect.×1 = 9344 px
continent_rect.y1 = 16128 px
continent_rect.×2 = 11264 px
continent_rect.y2 = 20096 px
map_rect.×1 = -21504 in
map_rect.y1 = -46080 in
map_rect.×2 = 24576 in
map_rect.y2 = 49152 in
coord.x = 9955.92 px
coord.y = 19833.2 px
Using the formula to convert pixels to in-game coordinates:
x = (coord.x – continent_rect.×1) / (continent_rect.×2 – continent_rect.×1) * (map_rect.×2 – map_rect.×1) + map_rect.×1
y = (1 – (coord.y – continent_rect.y1) / (continent_rect.y2 – continent_rect.y1)) * (map_rect.y2 – map_rect.y1) + map_rect.y1
x = -6817.922 in
y = -39772.78 in
In reverse, using the in-game coordinates to find the pixels:
x = -6819.29 in
y = -39774.16 in
coord.x = (x – map_rect.×1) / (map_rect.×2 – map_rect.×1) * (continent_rect.×2 – continent_rect.×1) + continent_rect.×1
coord.y = (1 – (y – map_rect.y1) / (map_rect.y2 – map_rect.y1)) * (continent_rect.y2 – continent_rect.y1) + continent_rect.y1
coord.x = 9955.863 px
coord.y = 19833.26 px
@smiley: I tested it and it was correct, and I see the problem now thanks to Healix.
A while ago when I started to mess around with locations, I read somewhere that the z-axis of Mumble Link was inverted. Without looking further into it I used it again (just putting a minus on the z-coord, as you probably can see in the screenshots). But now I see that it is incorrect in some cases.
In the incredibly extensive formulas Healix wrote down, I noticed that it is still somewhat inverted, only in another way. This part was my problem:
coord.y = (1 – (y – map_rect.y1) / (map_rect.y2 – map_rect.y1)) * (continent_rect.y2 – continent_rect.y1) + continent_rect.y1
What I did comes down to this:
coord.y = (-y – map_rect.y1) / (map_rect.y2 – map_rect.y1) * (continent_rect.y2 – continent_rect.y1) + continent_rect.y1
I manually checked some random waypoint in Bloodtide Coast, and with that small change in the formula, it is now correct.
@Healix: Many thanks for your effort! I really appreciate what you’ve done to help me identify the problem. The way how my calculated coordinates were correct for most maps clouded my vision and let me believe the problem was somewhere else. Now I only have to implement it.
@smiley again: I will put it on my todo list. Since I’m just a novice in C++ I need to work out how I can POST to websites (also a settings screen in TS, but first the core features). Really, this is the first time writing something of this scale in C++. Having a background of C# and somewhat of C certainly helps a lot. I’ll post in the API section again when I’m ready to release it, although you can already check out the source on GitHub if you want.
EDIT: Just a random note regarding to this, wouldn’t it be easier to put these formulas on the wiki for easier access? I notice a lot of people are having trouble with the conversion between coordinates.
(edited by Archomeda.6472)
I just fumbled on the same problem on my project, i was considering posting but you made it before i do
Thank you for the post, and Healix, for the answer !
EDIT: Just a random note regarding to this, wouldn’t it be easier to put these formulas on the wiki for easier access? I notice a lot of people are having trouble with the conversion between coordinates.
These are already over here in multiple threads – have a look at this one:
https://forum-en.gw2archive.eu/forum/community/api/How-to-convert-from-Mumble-to-Map-API-Coords/
I’ve added the formula to the german translation of the API docs back when i did the translation:
http://wiki-de.guildwars2.com/wiki/API/v1/event_details
Since noone seemed to adopt it, i’ve added it to the english wiki too (right now):
http://wiki.guildwars2.com/wiki/API:1/event_details
These are already over here in multiple threads – have a look at this one:
https://forum-en.gw2archive.eu/forum/community/api/How-to-convert-from-Mumble-to-Map-API-Coords/I’ve added the formula to the german translation of the API docs back when i did the translation:
http://wiki-de.guildwars2.com/wiki/API/v1/event_detailsSince noone seemed to adopt it, i’ve added it to the english wiki too (right now):
http://wiki.guildwars2.com/wiki/API:1/event_details
Looks nice! Although I’m not really sure about code examples in specific, it does its job to provide details of the conversion in just a few lines. And converting it the other way around should be easy to figure out too with this example. The only catch is that “1 – …” in the y-coords in my opinion.
Since most people tend to use a TL;DR version i think it’s totally ok in this case. If one wishes to see a further explaination, he could just hop over to the linked forum thread.
The only catch is that “1 – …” in the y-coords in my opinion.
The trick is that map_rect is given to you in a rectangle format that has been converted from x/y coordinates, causing the y-axis to be inverted. Instead of reading it as a rectangle [left, top], [right, bottom], it’s the axes [west, south], [east, north] where the x/y point [0, 0] is the center of the map and z<0 is above sea level.
If you prefer it, instead of going “1 – …”:
coord.y = (map_rect.y2 – y) / (map_rect.y2 – map_rect.y1) * (continent_rect.y2 – continent_rect.y1) + continent_rect.y1
Since most people tend to use a TL;DR version i think it’s totally ok in this case. If one wishes to see a further explaination, he could just hop over to the linked forum thread.
Agreed, that’s a valid point. We all want that nowadays, and if you are at least experienced in a language, you definitely should get the gist of it
The trick is that map_rect is given to you in a rectangle format that has been converted from x/y coordinates, causing the y-axis to be inverted. Instead of reading it as a rectangle [left, top], [right, bottom], it’s the axes [west, south], [east, north] where the x/y point [0, 0] is the center of the map and z<0 is above sea level.
If you prefer it, instead of going “1 – …”:
coord.y = (map_rect.y2 – y) / (map_rect.y2 – map_rect.y1) * (continent_rect.y2 – continent_rect.y1) + continent_rect.y1
Huh, it never occured to me that you could also see it that way. I will stick with the first one, since it’s easier with the way how I implemented the structs. But thanks for the explanation!
It’s also completely implemented in CrossTalk including Server-Sent Events, soon switching to WebSockets.
It’s also on GitHub, so one might contemplate if it wouldn’t be more effective in joining me to improve one implementation instead of creating several, just saying.
CrossTalk TS3 Addon Author
http://addons.teamspeak.com/directory/plugins/miscellaneous/CrossTalk.html
(edited by Wothor.4781)
It’s also completely implemented in CrossTalk including Server-Sent Events, soon switching to WebSockets.
It’s also on GitHub, so one might contemplate if it wouldn’t be more effective in joining me to improve one implementation instead of creating several, just saying.
I have seen CrossTalk, and although I haven’t tried it myself, I think it’s some pretty awesome stuff just to implement positional audio in TS. But that’s also the catch: I’m not implementing positional audio (also not planning to). What I’m doing is very specific for GW2 itself: provide GW2 location tracking information about other people on the TS server as you can see in the screenshot. I figured that this is a whole different usage concept than the one of your plugin.
I do have the playing as info in it, I do have a server for a javascript/html fork of smileys running which shows the users on a map using the positional data of all users in the channel, all specifically for gw2.
The primary reason I did not add the positional info on the ts window itself is that I found it preferable to see such info on an overlay like overwolf and I found it more appropriate to do the Web API stuff there if you have a web app anyways.
Hence I don’t think it’s such different in the end, or to put it another way, I’d like to avoid ending up with having two plugins on an end-users machine that simultaneously parse the link as well as communicate the positions over the interwebs. At the latest point when you’d add plugin communication to show other ts users positions, we’d be conflicting for ressources, like Teamspeaks spam system applying to plugin communication, at which point we’d potentionally have to vice versa recommend to disable the other one. So I figured joining forces could be the lesser evil ;P
Otherwise it’d be adviseable to have a concept to work around such, which I feel could end up being more work afterall.
CrossTalk TS3 Addon Author
http://addons.teamspeak.com/directory/plugins/miscellaneous/CrossTalk.html
(edited by Wothor.4781)
Ah, that’s something I haven’t found yet in your source.
And yeah, about Overwolf, personally I don’t like it for various reasons that will take too much space in this post if I explain it.
Anyway, it seems you share the same thoughts as me with providing location tracking and everything that comes with it. And I agree that the plugin commands restriction is somewhat annoying to work around with, the only solution is to limit the commands, which is what I’m effectively doing (standing still shouldn’t send any new location information, since it’s useless). But yeah, it’s possible to join forces. At least if we could also add some information in the client itself directly (like I’ve already started working on), and not only in an web app through Overwolf. Shouldn’t be that hard, since most people play 1 game at a time, so it wouldn’t take up space from possible information about other games . Also, it would be fantastic to show locations it in the normal browser as well, for second screen purposes (which I like more than having an overlay).
The WebApp doesn’t care if it’s run in OW, Project Kryptonite or a web browser, once I allow LAN connections (in case of browser compatibility) it should even run on smart phone tablet stuff.
However, since there’s obviously a demand for showing some info in TS itself, I can let that overrule my initial preference of just pushing the info out, sure
Writing a pm to discuss further procedure.
CrossTalk TS3 Addon Author
http://addons.teamspeak.com/directory/plugins/miscellaneous/CrossTalk.html