Performance when debugging is laggy

Unlike the examples where is is nice and smooth when I run mine its all jittery and not smooth at all. All the code is the same and compiles without errors other than this unusual performance.

Although, when I open an application like MSI Afterburn to check FPS/system stats the program then begins to behave correctly and runs smoothly. Unsure what’s causing this?

Here’s an example showing the issue off with the code in the background. Hopefully the video properly conveys the issue I’m having. In the short term it’s fine as I have a work around but would like to solve this problem.

Try multiplying your values by Time.deltaTime
For example:

circle_x = circle_x + 10 * Time.deltaTime;

This should allow for smooth gameplay regardless of your frames per second

While that’s a good idea in general it doesn’t quite explain the behaviour. The important thing is the code isn’t exactly the issue.

As for what’s causing this? I’m not certain. Though doing a little bit of searching has given me some ideas.

  1. Update your GPU driver if you haven’t already
  2. Does the issue occur if you remove SetTargetFPS(60) ?
    2.a If so, try replacing it with SetWindowState(FLAG_VSYNC_HINT)

The problem seems to be a little random with GPU/CPU/Scheduler combinations with the GPU not necessarily being worked hard enough (weird, I know). Hopefully this helps!

Ah, I see , your response makes more sense then my time.deltatime stuff,lol

Tried all of these and unfortunately doesn’t work. It works much better when completely removing the SetTargetFPS line but still doesn’t work the same as when I have MSI Afterburner and the ball moves way too fast which was the purpose the the SetTargetFPS line. When adding the SetWindowState it goes back to the same issues as the FPS line.

Curious question, what GPU do you have and what is the refresh rate of your monitor?

@Christopher_Powell It also didn’t help that Raylib doesn’t access deltaTime that way.

I technically have 2 as it’s a laptop (Microsoft Surface Book). I have a iGPU the Intel HD Graphics 530. Then an Nvidia GPU which is basically a 940m. Both have latest drivers installed. And the screen is a 60hz panel 3000x2000.

It might just be a laptop issue as it is a fairly unique laptop with the detachable screen but don’t really see why that would affect it tbh. Currently away from my desktop setup so can’t see if I get the same results there but will try when I get back to my desktop.

When it comes to laptops, I’ll point out that by default Raylib will default to the iGPU. But do let us know how it goes on the desktop!

Well I finished rewriting the code on my desktop and it’s working perfectly. Must be an issue with the laptop.

I’m unsure if it’s because of the uniqueness of the laptop causing issues or the specs. The laptop is only a i5 6600u (2c, 4t), 8GB RAM with iGPU and a relatively weak Nvidia GPU where as my PC is a high end rig with a 5950x, 32GB RAM and a RTX Titan.

But with MSI afterburner open the application running shows 600fps with 20% iGPU usage so I don’t think it’s that. I’ll just have to deal with MSI Afterburner being open when debugging to get the actual performance. Weird how it works but at least it still allows me to study away from my desktop.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms