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

Author Topic: Fraps slows application way down?  (Read 3852 times)

0 Members and 1 Guest are viewing this topic.

freetheworld

  • Newbie
  • *
  • Posts: 4
    • View Profile
Fraps slows application way down?
« on: July 04, 2012, 11:50:32 pm »
I use the free version of fraps to do my video recording of projects but ever since I switched to sfml, I haven't been able to use it cause it messes with sfml::clock somehow.

This slowdown is only noticed when I'm actually recording, keeping fraps in the background as a fps counter doesnt effect anything.

Not recording my framtimes average 0.0003 seconds.
with recording my frametimes average 0.003 seconds.

That's a 10% jump all of a sudden and is enough to bring my game to a snails pace on anything that updates based on frame time. Which all my movements are.

no one else seems to have brought this up, or im just that bad at using search and google. Id post my code but it's quite alot. but here are basic specs im using

sfml 2.0
compiled in release mode (dur, I know but everyone always asks)
dynamic libraries
windows 7
radeon 5850 (11.12 catalyst try'd the newest 12.4 and still the same effect)
no vsync

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11053
    • View Profile
    • development blog
    • Email
Re: Fraps slows application way down?
« Reply #1 on: July 05, 2012, 12:17:18 am »
I'm not sure how often you've used FRAPS, but a drop in FPS is an expected reaction to running FRAPS or similar software, because now your application isn't just rendering stuff to the screen, but FRAPS is also grabbing the rendered image, 'compressing' it with its codec and writing it to the harddisk. Of course this happens in a seperate thread but it still needs some time to grab the image from your application thus reducing the time between two frames.

With 0.0003s per frame, we're talking about ~3333fps, which is quite a lot and any so small changes like a capture of a rendered image can change that dramatically. Also SFML isn't layed out for such high FPS, because it's actually not needed in any cases and it's just a waste on your CPU/GPU power. I advice to use setFramerateLimit(60) to give the CPU and GPU some break.

Conclusion there's nothing wrong with sf::Clock and an FPS drop is an expected result when using capture software.

If you're interested in how FRAPS and similar software work I can recommend this article.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

freetheworld

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Fraps slows application way down?
« Reply #2 on: July 05, 2012, 02:46:12 am »
god I feel so dumb.... mixed two timers together. Was using a timer I set up just to test an idea for one piece of code and the frame timer for the rest... Was sampling the first time almost immediately so it wasn't taking into account the delay (sleep()) that sfml was calling.

Still there should be nothing breaking in letting a game run as fast as it can.... even if I get 3K frames that is still within the limits of a 32 bit signed float representing seconds.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11053
    • View Profile
    • development blog
    • Email
Re: Fraps slows application way down?
« Reply #3 on: July 05, 2012, 03:51:06 am »
Still there should be nothing breaking in letting a game run as fast as it can.... even if I get 3K frames that is still within the limits of a 32 bit signed float representing seconds.

Nothing will break when running with high framerates, that's not what I said or you stated. ;)
If you get some strange behaviour with your movment up on a big fps change, then it's not the problem of SFML, it's a problem of your code. ;)

If I understand it right is what you're doing is reseting the clock and taking this delta over one frame as move speed. This is one possibility, but there are also others:
  • Fixed timestep (as suggested in this often linked article)
  • To calculate the framerate over a longer timespan, like 1s or 0.5s.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

freetheworld

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Fraps slows application way down?
« Reply #4 on: July 05, 2012, 05:10:11 am »
Yes I use one sf::Clock that gets reset at the end of each frame (game loop), before which i record the time it took to finish that frame. I use that time in the next frame to calculate changes. I do use separate timers for somethings though, things such as updating the path finding for ai really only needs to be done every so often.

I'm not going to bother with fixed time steps, especially when it seems like sfml already has that built in with setFrameRateLimit or maybe I miss read how that bit works.

Either way there is no reason to limit the usage of cpu/gpu on a desktop GAME as a whole, if a game wants to eat up gig's of ram, let it. If it wants to swamp an 8ghz cpu, let it. Aslong as the game runs as intended, there's no reason to purposely bottleneck your game.

Before I get pounded for that, realize I said DESKTOP GAME, not app, not phone app. I totally understand if it's a phone/tablet/pda app, cause you dont want to drain the battery just playing your game for 5 minutes.

Sui

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://www.suisoft.co.uk/
Re: Fraps slows application way down?
« Reply #5 on: July 05, 2012, 02:52:34 pm »
I have been using FRAPS to capture videos of my game. I am using vertical sync (60 fps) in the game and 30 fps capture in FRAPS.

I have found the best settings for capturing videos without slowdown for YouTube and the like, is to set the screen resolution to 720p (1280x720 resolution). That way the videos are already in a standard YouTube friendly resolution.

Running the game at 1680x1050 with FRAPS tends to kill performance.

Another thing I found using Sony Vegas (for video authoring) is that the frame rate should be set to 30  instead of 29.97. At 29.97 rendering, frames are blending together resulting in ghosting. I suspect this may be the same in other packages.
Gary Marples, Developer of games and other stuff.
www.suisoft.co.uk/games/BlogTwitter

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11053
    • View Profile
    • development blog
    • Email
Re: Fraps slows application way down?
« Reply #6 on: July 05, 2012, 03:20:32 pm »
Either way there is no reason to limit the usage of cpu/gpu on a desktop GAME as a whole, if a game wants to eat up gig's of ram, let it. If it wants to swamp an 8ghz cpu, let it. Aslong as the game runs as intended, there's no reason to purposely bottleneck your game.

Before I get pounded for that, realize I said DESKTOP GAME, not app, not phone app. I totally understand if it's a phone/tablet/pda app, cause you dont want to drain the battery just playing your game for 5 minutes.

I seems you've never done or read anything on old computer hardware, where every MB or even KB counted and you've had to tweak everything to work with the most clock cylces; in those days every single resource usage counted. I'm not saying that we have to life up to the old days and optimize like crazy, but it's still one of the good practices, one which many developers, even the ones from the big companies, fail to see: Reducing the memory footprint and lowering the CPU/GPU usage.

Just because you can, doesn't mean you should. And with reducing the CPU/GPU usage you're also reducing the power usage, which effects your power bill and indirectly you'd do something good for the enviroment, not that I would care that much, but you can't say there's no reason. ;-)

I have been using FRAPS to capture videos of my game [...]
Can you capture Starfire without problems? I'm using PlayClaw and I only get a black screen... :-/
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sui

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://www.suisoft.co.uk/
Re: Fraps slows application way down?
« Reply #7 on: July 05, 2012, 03:35:16 pm »
Can you capture Starfire without problems? I'm using PlayClaw and I only get a black screen... :-/

FRAPS works fine on both of my games (both OpenGL).

There is a free version you could try out. It just watermarks the videos.
Gary Marples, Developer of games and other stuff.
www.suisoft.co.uk/games/BlogTwitter