SampleProvider / Meadow-Guarder-old2

A free browser RPG game.
http://meadowguarder.herokuapp.com/
Other
16 stars 7 forks source link

Screen jitters occasionally when you move diagonally with base movespeed #295

Closed spsquared closed 2 years ago

spsquared commented 2 years ago

If you unequip everything and move diagonally a lot, the screen jitters a little bit sometimes. It moves in a weird smoothed zigzag (probably because of interpolation) at about the server tickrate. This only happens with base movespeed. It could have to do with the new collisions with floating point error or some problem that causes it to not calculate diagonal movement consistently, since it alternates between moving horizontally more than vertically and vice versa. It also seems to happen more often when going upwards left than downwards right, possibly because of the negative speed values. Or it could possibly be that the client doesn't like the new collisions and is drawing it wierd.

Suvanth-Erranki commented 2 years ago

Perhaps you could record a video and make it unlisted to demonstrate your issue. I can't really replicate this.

SampleProvider commented 2 years ago

I kinda did it. I think this happens because the client side can only draw in whole pixel increments.

SampleProvider commented 2 years ago

You have to look at the walls and think that this happens to see it.

spsquared commented 2 years ago

It hurts my eyes when I see it.

SampleProvider commented 2 years ago

The code is written so that if you are moving diagonally, then abs(spdX) = abs(spdY).

SampleProvider commented 2 years ago

It's client side. This happens due to lag. If you press right and then holding right press down, this happens. The client runs it at 60fps, but server is 20fps. So when you have movespeed 10, this means every client frame the player has to move 3 and 1/3 pixels. As the client side rounds everything, this means you move 3px, 3px, 3px for 9 pixels, and this happens again. Server side you moved 20 pixels, while client side you moved 18. So now when you move another 10 pixels, client side does 4px, 4px, 4px. X movements and Y movements are not synced, so this happens.

SampleProvider commented 2 years ago

Fixing this would mean making x pos and y pos floats on client, which means more lag.

spsquared commented 2 years ago

Just sync the x and y movements. How come Mountain Guarder doesn't have this problem?

SampleProvider commented 2 years ago

How do I sync them?

SampleProvider commented 2 years ago

Just sync the x and y movements. How come Mountain Guarder doesn't have this problem?

Mountain guarder does have this problem.

SampleProvider commented 2 years ago

Fixed.