Download

Character movement lag when game runs on 60+ fps (singleplayer game)

Hi all!

I released my game Emberheart in Steam Early Access yesterday. I’ve had reports from players that movement is laggy. And after focussing on it I see it as well. The world around the character seems to lag and the characters movement jumps sometimes.

The game runs at 60 fps in most maps (still working on optimizing this). So it’s strange that I experience laggy movement.

I thought it had to do with default UE4 motion blur settings. But I tried disabling motion blur all together with no noticeable change. Only when I bump up the motion blur value to 1 instead of the default 0.5 I notice that the motion blur gets more powerful and thus worse.

Am I doing something wrong with disabling motion blur? What could possibly cause jittery movement?

Watch my trailer to see exactly what I mean by laggy movement.

I tried:

  • changing or adding post process volume and enabling motion blur value and set it to 0.
  • Add a post process component to player character class and also enable motion blur value and set it to 0.
  • Disable motion blur in project settings
  • Disable motion blur in camera.
  • tried all 4 options at the same time.
  • tried disabling the Smooth framerate option in project settings
  • Tried setting smooth framerate enabled and set its range to between 0 and 200.
  • tried the range with smooth framerate disabled
  • tried minimum desirable framerate on 30 and on 60

It’s a topdown project. So I checked my movement code, and it doesnt use delta time, so smoothing framerate by using delta time is also not the problem.

What else can I try?

Thanks in advance!

“It doesn’t use delta time.”

This is most likely your issue. When your framerate fluctuates, the game ticks your movement logic faster or slower, effectively causing the movement to be faster or slower than you desire. If this happens a lot on a user’s machine, it will appear to be laggy or skippy. Using deltatime, the movement velocities will always be multiplied by a number that keeps your movement roughly consistent regardless of framerate. For example, at target framerate of 60 deltatime would effectively (not actually, but effectively) be returning a value of 1.0. If your framerate drops to 30fps, deltatime returns 2.0. If it jumps to 120fps, deltatime returns 0.5. So no matter what the FPS value is, you will always be moving at the same rate.

Ok thank you. I’ll look into the movement code again and see how I can add delta time. I remember at some point like 3-4 years ago I use a tick gate to make the character move. So I could possibly pass on a delta time to it

Player movement should be on every tick, generally, to keep it as smooth as possible. Some lag appearance problems might stem from your animations, but I’m not sure if that’s what your youtube comments were referring to. Regardless of what you do, make sure to try your best to record the game trailer at the highest quality you can. Good luck!

Ok guys I fixed my problem to an extend. i made movement on tick using delta seconds, that worked. but im still getting lag tbh. For the other people who have the same problem. I made movement with topdown point and click work with tick and delta seconds like in the screenshots below. The problem I had was that the character only moved as long as you hold the mouse button down and stopped emmediately when releasing mouse button while its supposed to keep running to the clicked location when you release mouse button.

I solved it by making a KeepRunning Boolean that gets set to true when mouse is pressed. And set to false when mouse is not pressed and close the gate. But since the button released closes the gate, the code for keep running set to false didnt fire. I solved it by duplicating the inputaction SetDestination which is bound to LMB and pluggin that in past the gate on released. This makes sure the code fire one more time after gate is closed, using value from KeepRunning bool as false.


Hope this helps anyone.

That solved the movement with tick/delta time, But im still experiencing laggy movement. Any further ideas what might be causing this??