• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Mouse camera system with WASD

Status
Not open for further replies.
Level 10
Joined
May 8, 2009
Messages
253
Hi everyone, I have been looking for a mouse camera system with WASD controls and this one is simply fantastic.
Although the map is protected so I can't study the triggers.
Do some on you have any idea how such beautiful work has been done? Any tutorial link?
I'd love to implement a system like this in a RPG map!

Download link:
Download map "Duel of Magic by Brilock" [Other] | 1 different versions available | Warcraft 3: Reforged - Map database

Youtube link:



EDIT:
Actually I have found a demo map made by Brilock! Thanks to him and enjoy!
 

Attachments

  • 3Dcamera.w3x
    39.1 KB · Views: 151
Last edited:
Level 4
Joined
Jun 28, 2010
Messages
38
=|

Half of me is kind of angry I am just now finding this after I spent a good week making a retro camera system. That being said I looked through this and tried to understand it and failed, narrowed it down to just the CAMERA trigger as all the other triggers and even the Unit variable can be deleted without any change to the camera system.
I can understand the mouse up and down methods and the camerasetter method but I have no clue why there are an additional 8 camerasetter methods, 12 camerafast methods, and 16 camerafaster methods.

Then there's the UI Frame arrays names but, butRam and butThird and don't even get me started on the created triggers named mouse, maus and missis... I mean he put like a total of 3 comments in there that explained nothing, and his variable names leave much to be desired. I need someone smarter than me to explain this system @_@


-- my upload is my WIP system I was working on
-edit Whoops I didn't fix the sliders in my map. Now it all works.
 

Attachments

  • WIP-CamSystem.w3m
    394 KB · Views: 77
Last edited:
Level 10
Joined
May 8, 2009
Messages
253
I've been working with it for a while so I now understand how it works, I can help you with what I found.
First for the variables, as he's coding in jass, he declares (creates) the variable in his script, so the one you see can be deleted as it is redundant.
The camera setters are there to detect the mouse movement.
In a nutshell, he created invisible frames in the middle of the screen, and whenever the mouse hovers one of these frames, it will trigger one of these camerasetter and move the mouse back in the middle of the screen
Each camerasetter tweaks the parameters of the camera and are applied in the main trigger 'cameraSetter'.
with that, the camera is controlled by your mouse.
Now some are called 'fast' because they detect a fast movement of your mouse, to do that, he placed some frames further away from the middle of the screen and these are reachable only if you quickly swipe your mouse in one direction

Is it making any sense?
 
Level 4
Joined
Jun 28, 2010
Messages
38
So he created a lot of invisible frames and its measuring the distance/speed the mouse is traveling between said frames?
 
Level 10
Joined
May 8, 2009
Messages
253
No it's simpler than this:
imagine the middle of the screen surrouned by 4 frames:
upload_2021-3-8_21-51-43.png

When the mouse hovers frame 1, it's going to fire the trigger related to that frame, move the mouse back in the middle of the screen and change the angle of the camera so it's tilted a little upwards
 
Level 4
Joined
Jun 28, 2010
Messages
38
There a way to have his frameWheel but, butRam and butThird frames to show ingame? I tried a call BlzFrameSetVisible on them but nothing @_@.
 
Level 4
Joined
Jun 28, 2010
Messages
38
I was able to convert every bit of that jass into GUI except for the registering of mouse events and the creation of the frames. It all works just like the original bar the code that he had that would not allow you to move your camera if you had a unit hovered. I was going to clean up his dumb variable names as well but I'm tired and might do it a week from now. Here however is the result for use.

-edit See this is why I dislike using other peoples Jass, fucking spaghetti code. Did you know he has useless variables? Some that are declared that aren't used, some that are used that should be deleted. For instance is you change every instance of TekDist to Dist and then delete this block

Code:
        if (H<0 and TekDist-50 > 0  ) then
            set TekDist = TekDist - 50
        elseif (TekDist<Dist and H>30) then
            set TekDist = TekDist + 50
        elseif (TekDist>Dist) then
            set TekDist = TekDist-50
        endif

Everything works flawlessly. He made more work for no reason? Its like he was testing and writing and when it all worked he was like, "Yep I'm done here."
 

Attachments

  • 3DCam-Breakdown.w3x
    48 KB · Views: 79
Last edited:
Level 4
Joined
Jun 28, 2010
Messages
38
Ah, yep can't speak Russian so useless to me. Also the final version of my tinkering of his triggers attached to my map are here. It includes a WASD movement system and scalable up to 24 players with no additional code required. He... did a lot of useless calculations trying and failing to resolve a terrain height problem that is inherit in his camera. Luckily I actually already solved that problem in my map so I deleted that portion of my code and applied my fix. If you are wondering why when you go up a cliff (not raised terrain actual blizzard cliff) the camera height does not automatically adjust it is because while you do need math you only need a simple bit of it.

Take the Z Position of the unit add 256 and divide it by 1000. Then add that amount to your camera height. I figured it out a while ago so I'm fuzzy on the why. Something about how every cliff level is another 256? Then divide that to get a usable amount to increase the camera to.


-edit I made an error with q and e but fixed it, also no longer hiding the game ui
 

Attachments

  • WIP-CamSystem.w3m
    433.2 KB · Views: 98
Last edited:
Level 4
Joined
Jun 28, 2010
Messages
38
Oof, looking back at that shitty logic I uploaded. I rewrote EVERYTHING to be cleaner and solved a shit ton of issues such as when pressing multiple keys to move it forgetting that you were holding down the keys, not being able to right click friendlies, enemies or items, moving and camera usage. Its almost all finished and will work exactly like your run of the mill MMORPG. I just have to fix two logic problems and add back in the mouse scroll to control camera distance. I have another thread its all in WASD Movement Works but i have a Problem
 
Status
Not open for further replies.
Top