Staredit Network > Forums > SC2 Assistance > Topic: [Solved] Tracking mouse
[Solved] Tracking mouse
This topic is locked. You can no longer write replies here.
Aug 21 2010, 2:38 am
By: payne  

Aug 21 2010, 2:38 am payne Post #1

:payne:

Remember that small SC1 EUD-concept map which was contained within 20x12? It was about stopping waves of enemies running from left to right by passing your mouse over them, no click required or anything.
I was wondering if we could get the same kind of effect on SC2.



None.

Aug 22 2010, 11:20 pm payne Post #2

:payne:

Bump. D:



None.

Aug 22 2010, 11:55 pm Temp Post #3



I don't think anyone has made any progress in doing this, since it is not immediately apparent how we could accomplish this with triggers.



None.

Aug 23 2010, 12:36 am shmeeps Post #4



Well, I think the main problem is again the difference between GUI coordinates and real world coordinates of the mouse position.

The mouse actually moves along a 2D XY plane, which we see as the Graphical User Interface (GUI), which is the mouse, the command cards, the minimap, etc. This is how we control the mouse.

In any 3D RTS game (Or any game with units selectable by mouse, or highlighting people by mousing over them, or... well, you get the idea), the engine must convert between the 2D GUI coordinates of the mouse to the corresponding 3D real-world (in game) coordinates that the mouse is hovering over.

The most common way is ray tracing, as it is probably one of the simplest methods that is also quite efficient. Without going into too much detail, imagine taking a perfectly straight line from the focal point of the camera, running it through the mouse's position, and making it keep going until it hits some object in the game. The first thing that it hits will be the unit selected. If it doesn't hit anything, it wont do anything.

The problem is, even though that ray tracing is quick, running it during every game cycle can become expensive and can lag game play if the engine was not built with this in mind. (A lot of people say, but how do they do this in FPS games, which is actually completely in 3D, so it doesn't actually have to be used quite the same).

Now, SC2 seems to have a relatively quick engine, and I think that it would be very possible using custom scripts, since the mouse position is inheritly tracked (or else it wouldn't work). The problem is finding out how SC2 tracks it, and how we can access that data, or if we can find a way to keep track of it our selves. The second problem is piggy backing on the built-in ray tracing algorithm to get the results we need. Or writing a new one.

TL, DR: I don't see how it is possible with triggers, may be possible with custom scripts, once some progress is made towards understanding them.



None.

Sep 1 2010, 4:59 pm payne Post #5

:payne:

http://forums.sc2mapster.com/resources/tutorials/9857-simulated-structure-placement/#p8
See post #1 if you want a good explanation.

Basically, it's all about using the "Mouse lock" feature, since it locks the mouse at the middle of the screen, thus letting you know it's position ;)

Tag this thread as solved.



None.

Sep 2 2010, 12:34 am Temp Post #6



That is hardly a good solution to tracking mouse movement and has very limited application.



None.

Sep 15 2010, 6:27 am payne Post #7

:payne:

http://www.sc2mapster.com/assets/realtime-mouse-tracking-system/

I had this in mind since the start... to use invisible units to detect the click, but it wouldn't have been very efficient. Well this guy used 'Highlight' instead, which makes much more sense. :P



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:02 pm]
Zoan -- of course it isn't full understanding. You could ask "is the mechanism by which this counterexample blows up the ONLY mechanism possible for an initial configuration to blow up?"
[05:48 pm]
Zoan -- ppl do it all the time in PDEs
[05:47 pm]
Zoan -- Heinermann
Heinermann shouted: it also didn't solve that problem but hey as long as the investors are pleased
Constructing a counterexample is answering the question: "Is Navier Stokes well posed?" in the negative
[05:44 pm]
NudeRaider -- I only heard about it, didn't any news article, so what did it do then?
[05:43 pm]
Heinermann -- it also didn't solve that problem but hey as long as the investors are pleased
[05:39 pm]
NudeRaider -- I have no idea tbh. All I know no human was ever able to solve it, but there's at least a few that beat portal ;)
[05:32 pm]
Zoan -- Navier Stokes is not that esoteric I thought
[04:32 pm]
NudeRaider -- Zoan
Zoan shouted: I find it kind of sad that on the same day it was announced AI solved Navier Stokes, it was also announced AI beat Portal, and there's a good deal of people who don't know which is more impressive
you find it sad not everyone is a math nerd?
[03:25 pm]
NudeRaider -- (and yes, I capitalized that correctly :ego:)
[03:24 pm]
NudeRaider -- Symmetry
Symmetry shouted: Hi not I'm dad
Hi dad, I'm nude
Please log in to shout.


Members Online: Vrael, Nuralldin, Moose