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.
[02:53 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: I'll check it out this weekend!
Thanks
[02:47 am]
Symmetry -- I'll check it out this weekend!
[02:40 am]
Mr.BurnLiquid -- Symmetry
Symmetry shouted: Another map maker? Damn we really ARE back
I invite you to try out the map I modified. I don't have the creativity to create maps from scratch, but I do have the know-how to modify existing ones; my project is to tweak community campaigns (specifically those with errors—to make them playable.
[02:27 am]
Symmetry -- Another map maker? Damn we really ARE back
[01:51 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Now that I wanted to change my avatar, the error image is showing up, haha.
[01:34 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
I invite you to try out a mission I'm modifying from *StarCraft Reversed*; I'm trying to make it more playable and challenging.
[01:33 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: Mr.BurnLiquid actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
Thanks; I'm new to the site and a Spanish speaker. I must have missed the part where it was prohibited—I'll change it now.
[01:31 am]
Ultraviolet -- Mr.BurnLiquid
Mr.BurnLiquid shouted: Ultraviolet Is it forbidden to have a large avatar?
actually yeah though I wasn't really saying it to narc on you. It just caught me off guard because I don't usually see it (because it's against the rules) "The avatar may not be bigger than 150x150 pixels". Kinda silly that it relies on users to be well behaved rather than just limiting the dimensions on uploads :lol:
[12:20 am]
Mr.BurnLiquid -- Ultraviolet
Ultraviolet shouted: https://staredit.net/profile/133367/ dude's avatar is massive
Is it forbidden to have a large avatar?
[12:04 am]
Ultraviolet -- https://staredit.net/profile/133367/ dude's avatar is massive
Please log in to shout.


Members Online: O)FaRTy1billion[MM], Mr.BurnLiquid