ID:1449883
 
How do you handle variable speed in pixel movement without it feeling slow? Step size?
step_size is the only thing you can adjust for speed. In pixel movement, move delays are out of the question.
I did experiment with both and agreed. But I didn't like setting a standard step size for pixel because what if you didn't want to move so far? There has to be a way to let the player control their movement. I might just scrap the idea for speed, causing me to rewrite a few skills :X
In response to Lugia319
You can use a movement loop and have acceleration/inertia-based movement. Basically, holding a key down speeds you up gradually to your max speed in that direction. It's how most games do it. You'll need velocity variables and move by those instead of step_size, while step_size can just serve as your max speed. It's a step up from constant speed movement, basic 2D physics.
Something else useful when working with pixel movement is "sub-pixel" movement; i.e. tracking floating-point positions. I've found it can help a lot, especially with diagonal movement. Mobs tended to move a lot more fluidly when I added that in, as opposed to a chunky, "skipping" movement speed.
I use sub-pixel movement too and I would say that's how most games do it. Let me show you:

var speed = 10
var fx = 0
var fy = 0
var rotation = 0

proc/stepforcoolpeople()
fx += sin(rotation)*speed
fy += cos(rotation)*speed

proc/move()
while(fx >= 1)
fx--
step() // too lazy to type directions
while(fx <= -1)
fx++
step()
while(fy >= 1)
fy--
step()
while(fy <= -1)
fy++
step()


You will also need move() proc to be called every tick for each mob.

If you're new to this it may look too hard but once you understand you'll see it's a beautiful code.

var explanation:
speed - distance (in pixels) moved in a single step
rotation - angle of direction
fx, fy - floats representing sub-pixel position (notice that when they are greater than 1 (resp. < -1) visual step happens)

If you don't want constant speed and use things like acceleration and max speed instead here's little expansion:

var max_speed = 10
var acceleration = 1

proc/accelerate()
speed += acceleration
if(speed > max_speed) speed = max_speed

proc/decelerate()
speed -= acceleration/2
if(speed < 0) speed = 0


I hope this is helpful and not misleading. If you have any questions feel free to ask and I will try to help.
Yeah, I already figured it out. I use acceleration myself, with each movement adding a tick to a counter that determines how large of a step you'd take.
How did one alter speed before pixel movements step_size?
In response to Raruno
do you mean this?
proc/alter_speed_and_step_size()
speed = 16 // speed altered before step_size lol
step_size = 4

speed var has nothing to do with step_size. If you are using pixel_movement you probably want to set step_size to 1, but you can also set it to greater values.
I'm not sure I understand what are you asking so could you be more specific?
He's asking what you did before pixel movement became native.
Before pixel movement came in, people would create delays, preventing the player from moving for X ticks after they moved, then letting them move again.
Wasn't there some fake pixel movement experimentation before pixel movement?
There were plenty of soft-coded pixel movement implementations before native.

My shootah and Sword Fight uses my own.

IainPeregrine's Casual Quest uses his own.

Forum_account's A Miner Adventure uses his own. His Pixel Movement and Sidescroller libraries were released before native. They were updated to use native after it did come out, but I think A Miner Adventure is still using the pre-native system.

They work perfectly fine. They didn't have the fast collision detection that native has, but lag issues with the movement system itself haven't really come up.

edit: I still have hubs for my old pixel-movement-based test projects. These are the ones that still have working downloads. I don't have the source to any of these anymore.

http://www.byond.com/games/Kaiochao/shootah
http://www.byond.com/games/Kaiochao/PlatformerWar
http://www.byond.com/games/Kaiochao/uberSniper
http://www.byond.com/games/Kaiochao/WMBaSG