# Formular for calculating movement speed

5 replies__1__

17.09.19 08:19:34 pm

Hi there!

I just want to know how to calculate a player current movement speed?

All I know is that there a value called "speedmod" which is set on 0 by default.

And on top of that we add in weapon weight to get the value

But what is the true speed in term of pixel? I did some test but the result doesn't seem to be consistent.

Also, I want to know the true minimum speed.

It seem the speedmod limit is [-100,100] but when player get to a certain point before -100, they kind of stop moving.

I just want to know how to calculate a player current movement speed?

All I know is that there a value called "speedmod" which is set on 0 by default.

And on top of that we add in weapon weight to get the value

But what is the true speed in term of pixel? I did some test but the result doesn't seem to be consistent.

Also, I want to know the true minimum speed.

It seem the speedmod limit is [-100,100] but when player get to a certain point before -100, they kind of stop moving.

I'm pretty sure that I posted this at least once in the forum already... I can't find the post though

Does anyone know where I posted it? I don't want to write it again

In general you're right:

and base speed can be two different values (running or walking)

Does anyone know where I posted it? I don't want to write it again

In general you're right:

base speed + weapon modifier + speedmod

and base speed can be two different values (running or walking)

I mean I found this

http://wiki-en.unrealsoftware.de/index.php/Pixels/Frame

but it was last updated some 3 years ago.

http://wiki-en.unrealsoftware.de/index.php/Pixels/Frame

but it was last updated some 3 years ago.

Ah, perfect! Thank you!

That's what I posted in the forum somewhere. It's old but still true.

Only change is of course the frame rate from 50 to 60 FPS. But there's an unmentioned frame time based factor which makes the movement speed the same no matter what the FPS are (factor is higher with low FPS and lower with high FPS). So the values and the sample calculation should still be right.

That's what I posted in the forum somewhere. It's old but still true.

Only change is of course the frame rate from 50 to 60 FPS. But there's an unmentioned frame time based factor which makes the movement speed the same no matter what the FPS are (factor is higher with low FPS and lower with high FPS). So the values and the sample calculation should still be right.

Also to calculate the speed you would need to halt a player with any weapon is to calculate the speed for the weapon with the highest weapon speed modifier (in this case, the knife and wrench).

(There's also a 1.2 multiplier)

so our formula would be:

or

2+0.75 = 2.75

and multiply 2.75 and s/10 by 1.2:

which is

1.2/10 = 0.12

s × 0.12 = 3.3

s = 3.3/0.12 = 27.5

And there we have it. -27.5 (-28 because -27.5 will be truncated to -27) is the true minimum speed to stop with all weapons.

**Short answer: -27.5 (or -28, because decimals get truncated) to make a player halt with any weapon.****b:**base speed = 2.0**w:**weapon modifier = 0.75 (for knife and wrench)**s:**speedmod = this is our unknown, is also divided by 10(There's also a 1.2 multiplier)

so our formula would be:

**(b + w + s/10) × 1.2 = 0**or

**(2 + 0.75 + s/10) × 1.2 = 0**2+0.75 = 2.75

and multiply 2.75 and s/10 by 1.2:

**3,3 + (s × 1.2)/10 = 0**which is

**(s × 1.2) / 10 = 3.3**1.2/10 = 0.12

s × 0.12 = 3.3

s = 3.3/0.12 = 27.5

And there we have it. -27.5 (-28 because -27.5 will be truncated to -27) is the true minimum speed to stop with all weapons.

edited 1×, last 17.09.19 10:51:03 pm

Thanks guy! I appreciated it.

I'm trying to make a progression system and part of it is to modify speed and display it on the screen.

Now I can try to implement it into a HUD now.

I'm trying to make a progression system and part of it is to modify speed and display it on the screen.

Now I can try to implement it into a HUD now.

__1__