Pointer tracking

Pointer tracking

Requests for features in the spring code.

Moderator: Moderators

User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Pointer tracking

Post 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).
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Pointer tracking

Post by MidKnight »

Lua-ing it is possible. Go do it, Caydr! :-)
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: Pointer tracking

Post by Caydr »

I'm too busy making boring lua to make awesome lua, why don't you do it?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Pointer tracking

Post 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:
Image
counts in which area of screen the mouse is, outputs to html
User avatar
srapop
Posts: 94
Joined: 02 Oct 2009, 16:55

Re: Pointer tracking

Post by srapop »

why not add it to the "Ally Cursors" widget by Jk and TheFatController?
or use existing code(if permitted?)
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: Pointer tracking

Post 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.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post 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.

Image
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post 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
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post by aegis »

screenshots:

Image

Image

and another game, with more concentrated mouse movements (didn't have two teammates who left this time):

Image
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post 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
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Pointer tracking

Post 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. ^^
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post 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 <_<
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Pointer tracking

Post 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))
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post by aegis »

oh right, lol. coding while tired. forgot to remove the translate after I fixed the vertex
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Pointer tracking

Post by Regret »

image
Last edited by Regret on 31 Jan 2010, 22:31, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Pointer tracking

Post by smoth »

Regret wrote:image
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Pointer tracking

Post by Regret »

good_job_gold_ribbon_T.png
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post by aegis »

DrawScreenEffects won't draw my lines and circles <_<
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Pointer tracking

Post 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
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Pointer tracking

Post by Peet »

That doesn't really reset gl line width or colour, just sets them to something different when you're done :P

Look into glPushAttrib().
Post Reply

Return to “Feature Requests”