ID:1954977
 
(See the best response by Kaiochao.)
Problem description:
I've been stuck on it for the past 2 days, and am not really sure how to fix it.. I've set a speed-mechanism to my game, based on step_size, but then, any Mob in the game other than the player's mob is just jumping around instead of moving like it has been up till then.. I've tried looking into gliding, tried changing the bounds of the mobs and I've tried using all sorts of different step sizes, all to no avail..
What's more, I even tried applying any proc & verb related to the pixel_step only to Players (by checking for a Player-type before applying any changes), and nothing changed.
Before that, I've noticed that even after deleting any proc I've added and un-doing any changes I've made before, the speed-changes still applied, somehow..
I really am unsure about the cause of this, and the only code I can think about posting here is the NPC's movement, which worked perfectly up until now..

Edit: To make things clearer, the mobs seem to be jumping/teleporting instead of actually moving in pixel-movement..

Thanks in advance for anyone willing to help,
I really can't seem to find the cause for it..

proc/Walkaround()
while(src)
var/Located = FALSE

for(var/mob/Player/P in oview(10))
step_towards(src,P)
Located = TRUE
break

if(Located != TRUE)
sleep(10)
sleep(5)
Pixel movement doesn't currently support built-in gliding. Smooth movement is achieved through a series of small, quick movements.
But what has caused the change? The movement was smooth before changing the step_size (there was no definition of a specific step_size before in my code, then it was probably equal to its default value until then), but even after I've removed the step_size definition, or changed it to only apply to player-type mobs, the change remained.. Any idea how to fix it?
If you want to return to gliding, things like step_size, and step_x/step_y can only be in multiples of world.icon_size.

There is no mixing of gliding/pixel movement now, unfortunately.
But the current world icon size is equal to 32, and even when I set it to 32, 16 or even 0, the mobs are still 'jumping' instead of gliding and moving smoothly..
Any way to fix that?
defining step* at all removes gliding.

You have to remove all of them.

Use glide_size instead
So how come the player's mob is moving smoothly?
Any other mob is jumping/telporting around instead of actually walking there (If I wish it to have a step_size of 32 pixels, every step will teleport the mob), Is there no way of letting the mobs actually move like they did before?
Even after changing all of the step definitions so they only apply to the player's mob, the problem persists.
Even if I set the mob's step_size to 1, they will teleport 1 step at a time instead of actually 'walking' there while showing the moving icon_state they possess..

Edit: Only now noticed your edit, how do I use glide_size? I've tried changing it to various values, and have seen no change at all..
So you're saying the player glides, but other mobs don't. Did you set animate_movement to zero for non players? What is the actual difference in their variables?
I didn't set animate_movement anywhere in the code, and what do you mean by the actual difference in their variables? Which variables? step_size? I've tried defining that one only for player mobs, then tried defining it as the same for both mobs, and I've even tried defining the movement speed for the mob in the step_towards proc itself, so it will not be affected by the other definitions.. None of it worked.
Any ideas why?

Edit: I've also tried using Ter13's code, given here:
http://www.byond.com/forum/?post=1573076
Which only resulted in over-riding my speed-mechanism while the rest of the mobs still move around by 'jumping' like they did earlier
In response to DOLEVBARON
Could you output these variables of your glidng player and of your non-gliding mobs:
* bounds
* step_size
* step_x
* step_y
* animate_movement
* glide_size
Animate Movement: 1 for both
step_size: 32 for the mobs, 8 for the player (doesn't change anything except for movement speed even if I set them both to the same value)
step_x = 8 for player, 0 for mobs
step_y = same as step_x ,both change as they move around
glide_size = 0 for both
bound_x & bound_y = 0 for both
In response to Matyy
If your player's step_size is 8, it's not a multiple of world.icon_size, and your (step_x, step_y) offset leaves you misaligned with the tile grid, so you're in pixel movement mode. Your player isn't gliding, it's just moving slower than the rest of your mobs.
Thanks for the reply, but..
Even if it's not gliding, it's moving smoothly, and the rest of the mobs aren't.. That's what I'm trying to fix, any idea how to do it?
Even if I set the player's step_size to 32, it's movement is still smooth, and even if I set the other mobs' step_size to 8, they will move at the same speed as the player, but instead of moving smoothly like they did before setting the step_size in the first place - They will jump by that amount each step (eg 8 pixels)

Bottom line - I want the mobs to behave the same way the player does, like they did earlier, any insight on how to do that? And again, thanks for trying to help (:
you have to remove every case where you define step_size to anything, even 32.

use glide_size instead.
In response to Matyy
Best response
They will jump by that amount each step (eg 8 pixels)

Your player is doing that too, you know, but much more frequently.

I finally took a look at your NPC walk loop, and it uses sleep(5). Where your player might move (world.fps) times per second, your AI are moving much less frequently. The solution here is to speed up your AI movement loop. Try sleeping by world.tick_lag instead of 5.
sleep world.tick_lag
Alright! That really seems to be the case, I was worried about lowering it up until now because I didn't want it to cause lags or take too large a toll on the server..
Isn't something like this going to cause lags or performance decrease? And again, Thanks! :)
In response to Matyy
Matyy wrote:
Alright! That really seems to be the case, I was worried about lowering it up until now because I didn't want it to cause lags or take too large a toll on the server..
Isn't something like this going to cause lags or performance decrease? And again, Thanks! :)
Yeah, but it's a sacrifice that should be made more often.

See my first reply in this thread.