aliens

Author Topic: Fps counter patch  (Read 8617 times)

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Fps counter patch
« on: October 30, 2010, 09:49:33 am »
Hello,

This is patch which shows fps counter in upper left corner of the screen. You can enable / disable it with F12 key. It's disabled by default.
Patch was created from src directory.

Btw, last time i programmed in c/c++ couple of years ago. And even then i didn't code much in it, so this can be buggy ;)

Also, i'm not sure if it shows correct results.

My results (ubuntu linux, Intel(R) Pentium(R) Dual  CPU  T2370  @ 1.73GHz) at 640 x 400:

Main menu: 150 - 160
Geoscape (doing nothing): 110 - 120
Geoscape (rotating on min zoom): 60 - 90
Geoscape (rotating on max zoom): 50 - 70
Battlescape (doing nothing): 140 - 150
Battlescape (scrolling): 135 - 140
« Last Edit: October 30, 2010, 04:20:01 pm by michal »

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Fps counter patch
« Reply #1 on: October 30, 2010, 01:02:42 pm »
Nice, it works fine here.

There is also a function SDL_getFramerate, but I don't know if that can be used here, because it only works with a "frameratemanager"?
« Last Edit: October 30, 2010, 01:45:31 pm by Daiky »

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Re: Fps counter patch
« Reply #2 on: October 30, 2010, 03:52:57 pm »
I've just tested how scaling affects fps.  It's so slooow :( Using 320x200 resolution gives ~480 fps on geoscape.

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Fps counter patch
« Reply #3 on: October 30, 2010, 04:30:04 pm »
yep, using resolution 320x200 almost 2000 fps and my CPU goes to 60% ... I think if you limit the frames to 30 fps, it would only take 0,9% CPU ? :p

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Fps counter patch
« Reply #4 on: October 30, 2010, 05:08:37 pm »
Nice, it works fine here.

There is also a function SDL_getFramerate, but I don't know if that can be used here, because it only works with a "frameratemanager"?
SDL_getFramerate doesn't do what you'd expect, it's part of SDL_gfx's FPSmanager that lets you control and lock the game's framerate.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Fps counter patch
« Reply #5 on: November 11, 2010, 01:45:32 pm »
Added to SVN.

alienjon

  • Guest
Re: Fps counter patch
« Reply #6 on: March 05, 2011, 08:02:28 pm »
MUCH better than the emulated original's 10 fps (or at least it feels about that  :P)