Staredit Network > Forums > SC2 Assistance > Topic: WASD Control without lag?
WASD Control without lag?
Aug 2 2010, 9:52 pm
By: Devourer  

Aug 2 2010, 9:52 pm Devourer Post #1

Hello

Not sure whether I have already asked this, but is there a way to create a WASD movement without lag? I've seen stuff like that on other maps but did not figure out how exactly it worked. Help!



Please report errors in the Staredit.Network forum.

Aug 2 2010, 10:00 pm Ahli Post #2

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

I think it uses periodic events and no use of a fixed camera behind a unit (camera updates = huge lag).
{But maybe the camera lags can be disabled by disabling the replay recording... I don't know, just a guess}




Aug 2 2010, 10:02 pm Centreri Post #3

Relatively ancient and inactive

You don't use triggers to set the direction of the unit - you use them to order a unit to move at an angle. Setting direction at very short intervals can 'lag' the unit in question and it'll move jerkily and eventually stop and jerkily rotate.

So, no 'make unit face x'. Just 'order unit to move to x'. On a related note, ESDF > WASD and my Mech Combat map might be a nice example for some things. http://www.staredit.net/topic/10916/ . I have basic controls, physics, etc and a lot of it is commented and the rest mostly understandable.

If this isn't what you mean, elaborate. What's lagging? What triggers are you doing? Etc.

Post has been edited 1 time(s), last time on Aug 2 2010, 10:15 pm by Centreri.



None.

Aug 2 2010, 10:29 pm Devourer Post #4

Hello

I never used a camera, it's top down view.
W to move, A and D to turn (S to move backwards).

Event: key is pressed
if: pressed key == "W"
-> Make Point face angle == facing of unit, make the same point offset by 1 or 2 (doesn't really matter), order unit to that point.

For A and D I would simply make the same but subtract like 10-15 degrees (or add) to the point's facing to make it more left... get it?
I made a slightly different system before, completly with ordering the unit (no degrees subtracting) and it lagged as the FPS seems to be slowed.


Actually, a better question: does a wait block of 1 game second in that trigger avoid the lag?
Keep in mind that the keys are pressed DOWN so not a "was pressed" event.



Please report errors in the Staredit.Network forum.

Aug 2 2010, 10:33 pm Centreri Post #5

Relatively ancient and inactive

Err...

The best way to make sure you're doing the pressing right is to make a variable for each key. When one presses down on that key, that variable is true; when one presses up, it's false. When that variable is true, you execute the whatever.

If you have that already, also try this:
Set refresh time to .05 seconds
The make point face angle looks right but sounds odd. I believe it's something closer to "Order unit to move to 'position of unit offset by two towards (direction unit is facing)"
Turning would then be "Order unit to move to 'position of unit offset by two towards (direction unit is facing +- 10)"
I don't exactly remember how I handled both of those simultaneously; Actually, I think I had the E (forward) simply increase acceleration, and the acceleration would increase/decrease unit movement speed.



None.

Aug 2 2010, 10:37 pm Devourer Post #6

Hello

I also tried that key pressed = change variable as the only action. Did not work either, though I noticed that I could do this and this might work:
Event: key pressed
actions: do actions, disable current trigger, wait 1 second, enable current trigger
This will ensure to run this trigger only once every second which drastically should decrease the lag :)



Please report errors in the Staredit.Network forum.

Aug 2 2010, 10:40 pm Centreri Post #7

Relatively ancient and inactive

... What do you mean did not work? The variables would be set?

No, you're really screwing up something, or you have a VERY bad computer. I had a .05 interval for physics calculations for slope, for variable resets, etc. A ton of stuff. For main mech, for multiple shots... There WAS some possible slowdown, but not obvious enough that I went to whine about it here. What you're doing here is so much less intensive than what I did that I really doubt that there's an actual 'happening too often' problem.



None.

Aug 2 2010, 11:07 pm Syphon Post #8



Instead of using key detection triggers, which lag, use unit hotkeys, which don't.



None.

Aug 2 2010, 11:11 pm Devourer Post #9

Hello

That sucks as players can also use Grid Hotkeys which ignored map's hotkeys.
Cent, would mind creating a test map for me? ;( (and attach it)



Please report errors in the Staredit.Network forum.

Aug 3 2010, 12:29 am Centreri Post #10

Relatively ancient and inactive

I mind, as I currently do not have an editor. I do, however, have MECH COMBAT, linked above in my first post here, which successfully accomplishes key-based movement. I have the only complicated part commented, for chrissakes. Take a look, because you're not describing what you're doing here well enough for me to magically solve your problem. The trigger that handles this, I believe, is called 'Periodic'. I stuck pretty much everything in there.

Post has been edited 2 time(s), last time on Aug 3 2010, 12:46 am by Centreri.



None.

Aug 4 2010, 1:53 am Syphon Post #11



Quote from Devourer
That sucks as players can also use Grid Hotkeys which ignored map's hotkeys.
Cent, would mind creating a test map for me? ;( (and attach it)

...Just make the data-hotkeys for movement's layout correspond to grid layout. You're trying to use wasd anyways.

Code
---------------------
|   |   | w |   |   |
---------------------
|   | a | s | d |   |
---------------------
|   |   |   |   |   |
---------------------




None.

Aug 4 2010, 3:10 am Centreri Post #12

Relatively ancient and inactive

Again, WASD sucks. ESDF is the way to go. WASD has QERFZXC near it; ESDF has WAZXCVGRQT near it. If you're going for multiple other abilities or want to expand on it later, go ESDF.

Seriously, the caps lock can get in the way with WASD. <_<



None.

Aug 4 2010, 3:36 am Syphon Post #13



Quote from Centreri
Again, WASD sucks. ESDF is the way to go. WASD has QERFZXC near it; ESDF has WAZXCVGRQT near it. If you're going for multiple other abilities or want to expand on it later, go ESDF.

Seriously, the caps lock can get in the way with WASD. <_<

You can still use esdf with what I posted! (I actually messed up and put wasd in the spot of esdf. :P)



None.

Aug 6 2010, 5:16 pm shmeeps Post #14



Quote from Syphon
Instead of using key detection triggers, which lag, use unit hotkeys, which don't.
Could you elaborate on this a little bit? I searched around but only found this post:

Quote from Syphon
To everyone making complaints about keys not going quick enough:

1) Edit the command card of you custom unit to have custom abilities with whatever hotkeys you want. Yes, you can use ANY keys, including the arrows, and mouse clicks.

2) There, you can now read keyboard controls at regular StarCraft latency.
Would that imply that just changing the hotkeys to the key that you want to detect, and leaving the trigger event as "Player presses x down" would remove the lag? Would you have to use the "Detect Button" instead of "Detect Key"? Or would you have to create a trigger looking for the actual ability being cast, and do the movement actions with regards to those?



None.

Aug 6 2010, 6:06 pm Centreri Post #15

Relatively ancient and inactive

The latter. Make them abilities, detect when they're cast.



None.

Aug 6 2010, 6:28 pm Devourer Post #16

Hello

Quote from Syphon
Quote from Devourer
That sucks as players can also use Grid Hotkeys which ignored map's hotkeys.
Cent, would mind creating a test map for me? ;( (and attach it)

...Just make the data-hotkeys for movement's layout correspond to grid layout. You're trying to use wasd anyways.

Code
---------------------
|   |   | w |   |   |
---------------------
|   | a | s | d |   |
---------------------
|   |   |   |   |   |
---------------------

There is a right grid as well, it would be like YUIOP and so on for them.



Please report errors in the Staredit.Network forum.

Aug 6 2010, 7:27 pm shmeeps Post #17



Quote from Centreri
The latter. Make them abilities, detect when they're cast.
How would one go about detecting a key-up with this? I assume a key-down would be to detect if the ability is either being casted or in queue.



None.

Aug 6 2010, 8:38 pm Centreri Post #18

Relatively ancient and inactive

Yeah, no key-up. But I don't think you should worry; I didn't notice any significant delay or lag when doing it the 'key down' trigger way.



None.

Aug 6 2010, 9:32 pm shmeeps Post #19



Quote from Centreri
Yeah, no key-up. But I don't think you should worry; I didn't notice any significant delay or lag when doing it the 'key down' trigger way.
Well the reason I'm curious is when you start to support multiple players it really does start to get noticeable. I created a test map with 8 players that are handled this way, just to see what kind of performance I could get. With two human players and six computer players (no AI, mind you, but they were technically present in the game) the lag would end up somewhere between .5 - 1.5 seconds (roughly) or more. There's is none with only one player though (untested on battle.net).

I've been looking into alternatives for this, this one seems viable. I was thinking perhaps it'd be possible to work with dummy behaviors to see which state of movement would be active (up, down, left, right), but i haven't seem to been able to come up with a method to detect key-ups in the same fashion.



None.

Aug 6 2010, 10:00 pm Centreri Post #20

Relatively ancient and inactive

Really? Hrrm. That's fairly retarded. When it's faster to take a roundabout path like making dummy abilities just to detect button presses..

Lols.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:53 am]
Ultraviolet -- :lol:
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
Please log in to shout.


Members Online: NudeRaider