Page 1 of 2
Pointer tracking
Posted: 21 Jan 2010, 21:04
by Caydr
Stupid, trivial request, would be pretty cool though IMHO:
http://www.flickr.com/photos/anatoliy_z ... 271592658/
He provides links to his program, and might be willing to lend us the source. It can't be all that difficult to code though. Heck, it could probably even be done in lua but I don't know if all the capabilities are there so I'm putting this in feature requests.
Basically, the game would optionally output an image which represents all of your mouse movement during the game, as one solid line. Clicks appear as small dots, while periods where the cursor doesn't move at all appear as increasingly large dots (this part would probably be unnecessary).
Re: Pointer tracking
Posted: 21 Jan 2010, 21:07
by MidKnight
Lua-ing it is possible. Go do it, Caydr!

Re: Pointer tracking
Posted: 21 Jan 2010, 21:20
by Caydr
I'm too busy making boring lua to make awesome lua, why don't you do it?
Re: Pointer tracking
Posted: 22 Jan 2010, 02:41
by knorke
I will try this tommorow to learn some lua maybe.
logic isnt too hard, just the suckyness of having to look up how everything works in lua (arrays, writing files etc)
already did something like this in c:

counts in which area of screen the mouse is, outputs to html
Re: Pointer tracking
Posted: 22 Jan 2010, 22:15
by srapop
why not add it to the "Ally Cursors" widget by Jk and TheFatController?
or use existing code(if permitted?)
Re: Pointer tracking
Posted: 31 Jan 2010, 02:13
by Caydr
IMHO adding mostly-unrelated features to widgets that are already working perfectly and polished isn't a good thing if it can be avoided.
But you gave me an idea though: since that data is available, what if you made another new widget which tracks cursor position for all allied players. Instead of just tracking movement within local screen space, you'd use the entire map and draw lines representing cursor movement as their player color. Maybe add a little guide in one corner that says what color is what.
Both of these ideas are basically just toys I guess but I think they'd be fun to see. And, for example, with some studying you'd probably be able to pretty much tell whether a player is high-level or not independent of what his rank is, without having to actually watch the whole replay. If possible track all players' cursor positions, not just allies... though I'm not sure if that's possible/exploitable.
Re: Pointer tracking
Posted: 31 Jan 2010, 12:52
by aegis
traces mouse position over map.
hold Z to darken map and display path (someone might suggest a better key or trigger mechanism)
it currently tracks resting position internally, but I still need to write code to display resting circles and code to display in the minimap.

Re: Pointer tracking
Posted: 31 Jan 2010, 14:21
by aegis
second version, draws circles where the mouse rested. no idea how terribly inefficient my opengl is.
I'm gonna play a game and upload a screenshot of my mouse movements.
edit: oops, has debug echo in it still, will remove when I upload screenshot from this game
Re: Pointer tracking
Posted: 31 Jan 2010, 14:55
by aegis
screenshots:
and another game, with more concentrated mouse movements (didn't have two teammates who left this time):

Re: Pointer tracking
Posted: 31 Jan 2010, 17:12
by aegis
I get a decent fps hit lategame when viewing, although my computer is fast enough it's not a problem... any tips on optimizing the opengl would be nice.
edit: I might make a script to generate this given any replay played with ally cursors
Re: Pointer tracking
Posted: 31 Jan 2010, 17:32
by jK
three issues (code-wise):
1. widgets aren't isolated objects neither is OpenGL, means reset all your changed GL states when you use non-default ones (here: glLineWidth & glColor)
2.
Code: Select all
local function DrawGroundFillCircle(v)
x, y, z, r = v[1], v[2], v[3], v[4]
glTranslate(x, y, z)
for a=0, 6.2831853, 0.1 do
glVertex(x + r*math.cos(a), y, z + r*math.sin(a))
end
end
local function DrawMouseStops(nodes)
for _, v in pairs(nodes) do
glBeginEnd(GL_POLYGON, DrawGroundFillCircle, v)
end
end
glTranslate can't be called in a glBegin ... glEnd context. Also GL_POLYGON is the slowest of all primitives.
3. Don't use ipairs at all and pairs only when needed -> use "for i=1,#array do ... end" as often as possible.
Also don't use table.insert/remove when not needed, use "array[#array+1] = newval".
PS: I forgot the default for the DrawWorld callin, but it's possible that you should disable DepthMask and Blending.
PPS: You should use DrawScreenEffects instead of DrawWorld. ^^
Re: Pointer tracking
Posted: 31 Jan 2010, 18:12
by aegis
how would you suggest I draw the circles? I need to draw a filled circle at (x, y, z, r), preferably inverting its color based on the circle color below it (so circles can overlap)
as for the glTranslate, it worked <_<
Re: Pointer tracking
Posted: 31 Jan 2010, 18:16
by jK
No, it doesn't work, you just don't check the glerror stack.
The reason why the circles are still rendered is cause you do:
glVertex(x + r*math.cos(a), y, z + r*math.sin(a))
Re: Pointer tracking
Posted: 31 Jan 2010, 18:56
by aegis
oh right, lol. coding while tired. forgot to remove the translate after I fixed the vertex
Re: Pointer tracking
Posted: 31 Jan 2010, 22:26
by Regret
image
Re: Pointer tracking
Posted: 31 Jan 2010, 22:27
by smoth
Re: Pointer tracking
Posted: 31 Jan 2010, 22:30
by Regret
good_job_gold_ribbon_T.png
Re: Pointer tracking
Posted: 31 Jan 2010, 23:20
by aegis
DrawScreenEffects won't draw my lines and circles <_<
Re: Pointer tracking
Posted: 31 Jan 2010, 23:52
by aegis
updates:
- reset glLineWidth and glColor after DrawWorld
- removed glTranslate
- changed GL_POLYGON to GL_TRIANGLE_FAN
- using more efficient table operations
- interface and map marks are hidden while Z is pressed
Re: Pointer tracking
Posted: 01 Feb 2010, 00:22
by Peet
That doesn't really reset gl line width or colour, just sets them to something different when you're done
Look into glPushAttrib().