Thread Tools Display Modes
11-22-09, 05:33 AM   #1
athonus
A Murloc Raider
Join Date: Nov 2009
Posts: 7
Addon Request - draw to world raiding addon

Hey all,

I've been looking into making an addon but i'm not exactly skilled or knowledgeable in lua to make what i want so i'm asking for to make this addon if they would want to. Heres the idea, an addon that would assist in making raiding easier by drawing lines onto the user interface but appear to be drawn onto the world. With this addon you would be able to draw lines flat to the world to help players with situational awareness and/or preplanning for boss fights new and old (well not too old but woltk boss fights.)

Ok how it would work. The addon would have 2 parts, a 2D design feature something like paint but over instance maps and a 3D part that would draw what was done in the 2D part onto the users view. The way the user interface works compared to the world is like looking through a window to the world outside, you cannot directly interact but you can calculate everything from the perspective of the person looking through the window.

Example on how the addon works - Imagine driving down the road in a car, you look out the window and draw a box around each tree you see but in real life you cannot draw a nice box around each tree so you draw on the window of the car. as the car moves the world outside would move as well and the boxes you drew on the window wouldn't be on the trees they needed anymore so you would have to erase the lines on the window and then redraw them back around the trees. make any sense?

I've figured out how a lot of the math would work but i cant figure out a way to put it into words on the screen.

If you want to give it a shot let me know ill be more then happy to try and horridly explain what i've figured out, or if anything doesn't make sense i'll try another way to explain.
  Reply With Quote
11-22-09, 06:11 AM   #2
Psychophan7
A Chromatic Dragonspawn
Join Date: Feb 2006
Posts: 153
Take a look at http://www.wowinterface.com/download...62-ArtPad.html
  Reply With Quote
11-22-09, 06:31 AM   #3
athonus
A Murloc Raider
Join Date: Nov 2009
Posts: 7
Ahh cool didn't know about that addon, but it isn't exactly what i'm looking for. from what i can tell that addon only can draw in 2D and nothing drawn can be made to move according to the player.

What i'm looking for is if you draw 2D designer part of the addon that takes what is drawn their and takes each point of each line drawn and then uses the players camera, pitch and yaw to make everything drawn in 2d to appear to be drawn in 3d.

Example -- Crusader Coliseum - in the 2d designer part with the minimap view of crusader coliseum draw lines to outline the star pattern. Now if the player stands in the center of the coliseum and looks at the big double doors he wont see the star patten in the center of his screen but a line that gos around the star pattern designed on the ground and if the player moves or turns around the star pattern will remain where it is drawn on the ground but will appear to move on the players screen.

the only down side to an addon that can do this is everything drawn will appear to be like flat ground and if the terrain has height changes then the lines drawn onto the screen will appear to go off into the ground and may be a little problematic. but most of the boss fights i can think of are on flat or mostly flat terrain so i don't think that would cause much of a problem.

Last edited by athonus : 11-22-09 at 06:36 AM.
  Reply With Quote
11-22-09, 07:16 AM   #4
Psychophan7
A Chromatic Dragonspawn
Join Date: Feb 2006
Posts: 153
Theoretically, that should be possible. Take into account the position of the player, the zoom distance and pitch of the camera, and then just redraw an image on the screen as needed.

The real issue is that we absolutely cannot draw into the 3D world. Everything would be a 2D image, attempting to simulate the 3D effect. We also cannot retrieve the vital Z coordinate for any unit, so any sort of positioning/scaling voodoo code to emulate the effect of the outlined star being on the ground would be difficult to do. There are a great many variables that have to be accounted for to create the effect properly, but much of the information for those variables isn't readily available by the API.



Not impossible, just difficult. And requiring a bit of trig.
  Reply With Quote
11-22-09, 07:26 AM   #5
athonus
A Murloc Raider
Join Date: Nov 2009
Posts: 7
Ya, i've put some time into how it can be done, and i've figured out how it is possible to generate a point on the screen that relates to a point on the game world. I can tell ya everything you should need to know to figure out how to plot each point but i cant give you the trig involved because i cant remember how you use sin or cos but i know they are used. i can try to explain it but i have a hard time explaining to myself.
  Reply With Quote
11-22-09, 08:41 AM   #6
athonus
A Murloc Raider
Join Date: Nov 2009
Posts: 7
To define a point on the screen you need to know several key pieces of information then throw it through some trig and then you can find out where the point should be on the screen.

to start you need to know the location of the point on the world, well use x = .5 and y = .5 a point that is exactly in the center of the map so now we take another point lets say x2 = .5 and y2 = .6, a point due south of the first point. x2 and y2 are the position of the player. now lets set the camera pitch and distance, cPitch = 45 and cDist = 10. lets set a standard yard = .001 so the distance of point 1 to the player is 100 yards south of the first point. Now lets do some trig --

--Angles -
135 (180 - cPitch = 45)
30 (camera vertial viewing angle / 2)
15 (our far angle)

--Distances - (in yards)
10 (distance from the center of the screen to the camera)
100 (distance from the player to point 1)
var_X (the hypotenuse)
var_max_Distance (need to know what is the max distance that can be seen on the players screen)

--Trig - (kinda)
Use the angles and the known distance from the cDistance of 10 to find var_X and var_max_Distance. with var_max_Distance you know that with this current cPitch that from the center of the screen to the top edge of the screen is a distance of var_max_Distance. Now to find if point 1 is visable, take the distance from the player to point 1, 100 yards, and see if it is less than var_max_Distance if so lets calculate what % of var_max_Distance is our distance of 100 yards and well call this % var_distance_percent. now we know the center of the screen is var_height = screenHeight / 2 and var_width = screenWidth / 2. now that we know the center of the screen we can plot our point onto the screen. we have var_distance_percent and now we can take the distance from the center of the screen to the top of the screen and find the point on the screen that is var_distance_percent from the center to the top and there we go we've got out point.

A point offset ether side of dead center is a little bit harder to calculate and i haven't figured out a good enough way to calculate a point offset of center but i got some ideas just need to do some thinking.

Last edited by athonus : 11-22-09 at 10:46 AM.
  Reply With Quote
11-24-09, 05:14 AM   #7
athonus
A Murloc Raider
Join Date: Nov 2009
Posts: 7
ok well i think i figured out a way to plot a point to offset of center. By figuring out the distance from the camera to the top or bottom of the screen we should also have the distance ether side of dead center because the horizontal fov should be 90 degrees (45 degrees each side) and for what i'm thinking the distance from the camera to the ground at the top and bottom of the screen should be the same distance from the center to each side of the screen. now that we know the bounds of the screen we need see if any point would lie within these bounds we find the vertical angle from the camera to the point and use this to find the new distance from the camera to the vertical distance to the point and this distance that we find should be the distance from the centerline of the screen to the edge. if the point still lies within the bounds of the screen. Now we see if the horizontal distance still within the bounds of the screen, if so now we just take the horizontal distance and find what % of the horizontal max distance is the horizontal bounds and then plot the point using the % we found. from what im thinking this should work but i have no definite idea.
  Reply With Quote
11-24-09, 10:07 AM   #8
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
I've already tried something similar (3d overlays) for different uses: flag carrier position, location of trainers/vendors in cities and quest objectives in 3.3.

It's good to start with LibCamera-1.0 by Saiket
and the 3d projection-Wikipedia page.
My first experiments were around some calculations with lots of triangles and trigonometric functions. The display was fairly accurate as long as the overlay was in the half of the screen width or height, but created some huge deviation around the corners of the screen. With the formulas of the wikipedia-page above, it now works perfectly and absolutely accurate.

You can view my current code at http://github.com/xconstruct/Coordin...aster/core.lua.
The different steps are the following:
1) Moving coordinates, so that the camera position is the origin - I've grabbed the map coordinates of the player and calculated the position of the camera relative to the player based on its roll, yaw and distance.

2) Rotating the coordinate system to the view angle of the camera.

3) Calculating the screen coordinates. By experimentation, I discovered that the viewer of the screen seems to be two yards away from the camera, creating an angle of view of 53°. Don't forget that the screen dimension and field of view change with the ratio of the WorldFrame, e.g. if it decreases in height, the field of view increases. I'm currently experimenting with the right values - it works perfectly for a ratio of 4:3.

However, there are some limitations in the WoW API for exact positioning:
1) Z-Coordinates: You can't fetch the z-coordinate through the API, so you either need to put all overlays on the same level relative to the player, or create a "heightmap-addon" providing the z-Coordinate by delivering x/y to it.

2) As far as I know, there is currently now way to fetch x/y-coordinates of a player in an instance, so the overlays would need to be relative to the player.

I've attached a few demonstrating screenshots of my addon. The overlays display the distance in the center. First screenshot shows my first tests, the second one is trainer/vendor location (you can see the missing z-coordinate). The third one shows some "path-tracking" of my position (well, it was a cpu-speed test with large amounts of overlays) and the last one is the flag carrier position in WSG - walllhack inc!!11

I plan trying to draw lines on the screen, should be fairly easy: connecting just two screen coordinates. Imagine that your character can walk around a floating wireframe cube!
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_110709_164244.jpg
Views:	749
Size:	306.3 KB
ID:	3585  Click image for larger version

Name:	WoWScrnShot_110709_185300.jpg
Views:	836
Size:	312.6 KB
ID:	3586  Click image for larger version

Name:	WoWScrnShot_110709_202926.jpg
Views:	742
Size:	426.7 KB
ID:	3587  Click image for larger version

Name:	WoWScrnShot_110709_225442.jpg
Views:	1441
Size:	159.4 KB
ID:	3588  

__________________
« Website | GitHub »

Oh hai!

Last edited by xConStruct : 11-24-09 at 10:12 AM.
  Reply With Quote
11-24-09, 10:25 AM   #9
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Code:
or create a "heightmap-addon" providing the z-Coordinate by delivering x/y to it.
, that'll be a hell of a lot of data if you would want any kind of accuracy.
  Reply With Quote
11-24-09, 10:37 AM   #10
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Yeah

But for my uses (warsong flag), I think you could easily divide it into a few equal height sections, e.g. the graveyard, the center, the bases, the roofs ... urgh stop - how do we get the different floors of the bases? Checking the path the player went and if he used any ramps on his way? Well ... hello cpu and memory

Blizz, I need z-coordinates!
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
11-24-09, 10:51 AM   #11
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
It might be possible to instantaneously change the camera angle to above the player, zoom out as much as possible and measure GetCVar("cameraDistanceE") to determine whether you are inside the Warsong hold. I don't have WoW at this current time to test, but it would be pretty nifty if it worked.

It assumes that cameraDistanceE will stop increasing when the camera hits a wall.
  Reply With Quote
11-24-09, 11:23 AM   #12
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
That's a really good idea, never thought about this one.
But unfortunately, cameraDistanceE increases even if you hit a wall, like you already thought. Noticed that, because LibCamera-1.0 makes use of it, too, and my overlays get messed up when they the camera hits a wall.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
11-24-09, 11:57 AM   #13
kneeki
A Flamescale Wyrmkin
 
kneeki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 134
Originally Posted by Cargor View Post
I've already tried something similar (3d overlays) for different uses: flag carrier position, location of trainers/vendors in cities and quest objectives in 3.3.
Wow man... Just, wow!

Seeing this addon forces me to question why I even write addons at all. There are addon authors, and then, there are elites. This addon is bad ass, even with the flaws you state! Keep up the work on this and hundreds of thousands of people will love you!

[edit] I downloaded and loaded up your addon, did a quick '/script Coordinator:CreateTarget("Gnome", GetPlayerMapPosition("player"))' and peed a little. Amazing work you did there!!!

Last edited by kneeki : 11-24-09 at 12:26 PM.
  Reply With Quote
11-24-09, 01:57 PM   #14
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
That is nice breakthrough Real nice
__________________
Never be satisfied with satisfactory.
  Reply With Quote
11-25-09, 03:36 PM   #15
athonus
A Murloc Raider
Join Date: Nov 2009
Posts: 7
Wow! Taken a look at the screen shots you posted and just wow, that looks great! What i was testing and theorizing was information revolving around the center of the screen and calculated from the point of the player, but from what you said and have been able to prove is that everything needs to revolve from a point located behind the player. I've been looking for something very simular to what you have posted and am very excited to see someone already working on a simular idea.

As for the addon working in an instance with wotlk, blizzard added instance maps for all wotlk instances, since the world coordinate system is determined by the world map in all woltk instances you can make an addon that can get player position information in any of the instances that came with wotlk and then throw your addon on top of that and BAM you got a nice little advantage to raiding. An addon like yours Cargor would be easier to use as most boss encounters that i can think of are on flat terrian or have very little rise in terrian.

Personally if you continue to advance your addon you have some major potential in its use with or without Z coordinates.

And yes, Shimmering Flats is great for testing an addon like this lol.
  Reply With Quote
11-25-09, 04:17 PM   #16
mankeluvsit
An Onyxian Warder
 
mankeluvsit's Avatar
Join Date: Sep 2008
Posts: 354
:O

WALLHACKXZZZ



i hella want it
  Reply With Quote
11-26-09, 08:58 AM   #17
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Originally Posted by athonus View Post
As for the addon working in an instance with wotlk, blizzard added instance maps for all wotlk instances, since the world coordinate system is determined by the world map in all woltk instances you can make an addon that can get player position information in any of the instances that came with wotlk and then throw your addon on top of that and BAM you got a nice little advantage to raiding. An addon like yours Cargor would be easier to use as most boss encounters that i can think of are on flat terrian or have very little rise in terrian.
Ah yes! Forgot about the instance maps :O
This should make things a lot easier.

Originally Posted by athonus View Post
Personally if you continue to advance your addon you have some major potential in its use with or without Z coordinates.
For the release, my aim is to finish my flag and quest objectives modules (city npc locations is actually another addon of mine) and provide an API, so that other addons can provide support for the overlays, similar like TomTom did. I may also include an API for registering different styles for the overlays and the possibility to draw lines in 3d space.
This should be sufficient that someone can use this as a basis for a raiding addon.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
11-28-09, 05:39 PM   #18
athonus
A Murloc Raider
Join Date: Nov 2009
Posts: 7
Awsome, really looking forward to your addon. Can't wait for it to be released.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Addon Request - draw to world raiding addon


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