So we know the "key pressed" event is laggy. I suspect Blizzard might fix this in some way eventually, but still, I'd like to know.
Basically, is it more efficient to have one trigger with multiple "if then else" functions where each has a condition of "key pressed = W", "key pressed = A" etc, or 4 seperate triggers for each key?
Think about it. The triggers themselves are going to execute near-instantly. Regardless of whether you make 1 or 4 triggers, you still need 4 events, one for each key. Those events are what creates the overhead, not the triggers.
I cant list the triggers off the top of my head but you can DL and look at the triggers on my map if you want (just don't copy/paste)
I don't get any lag with WASD movement on it
Rollback Post to RevisionRollBack
"human beings make life so interesting. Do you know that in a universe so full of wonders, they have managed to create boredom?" -Death (Discworld)
I cant list the triggers off the top of my head but you can DL and look at the triggers on my map if you want (just don't copy/paste) I don't get any lag with WASD movement on it
I mean on bnet. I'm very, very happy with my movement system offline. I'm worried about the lag it'll create online. Sorry for the confusion!
Think about it. The triggers themselves are going to execute near-instantly. Regardless of whether you make 1 or 4 triggers, you still need 4 events, one for each key. Those events are what creates the overhead, not the triggers.
Makes sense. I feel a bit silly now for creating one monster trigger that does it all. Ah well, least it looks semi impressive.
Oh and while I'm here, rather than making a new thread.
Is there a way to change the default keybinds? I guess like most people, space bar moves their camera to "problem areas" like allies being under attack or your own structures. I also guess like most people, they use space bar to jump. Is there a way to prevent the camera movement associated with space bar?
My apologies for the triple post but they are all different subjects :(
I've do game programming and you can't really fix the current way they have it. The best things to note is as few if statements as possible. I figured that I could just use a custom Vector2 record (x and y) to keep track, then having 4 WASD triggers to capture movement, and 4 more to stop it. This also allows for more fluid movement if 2+ move-keys are pressed.
W Key Down
Events
UI - Player Any Player presses W key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Direction[(Triggering player)].Y <= Move Speed Pos
Actions
Variable - Set Direction[(Triggering player)].Y = Move Speed Pos
A Key Down
Events
UI - Player Any Player presses A key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Direction[(Triggering player)].X >= Move Speed Neg
Actions
Variable - Set Direction[(Triggering player)].X = Move Speed Neg
W Key Up
Events
UI - Player Any Player presses W key Up with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
Variable - Set Direction[(Triggering player)].Y = 0.0
Also guys, the events are nothing. What's bogging it down is actually issuing orders that fast.
for spacebar, the way I worked around it moving the camera is by making spacebar reset the camera (in case someone uses mouse scroll and messes it up) I'm new to triggers and stuff too so I'll look for something :)
Rollback Post to RevisionRollBack
"human beings make life so interesting. Do you know that in a universe so full of wonders, they have managed to create boredom?" -Death (Discworld)
Also guys, the events are nothing. What's bogging it down is actually issuing orders that fast.
Issuing orders is nothing. What's bogging it down (in BNET) is the key events. That's what Blizzard says, so that's pretty much the best answer we have right now.
And Peng! You have 2 events for all key presses. KeyPressed is a boolean array of a size of 100 (I think there's 99 keys that can be pressed).
The point is that the key press event seems to check EVERY key, no matter if you're checking for a specific one or checking for any key. Obviously it'll only trigger when the right key is hit, but it'll still check every key whether it's the right one. So adding all stuff into one event doesn't seem so bad.
However - at least in my experiences - it'll still have delay on BNet. I've had about 0.5 seconds when I tried it. We won't be able to do much about it though, as it's not us who're creating that delay, but Blizzard's code behind the scenes.
Yes, but orders trigger AI and path algorithms. I've tried just a simple "move unit instantly" and have gotten almost no lag at all in changing directions.
Yes, but orders trigger AI and path algorithms. I've tried just a simple "move unit instantly" and have gotten almost no lag at all in changing directions.
SC2 can handle 400 simultaneous movement orders without the slightest bit of lag. Path algorithms really aren't much to begin with, but since you'd move your unit just a tad with each order it's even less important (pathing = more intense the higher the distance is).
Both movement systems work perfectly, with minimal additional cpu load and absolutely no lag.
The only thing that lags is online play (and that depends on Blizzs servers).
PS: I use the Move Instantly method, too. But because of other reasons.
I used to use move isntantly w/blend, but blend doesn't appear to work right over bnet. It worked perfectly offline, but it turned into a slow, choppy mess on bnet. I ended up going back to issueing orders, but I left the move restrictions in (disallows moving into out of bounds area).
The consesus here appears to be just an unavoidable fact right now - we're relying on blizz to fix this. There's no other way around it from what I can tell.
I found a solution; it isn't perfect yet, but it shows potential: make some abilities that put a behavior on you that lasts 0.2 seconds and make their hotkeys be WASD. Periodically check for the behaviors and move unit accordingly. Smashing the key does result in the ability being spammed.
You may have to make this a toggleable ability with the same hotkey for the toggle-off and instead of looking for behaviours, listen for the ability being cast (both ways); this might speed up reaction time.
Off topic: nice that Blizzard showed us two maps at Blizzcon and lied about both because they cannot be used on b.net...
It's still early days. They wouldn't add mouselook and key support without ensuring their success. These things add too much potential for Blizzard to ignore, and making sure they work smoothly will add a lot to Starcraft as a whole.
Not to mention they are encouraging small time developers to use the starcraft engine to make entirely new games. They have a lot riding on this, I'm sure they will optimise it eventually.
It's still early days. They wouldn't add mouselook and key support without ensuring their success.
They wouldn't spend so much $$$ on a completely new Battle.net and then fuck it up, would they - oh wait, they actually DID.
Well, all in all WASD is somewhat playable (see the Waterworks FPS map). Although the delay makes it a little bit ugly. But I don't think anything will change soon. Maybe for Heart of the Swarm..
The number of triggers has zero bearing on lag. The only thing that matters (as far as WASD goes) is latency and there's nothing you can do about that as a mapmaker.
Online FPS maps are always going to be a gimmick as SC2 does not have client side prediction and that's basically a necessity for fast-twitch action games.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So we know the "key pressed" event is laggy. I suspect Blizzard might fix this in some way eventually, but still, I'd like to know.
Basically, is it more efficient to have one trigger with multiple "if then else" functions where each has a condition of "key pressed = W", "key pressed = A" etc, or 4 seperate triggers for each key?
@Eiviyn: Go
It's not going to matter. Whether one trigger, or 4 triggers are called, there are still the same number of events that have to be invoked.
So there's absolutely zero benefit to using one trigger over using four?
@Eiviyn: Go
Think about it. The triggers themselves are going to execute near-instantly. Regardless of whether you make 1 or 4 triggers, you still need 4 events, one for each key. Those events are what creates the overhead, not the triggers.
I cant list the triggers off the top of my head but you can DL and look at the triggers on my map if you want (just don't copy/paste) I don't get any lag with WASD movement on it
I mean on bnet. I'm very, very happy with my movement system offline. I'm worried about the lag it'll create online. Sorry for the confusion!
Makes sense. I feel a bit silly now for creating one monster trigger that does it all. Ah well, least it looks semi impressive.
Oh and while I'm here, rather than making a new thread.
Is there a way to change the default keybinds? I guess like most people, space bar moves their camera to "problem areas" like allies being under attack or your own structures. I also guess like most people, they use space bar to jump. Is there a way to prevent the camera movement associated with space bar?
My apologies for the triple post but they are all different subjects :(
I've do game programming and you can't really fix the current way they have it. The best things to note is as few if statements as possible. I figured that I could just use a custom Vector2 record (x and y) to keep track, then having 4 WASD triggers to capture movement, and 4 more to stop it. This also allows for more fluid movement if 2+ move-keys are pressed.
W Key Down
Events
UI - Player Any Player presses W key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Direction[(Triggering player)].Y <= Move Speed Pos
Actions
Variable - Set Direction[(Triggering player)].Y = Move Speed Pos
A Key Down
Events
UI - Player Any Player presses A key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Direction[(Triggering player)].X >= Move Speed Neg
Actions
Variable - Set Direction[(Triggering player)].X = Move Speed Neg
W Key Up
Events
UI - Player Any Player presses W key Up with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
Variable - Set Direction[(Triggering player)].Y = 0.0
Also guys, the events are nothing. What's bogging it down is actually issuing orders that fast.
for spacebar, the way I worked around it moving the camera is by making spacebar reset the camera (in case someone uses mouse scroll and messes it up) I'm new to triggers and stuff too so I'll look for something :)
Issuing orders is nothing. What's bogging it down (in BNET) is the key events. That's what Blizzard says, so that's pretty much the best answer we have right now.
You can reduce the number of events to one:
And Peng! You have 2 events for all key presses. KeyPressed is a boolean array of a size of 100 (I think there's 99 keys that can be pressed).
The point is that the key press event seems to check EVERY key, no matter if you're checking for a specific one or checking for any key. Obviously it'll only trigger when the right key is hit, but it'll still check every key whether it's the right one. So adding all stuff into one event doesn't seem so bad.
However - at least in my experiences - it'll still have delay on BNet. I've had about 0.5 seconds when I tried it. We won't be able to do much about it though, as it's not us who're creating that delay, but Blizzard's code behind the scenes.
I would wait for Blizz to fix this.
In any case I would set the event to a Boolean Array. Like WASD[0] (Left) WASD[1] (Right). That would be a little more efficient.
@s3rius: Go
Yes, but orders trigger AI and path algorithms. I've tried just a simple "move unit instantly" and have gotten almost no lag at all in changing directions.
SC2 can handle 400 simultaneous movement orders without the slightest bit of lag. Path algorithms really aren't much to begin with, but since you'd move your unit just a tad with each order it's even less important (pathing = more intense the higher the distance is).
Both movement systems work perfectly, with minimal additional cpu load and absolutely no lag.
The only thing that lags is online play (and that depends on Blizzs servers).
PS: I use the Move Instantly method, too. But because of other reasons.
@s3rius: Go
I used to use move isntantly w/blend, but blend doesn't appear to work right over bnet. It worked perfectly offline, but it turned into a slow, choppy mess on bnet. I ended up going back to issueing orders, but I left the move restrictions in (disallows moving into out of bounds area).
The consesus here appears to be just an unavoidable fact right now - we're relying on blizz to fix this. There's no other way around it from what I can tell.
I found a solution; it isn't perfect yet, but it shows potential: make some abilities that put a behavior on you that lasts 0.2 seconds and make their hotkeys be WASD. Periodically check for the behaviors and move unit accordingly. Smashing the key does result in the ability being spammed.
You may have to make this a toggleable ability with the same hotkey for the toggle-off and instead of looking for behaviours, listen for the ability being cast (both ways); this might speed up reaction time.
Off topic: nice that Blizzard showed us two maps at Blizzcon and lied about both because they cannot be used on b.net...
It's still early days. They wouldn't add mouselook and key support without ensuring their success. These things add too much potential for Blizzard to ignore, and making sure they work smoothly will add a lot to Starcraft as a whole.
Not to mention they are encouraging small time developers to use the starcraft engine to make entirely new games. They have a lot riding on this, I'm sure they will optimise it eventually.
Their horrible custom map interface convinced me that they don't care. Sorry.
They wouldn't spend so much $$$ on a completely new Battle.net and then fuck it up, would they - oh wait, they actually DID.
Well, all in all WASD is somewhat playable (see the Waterworks FPS map). Although the delay makes it a little bit ugly. But I don't think anything will change soon. Maybe for Heart of the Swarm..
The number of triggers has zero bearing on lag. The only thing that matters (as far as WASD goes) is latency and there's nothing you can do about that as a mapmaker.
Online FPS maps are always going to be a gimmick as SC2 does not have client side prediction and that's basically a necessity for fast-twitch action games.