Special thanks to onetwo for his idea and tutorial. Thanks to progammer for doing the footwork and testing on his crap computer.
Cons, read this before deciding to use
Performance is inversely correlated to precision. From 100 to even 10000 of invisible unit will be placed on the map for measuring mouse position. ( My computer and the video above use 1.0 precision scale)
When too much unit is on the screen at the same time, some model/particle will not appears (typically about 0.5 precision scale and default camera zoom)
Since mouse tracking is using unit is highlighted events, any big unit (command center, thor) will block and reduce the precision. Either make those unit unselectable/untargetable or scrap the idea.
In order to target correctly with other unit on the field, make sure all target unit has the flag Unhighlightable Off either by trigger or bulk data editing
There seems to be a cap on how many unit can be on the field at the same time. Need confirm. (not applicable)
Promote sc2mapster in your map if you used this system (ok not really a con but just put it here for now )
Pros
Enable sweet AOE icon for spell not using traditional UI
Enable Diablo click and point movement system
Enable more possibilities regarding problems that need real time mouse position
Notes
I will need feedbacks from anyone tried it on
better computer
on battlenet
256x256 map
with both normal and even extreme precision (as extreme as your computer can handle)
Feedbacks below this thread
Another note: This is not a tutorial to do the first video. The map to download only contain simple example trigger on how to implement the second video. Here are the instructions to use this library to get mouse position at real-time by 1 functions that return a point
How to use this library
Open any map of your choice, with whatever terrain and size, follow these 3 steps
Step 1: Open Data Edtior, Unit Tab
Create a new Unit named Coordination Unit (or any name of your choice) with Type: Generic Unit, based on Default Setting (Unit)
Basically you dont have to do anything with this unit, just note it name down.
Note: If you want this system to track mouse position in the fog of war, do the following ( will cause extreme lag with high precision system. Use it at your own risk )
set UI- Fog Visiblity: Dimmed
Step 2: Open Data Edtior, Model Tab
Create a new Model named Invisible Model (or any name of your choice) with Type: Generic<</color>> , based on CModel
set Model:Assets\Units\Test\HitTestSphere\HitTestSphere.m3
note down the Model ID, as circled red above, as a case sensitive string (not applicable since v1.2)
Open ShapeCube (Unnamed)
set Shadow Radius: 0.0
You are done with the data editor, everything else will be handled by the library
Step 3: Using the library
Open the downloadable map, you will see these trigger:
Copy them over to your map, then follow the instruction on the documentation comments, or follow instruction below
This is using unit on the field to track, you dont even attempt to know how its done. The UI is weird with all the different resolution and anchor so: No.
does this method also work when the mouse moves behind dialog windows? (so the mouse cursor can be changed when it is over a dialog (with buttons on it)
does this method also work when the mouse moves behind dialog windows?
(so the mouse cursor can be changed when it is over a dialog (with
buttons on it)
guess it can. You have to lock camera, put it in 90 degree position. Also differen screen resolution will yeild different field of camera view so you have to build UI for the smallest 3:4
I'm only asking this because I want to change the mouse icon depending on the dialog button that is clicked, like in dragging something from location X to location Y :P
It's not very clear to me in the videos, Are clicks required to detect the position? or is the hover position returned immediately when my mouse hovers over it?
I'm actually working on a mouse tracking system too, but with a distinct method from this one. Unfortunately it's not working out too well right at the moment. I was reluctant to code a tracking system via this method due to concerns that it would perform poorly with lower end pc specs due to the large number of dummy units required, but thats just me.
Either ways, good job getting this asset up and running. I'm sure it'll be a useful tool for many modders. If all else fails in my attempt, at least I know theres somewhere to fall back to.
You think progammer would have made such a ragtag system if there was something like trackables?
Dear Jesus I'd kill a newborn for good trackables support!
Yea, riiight. RtSC is a mod to Wc3, not a simple map. So first of all you'd need an emulated private battlenet server to actually be able to use such a modified Sc2.
Let alone you need a good team for that. Not everyone can tinker such a thing together, you know?
I never tested this system or mine on bnet... but (supposedly) it won't lag except for mouse detection. Since most of the movement is based around unit highlighted event, your guy will be very responsive. However the mouse down and mouse up events have to be tracked in mine so yeah...
Somewhere to go in the future: (someone made this post in my thread, maybe possible?)
Instead of filling the whole map with dummy units do this..... 1. Create a dummy type unit like you already have.
2. makes it collision size alot smaller, like .2 or .3. 10 times smaller than a marines collision
3. Make a ring of 15-20 dummy units around your mouse cursor (or a unit directly under the mouse cursor for initialization) but make sure you calculate how many dummy units you need to make such that there is no gaps in the ring. rememeber circle geometry from high school, lol.
4. whenever your mouse cursor moves out of the ring, it will highlignt one of the dummy units.
5. immediatley move the dummy ring units so that they make a ring around the unit that was highlighted and set the MousePosition variable to the highlighted unit. (before you move it to its new spot obviously) this will serve as mouse movement detection and require no grid of dummy units.
Updates v1.2 :
- Used a square unit instead of circular. (more precise)
- Step 2 modified, no need to make new model, change Shadow Radius of ShapeCube to 0.0
- Model Name parameter removed. It is now the cube.
Updates v1.1 :
Spawning units only at camera position and move them when camera moves. Guaranteed to reduce lag and available for even 256x256 map
Changelog: v1.1
Great thanks to Onetwo for his idea and explanation video leading to this improved system
http://forums.sc2mapster.com/resources/tutorials/11010-video-diablo-camera-movement/
AOE model for spell not using traditional UI
Diablo Movement System for unit (what you will actually find in the library map)
Asset page for map download:
(v1.2)
http://www.sc2mapster.com/assets/realtime-mouse-tracking-system/
Special thanks to onetwo for his idea and tutorial. Thanks to progammer for doing the footwork and testing on his crap computer.
Cons, read this before deciding to use
There seems to be a cap on how many unit can be on the field at the same time. Need confirm.(not applicable)Pros
Notes
I will need feedbacks from anyone tried it on
256x256 mapFeedbacks below this thread
Another note: This is not a tutorial to do the first video. The map to download only contain simple example trigger on how to implement the second video. Here are the instructions to use this library to get mouse position at real-time by 1 functions that return a point
How to use this library
Open any map of your choice, with whatever terrain and size, follow these 3 steps
Step 1: Open Data Edtior, Unit Tab
Basically you dont have to do anything with this unit, just note it name down.
Note: If you want this system to track mouse position in the fog of war, do the following ( will cause extreme lag with high precision system. Use it at your own risk )
Step 2: Open Data Edtior, Model Tab
Create a new Model named Invisible Model (or any name of your choice) with Type: Generic<</color>> , based on CModelset Model:Assets\Units\Test\HitTestSphere\HitTestSphere.m3note down the Model ID, as circled red above, as a case sensitive string(not applicable since v1.2)You are done with the data editor, everything else will be handled by the library
Step 3: Using the library
Function listing:
Initiate Coordination System(Unit Type, Model Name, Player, Radius, Precision Scale, Debug Mode On)
Model Name: Enter the dummy Model ID as a case sensitive string
( not applicable since v1.2 )(How to choose a preset)
GetMouseWorldPosition(Player)
Clean Up Coordination System()
Note for localization issue: If you does not see the trigger name due to localization, use those above screenshot to rename them.
I'm definitely going to have to check this out... I was trying to figure out a way to do this back in April, haha.
@Sixen: Go
So, Progammer, Could we use this to track position on Screen and display tooltips, Like we wanted to do before but couldn`t?
@EternalWraith: Go
This is using unit on the field to track, you dont even attempt to know how its done. The UI is weird with all the different resolution and anchor so: No.
@progammer: Go
Well excuse me then. It was just a question, It was also to bump this thread..
in wc3 there are trackables :/
nothing such here?
@progammer: Go
does this method also work when the mouse moves behind dialog windows? (so the mouse cursor can be changed when it is over a dialog (with buttons on it)
yea it does but not on not visible points :/
guess it can. You have to lock camera, put it in 90 degree position. Also differen screen resolution will yeild different field of camera view so you have to build UI for the smallest 3:4
@progammer: Go
I'm only asking this because I want to change the mouse icon depending on the dialog button that is clicked, like in dragging something from location X to location Y :P
It's not very clear to me in the videos, Are clicks required to detect the position? or is the hover position returned immediately when my mouse hovers over it?
I'm actually working on a mouse tracking system too, but with a distinct method from this one. Unfortunately it's not working out too well right at the moment. I was reluctant to code a tracking system via this method due to concerns that it would perform poorly with lower end pc specs due to the large number of dummy units required, but thats just me.
Either ways, good job getting this asset up and running. I'm sure it'll be a useful tool for many modders. If all else fails in my attempt, at least I know theres somewhere to fall back to.
Have you tested this in multiplayer? It's a good proof of concept but I'm curious if the performance is tolerable online.
This would be awesome if the units could follow a player's viewpoint, instead of spawning on the whole map.
@ubermikeleet: Go
this will make it much more laggy
creating removeing units takes a lot of memory idk why (thats the reason why you should recicle units not creating/removing units)
also will i get a answer to my question?
and i also think it's time that someone does Rt(S)C
http://www.wc3c.net/showthread.php?t=109255
You think progammer would have made such a ragtag system if there was something like trackables?
Dear Jesus I'd kill a newborn for good trackables support!
I second this.
Yea, riiight. RtSC is a mod to Wc3, not a simple map. So first of all you'd need an emulated private battlenet server to actually be able to use such a modified Sc2.
Let alone you need a good team for that. Not everyone can tinker such a thing together, you know?
@s3rius: Go
i know making a tool/mod like RtC isn't easy but may someone can do it (even for single player) because it helped me on wc3 a lot ()
but why blizzard did it in wc3 but not in sc2? (trackables)
overall i miss some functions/natives form wc3
I never tested this system or mine on bnet... but (supposedly) it won't lag except for mouse detection. Since most of the movement is based around unit highlighted event, your guy will be very responsive. However the mouse down and mouse up events have to be tracked in mine so yeah...
Somewhere to go in the future: (someone made this post in my thread, maybe possible?)
Instead of filling the whole map with dummy units do this..... 1. Create a dummy type unit like you already have.
2. makes it collision size alot smaller, like .2 or .3. 10 times smaller than a marines collision
3. Make a ring of 15-20 dummy units around your mouse cursor (or a unit directly under the mouse cursor for initialization) but make sure you calculate how many dummy units you need to make such that there is no gaps in the ring. rememeber circle geometry from high school, lol.
4. whenever your mouse cursor moves out of the ring, it will highlignt one of the dummy units.
5. immediatley move the dummy ring units so that they make a ring around the unit that was highlighted and set the MousePosition variable to the highlighted unit. (before you move it to its new spot obviously) this will serve as mouse movement detection and require no grid of dummy units.
Does not work on a 256x256 map, it only fills about 10 colums full of units. Same thing if you use a building.
What exactly did you get ? trigger timeout or an unit cap ? Try with lower precision ?