I was wondering if there are any better programmers on here who could talk about a better way to do unit movement.
Right now I've been working on a racing game in the galaxy editor and it is playable, but I am disappointed in the way it looks when a unit moves. I am using WASD controls, where W accelerates and A and D rotate the unit. Now, I know a lot of people like to issue a small step move order to control movement, but my game has drifting in it. Often, the vehicle is accelerating in one direction and moving in another.
In order to do this, I use "Move unit instantly X units and Y units," but this looks sort of choppy at speeds that aren't even that high, and the built in "Blend" doesn't seem to do much.
So I was wondering if anyone knew or could think of a better way to move the units at the same speed but not jump so choppy-ish?
I tried tinkering with higher triggering (currently triggers every 0.05 seconds), but that didn't help much.
Sorry for writing so much. I was hoping to be specific enough so that someone might actually be able to help. This is a problem that has plagued me across more than just programming in sc2.
EDIT: I don't necessarily need exact triggering. Just theory/ideas.
Hey. Firstly, 0.0625 seconds is the shortest interval you can have, anything below that only gets rounded up.
I experienced a similar issue a while ago. I eventually fixed it by rotating the unit before moving it. I'm just guessing that you might have it the other way around (you move the unit and then rotate it).
Nope, I stand by my earlier statement until clear evidence is presented! I was unable to produce a shorter interval than 1/16s. Please explain your view on this.
Pardon for going off-topic, was the OP's issue resolved?
Well, I checked anyway and I do rotation before movement, but it shouldn't matter because the unit moves freely based on two variables movespeed_x and movespeed_y. So like it moves based on "instantly move" to new position current_x + movespeed_x.... basically using vectors to control movement so the angle of the camera and the direction the unit is facing has nothing to do with the movement.
I completely created this on my own, not using anyone's WASD tutorial pack stuff if that is where the confusion arose.
Here's an idea I had, not sure if it will work better:
Let's suppose the unit is at position x and is moving at a speed of movespeed_x in the positive x direction.
Normally I would use a timed trigger (like I said 0.05 but maybe I'll switch to 0.0) and do something like instantly move unit to ( x + movespeed_x) but this looks choppy if lets say the units moves 5 units. So I was thinking of using a loop to move the unit to x + 1 repeatedly until the position is equal to x + movespeed_x. In other words instead of leaping 5 units, it would leap one unit five times, but I'm not sure this will work as I believe.
What do you think of this? Or am I not being clear enough?
It's not that complicated really. I can't use move orders though because then I couldn't have the vehicles drift around turns pretty realistically as they do now.
EDIT: I resolved this on my own. It ends up I was doing some funky camera work that I fixed now and everything looks better.
[Resolved]
Hello,
I was wondering if there are any better programmers on here who could talk about a better way to do unit movement.
Right now I've been working on a racing game in the galaxy editor and it is playable, but I am disappointed in the way it looks when a unit moves. I am using WASD controls, where W accelerates and A and D rotate the unit. Now, I know a lot of people like to issue a small step move order to control movement, but my game has drifting in it. Often, the vehicle is accelerating in one direction and moving in another.
In order to do this, I use "Move unit instantly X units and Y units," but this looks sort of choppy at speeds that aren't even that high, and the built in "Blend" doesn't seem to do much.
So I was wondering if anyone knew or could think of a better way to move the units at the same speed but not jump so choppy-ish?
I tried tinkering with higher triggering (currently triggers every 0.05 seconds), but that didn't help much.
Sorry for writing so much. I was hoping to be specific enough so that someone might actually be able to help. This is a problem that has plagued me across more than just programming in sc2.
EDIT: I don't necessarily need exact triggering. Just theory/ideas.
Hey. Firstly, 0.0625 seconds is the shortest interval you can have, anything below that only gets rounded up.
I experienced a similar issue a while ago. I eventually fixed it by rotating the unit before moving it. I'm just guessing that you might have it the other way around (you move the unit and then rotate it).
@Qancakes: Go
Actually the smallest interval you can set is 1/32 seconds by setting the time to 0.0, anything larger than 0.0 will be rounded up to 1/16s
@progammer: Go
Whoa wait what?! :o *rushes off to test this*
I sincerely hope that I'm mistaken in my earlier statement!
Nope, I stand by my earlier statement until clear evidence is presented! I was unable to produce a shorter interval than 1/16s. Please explain your view on this.
Pardon for going off-topic, was the OP's issue resolved?
Well, I checked anyway and I do rotation before movement, but it shouldn't matter because the unit moves freely based on two variables movespeed_x and movespeed_y. So like it moves based on "instantly move" to new position current_x + movespeed_x.... basically using vectors to control movement so the angle of the camera and the direction the unit is facing has nothing to do with the movement.
I completely created this on my own, not using anyone's WASD tutorial pack stuff if that is where the confusion arose.
Here's an idea I had, not sure if it will work better:
Let's suppose the unit is at position x and is moving at a speed of movespeed_x in the positive x direction.
Normally I would use a timed trigger (like I said 0.05 but maybe I'll switch to 0.0) and do something like instantly move unit to ( x + movespeed_x) but this looks choppy if lets say the units moves 5 units. So I was thinking of using a loop to move the unit to x + 1 repeatedly until the position is equal to x + movespeed_x. In other words instead of leaping 5 units, it would leap one unit five times, but I'm not sure this will work as I believe.
What do you think of this? Or am I not being clear enough?
It sounds like you're making it a tad too complicated, the blend thingy has always made it look smooth for me. I'm at a loss of ideas now. :(
@Qancakes: Go
It's not that complicated really. I can't use move orders though because then I couldn't have the vehicles drift around turns pretty realistically as they do now.
EDIT: I resolved this on my own. It ends up I was doing some funky camera work that I fixed now and everything looks better.