ID:1454634
 
(See the best response by Balborg.)
Code:
// Special Movement procs for variable speed //
ResetMove()
src.InertialD = null
src.StepCounter = 0
src.StepDelay = src.BaseStepDelay
src.StepsResetting = 0
return

DetectStep(DIR)
var/baseconstant = 0.5
if(src.InertialD != DIR)
src.InertialD = DIR
src.StepCounter = (1 / (baseconstant * src.Speed.Current)) ; src.StepDelay = src.BaseStepDelay
step(src, DIR, src.step_size * src.StepCounter)
spawn(0) src.StepReset()
return
src.StepCounter += (1 / (baseconstant * src.Speed.Current))
if(src.StepCounter < 1)
step(src, DIR, src.step_size * src.StepCounter)
else
step(src, DIR)
src.StepDelay = src.BaseStepDelay
if(!src.StepsResetting)
src.StepsResetting = 1
spawn(0) src.StepReset()
else return

StepReset()
while(src.StepDelay && src.StepsResetting)
sleep(1)
src.StepDelay --
src.StepCounter = 0 ; src.StepDelay = src.BaseStepDelay
src.StepsResetting = 0
// End Special Movement procs //


Problem description:
I keep coming across weird random skips. I did a few test procs to make sure StepDelay was being changed properly, and it is. I am testing it by pressing the up button on the keyboard for movement. This would call North() which called DetectStep(NORTH). I think it's StepReset() completing when it shouldn't be. There seems to be maybe some kind of call limit(?) to North, which makes it stop getting called which allows StepReset to complete.
Bump
Best response
You may want to specify the problem further. Also explaining what exactly does each procedure do, when it is called and maybe commenting would be helpful.
The problem is that the player will randomly stop even while you press the movement button without removing it.

InertialD is the direction you were last moving, when it changes, you start at step_size 0 again. StepsResetting is used to prevent the reset proc from being called several times, and stepcounter is used to determine how large of a step you take. ResetMove() is only called when you bump something.
if(!src.StepsResetting)
src.StepsResetting = 1
spawn(0) src.StepReset()
else return

StepReset()
while(src.StepDelay && src.StepsResetting)
sleep(1)
src.StepDelay --
src.StepCounter = 0 ; src.StepDelay = src.BaseStepDelay
src.StepsResetting = 0


I would see it coming from here as you will always call stepReset proc which then is sleeping for 1 millisecond causing the skip.

Edit:


I just read that you said that ResetMove is only called when you bump something. Do you have any invisible objs, or objs that the player is bumping, turf, or anything that is caling resetMove to be called?
Nope. I run the tests in wide open space.

Though I do have some new info. I went into my smaller test map that's 100x100 and there doesn't seem to be an issue. Is it a world fps (set to 40 atm) or a pixel movement that's causing the timer to run out? BaseStepDelay is at 8 ticks.
Do you have all the same objs, turfs, mobs, etc.... on the 100x100 map. Such as if you have wondering NPC's that are all calling the same thing?
These procs can only be called by client controlled mobs with the exception of ResetSteps()
So does ResetSteps() still call StepReset() for NPCS?
ResetSteps() doesn't call StepReset(). Are we reading the same code?
I looked at the wrong thing.


What if you try adding some of the objs or NPCS onto the map tho, does that have an effect?

It could just be the large map.

I have a 3 GHZ quad core and 6gb of ram, AMD 77000 HD and if my map goes over 200x200 even at 40FPS byond runs laggy.

This is just with one player Mobb and some ground turfs, but in Isometric.
Try disabling threads in your byond directory.
How do I disable threads?
add "threads off" to cfg/seeker.txt in your BYOND user data directory.
Still random stops.
What happens if you try and add some other mobs to your test map?
New mobs are added to the map every few paces due to a spawning proc. In the testing map (100x100x1) there are no issues. The not-testing-map is 500x500x7 which I made obnoxiously big because I wasn't sure how large I was gonna make the map and I wanted the elbow room just in case. I'm gonna shrink the map to see what happens.

EDIT: 300x300x5 still has it but with less frequency. I think this might just be a "map too big" issue.
what happens if you make the map 500x500x1?
Again, less frequency, but still present. Maybe I should reduce fps and increase step size.