Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Does anyone else have massive frame drops for no reason?  (Read 4059 times)

0 Members and 1 Guest are viewing this topic.

MrSnappingTurtle

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Does anyone else have massive frame drops for no reason?
« on: August 10, 2014, 02:14:23 am »
EDIT: So I just realized the way that I was calculating FPS was wrong :u However, I still get stutter even with the high framerates. I am using deltaTime, does anyone know what could be causing this?

Hi,

I am working on a game and am having an issue with my framerate dropping massively for no reason. And I'm not talking about just any framerate drop, I mean it will constantly go from 2000+ to 20 for a frame.This happens when something is happening or when nothing is happening at all. I'm pretty sure this is what is causing issues with jittery movement when using delta time, as well. Has anyone else had this issue?

Thanks!
« Last Edit: August 10, 2014, 03:55:12 am by MrSnappingTurtle »

Bloob

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Does anyone else have massive frame drops for no reason?
« Reply #1 on: August 10, 2014, 02:35:24 am »
On my old laptop i would get massive framerate drops after an hour of use. Could it be your computer? Have you seen it in other games or applications?

MrSnappingTurtle

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: Does anyone else have massive frame drops for no reason?
« Reply #2 on: August 10, 2014, 02:36:59 am »
No, I'm sure it's not my computer as it's pretty high end. I don't get this in other games.

Mörkö

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: Does anyone else have massive frame drops for no reason?
« Reply #3 on: August 10, 2014, 02:37:41 am »
Quote
Does anyone else have massive frame drops for no reason?
Nope.

Every frame rate drop and performance problem I've had definitely had a reason.

The most common reason is that I coded a bug into my program by mistake because I'm a noob programmer.

Although once I noted a frame rate drop in a program that was running fine earlier, and I hadn't really changed any code that would cause it so I was pretty confused. I profiled my program to try to find the issue, but everything seemed to be within normal parameters. Then I realized I had like 10 virtual desktops open, all of them running various other programs like browser, file manager, pdf reader, music player, torrent program etc. So when I closed some of the programs / desktops my SFML program was back to a clean 60 fps again.

But definitely never frame rate drop for no reason.

Strikerklm96

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: Does anyone else have massive frame drops for no reason?
« Reply #4 on: August 10, 2014, 06:37:08 am »
2000+ FPS?
You should limit the frame rate to 60 to see if that helps:
sf::RenderWindow::setFramerateLimit(int limit)
« Last Edit: August 10, 2014, 06:38:43 am by Strikerklm96 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
AW: Does anyone else have massive frame drops for no reason?
« Reply #5 on: August 10, 2014, 09:32:28 pm »
Framerates can jump for various reasons. Assuming that it will always be steady is a wrong assumption and as such depending on delta time alone won't guarantee you a smooth movement. Instead the suggested solution is mostly to implement fixed time step for your logic.

Given your edit, I assume there are no huge frame drops anymore, right?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MrSnappingTurtle

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: AW: Does anyone else have massive frame drops for no reason?
« Reply #6 on: August 10, 2014, 09:41:49 pm »
Given your edit, I assume there are no huge frame drops anymore, right?

Yea, I turned on FRAPS to see if maybe I just failed at my calculations for the FPS and it seems like I did. The framerate seems to stay steady now.

Instead the suggested solution is mostly to implement fixed time step for your logic.

What features should use fixed timesteps? I currently have movement and collision
detection/resolving on deltaTime. I will not have physics. The only thing I do have on fixed time are animations. If you need me to paste code, just ask. Thanks!

EDIT: Sorry, collision doesn't use deltaTime, but it updates every frame is what I meant to say.
« Last Edit: August 10, 2014, 09:48:56 pm by MrSnappingTurtle »

MrSnappingTurtle

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: Does anyone else have massive frame drops for no reason?
« Reply #7 on: August 10, 2014, 09:43:50 pm »
2000+ FPS?
You should limit the frame rate to 60 to see if that helps:
sf::RenderWindow::setFramerateLimit(int limit)

It seems to help but at the same time it seems to not help. I have it vsync at both 120Hz and 144Hz (120Hz is when I use lightboost to remove motion blur completely to make sure that I wasn't just ghosting).

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: AW: Does anyone else have massive frame drops for no reason?
« Reply #8 on: August 10, 2014, 10:04:37 pm »
What features should use fixed timesteps?

tl;dr All "game logic" could potentially benefit from it.  That includes anything which updates the internal state of the game, such as positions, velocities, health/damage, inventories, AI routines, etc.

The few things that should always be done once per frame include rendering (ie, actually calling clear()/draw(everything)/display()) and basic event processing (ie, calling pollEvent() and translating it to, say, an "up" command; actually moving the player up would be game logic).
« Last Edit: August 10, 2014, 10:07:42 pm by Ixrec »

Strikerklm96

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
    • Email
Re: Does anyone else have massive frame drops for no reason?
« Reply #9 on: August 10, 2014, 10:11:14 pm »
motion blur
Could you PM me about how to add motion blur?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Does anyone else have massive frame drops for no reason?
« Reply #10 on: August 10, 2014, 10:18:15 pm »

MrSnappingTurtle

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: Does anyone else have massive frame drops for no reason?
« Reply #11 on: August 10, 2014, 11:40:08 pm »
motion blur
Could you PM me about how to add motion blur?
I didn't add motion blur? I said that I made it so that my monitor has minimal motion blur/ghosting.