Page 1 of 1

Problems with the FPS Manager widget

Posted: 02 Oct 2007, 05:40
by MetalSkin
G'day all,

Tried the FPS Manager for the first time last night, very impressed.

However I had one crash and also noted some behaviour that would be nice to change.

I Alt-Tabbed to chat to someone in the lobby, when I came back almost no gfx was displayed (as though everything had been turned off) and when I tried to force a refresh by selecting 'l' it crashed, to the point that Vista actually did a system crash/shutdown.

Now it could be a problem with my gfx card, but I suspect not, I've always been able to alt-tab, and never had a crash as a result of alt-tabbing. I will do more testing to see if I can recreate the problem.

The other behavioural issue is that if you turn off shadows via settings, when your using FPS Manager widget it will turn on shadows when your fps is high enough... not an issue at the start of a game, but as time progresses I found that it would turn the shadows on and off, often quite quickly, which was extremely annoying. I would rather that if I turned off shadows via the settings that it not turn it on, regardless of the current FPS (personally I'm not that impressed with shadows).

Overall I love the widget and am going to use it as long as it doesn't cause alt-tab issues.

Posted: 02 Oct 2007, 13:31
by quantum
Glad you like it :-)

I don't really know what in the widget could cause atl-tab crashes, I'm unable to reproduce them. :( Let me know if you discover more!

I'm planning to integrate the FPS manager with an options GUI to make it easily configurable, but in the meantime, here is a version of the FPS Manager that does not handle shadows:

Code: Select all

function widget:GetInfo()
  return {
    name      = "FPSManager - MetalSkin Edition",
    desc      = "Tries to keep the framerate around 35 by adjusting the "..
                "detail level.",
    author    = "quantum",
    date      = "May 28, 2007",
    license   = "GNU GPL, v2 or later",
    layer     = 0,
    enabled   = false  --  loaded by default?
  }
end

--------------------------------------------------------------------------------
----------------------------Configuration---------------------------------------
local maxFps     = 40
local minFps     = 30
local tolerance  = 30
---------------     increase detail  ----  reduce detail     -------------------
--------------------------------------------------------------------------------
levelTable = { {"advshading 1"       , "advshading 0"      }, -- level 1
               {"maxparticles 10000" , "maxparticles 5000" }, -- level 2
               {"water 1"            , "water 0"           }, -- level 3
               {"water 3"            , "water 1"           }, -- level 4
               {"maxparticles 15000" , "maxparticles 10000"}, -- level 5
               {"maxparticles 20000" , "maxparticles 15000"}, -- level 6
               {"dynamicsky 1"    	 , "dynamicsky 0"      }} -- level 7
            -- {"water 2"            , "water 3"           }} -- level 8 (off)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


local SendCommands  = Spring.SendCommands
local counter       = 0
local detailLevel   = 1
local fpsTable      = {}
local raisePoints   = 0
local lowerPoints   = 0


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


local function RaiseDetail()
  raisePoints = raisePoints + 1
  if ((detailLevel <= #levelTable) and
      (raisePoints > tolerance)) then
    print("raise", detailLevel)
    SendCommands({levelTable[detailLevel][1]})
    detailLevel = detailLevel + 1
	raisePoints = 0
  end
end


local function LowerDetail()
  lowerPoints = lowerPoints + 1
  if ((detailLevel > 1) and
      (lowerPoints > tolerance)) then
    print("lower", detailLevel)
    SendCommands({levelTable[detailLevel - 1][2]})
    detailLevel = detailLevel - 1
    lowerPoints = 0
  end
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


function widget:Initialize()
  SendCommands({"water 0", "shadows 0", "advshading 0"})
end


function widget:Update(t)
  counter  = counter + 1
  table.insert(fpsTable, Spring.GetFPS())
  if (#fpsTable > 30) then
    table.remove(fpsTable, 1)
  end
  if ((counter+23) % 30 < 0.1) then
    counter = 0
    sum = 0
    for _, v in ipairs(fpsTable) do
      sum = sum + v
    end
    average = (sum / #fpsTable)
    if (average > maxFps) then
      RaiseDetail()
    else
      raisePoints = 0
    end
    if (average < minFps) then
      LowerDetail()
    else
      lowerPoints = 0
    end
  end
end
For those who don't have the original script, it's bundled with CA

Posted: 02 Oct 2007, 14:10
by MetalSkin
quantum wrote:I don't really know what in the widget could cause atl-tab crashes, I'm unable to reproduce them. :( Let me know if you discover more!
I'm still trying to recreate. I had installed a new driver, plus I had enabled Shadows, turned off multi thread option on my drivers and a couple of other things, so just trying to figure out if it is the FPS manager or not... it may not be... hoping it isn't cause it's brilliant :)
quantum wrote:I'm planning to integrate the FPS manager with an options GUI to make it easily configurable,
That would be a rip snorta! :)
quantum wrote:but in the meantime, here is a version of the FPS Manager that does not handle shadows:
Thanks for that, I'll try it out.

Posted: 02 Oct 2007, 16:14
by TechnoTone
Great widget quantum! One request, would it be possible for it to switch on the blobshadow widget when it disables the shadows? I'd add it myself except I don't know the commands to enable/disable a widget.

Posted: 03 Oct 2007, 00:02
by MetalSkin
I tried out that script and it worked a treat!

I also have been trying to recreate the crash I had and so far have not been able to, but I suspect that I may not be recreating the exact environment that happened when it crashed...

However I suspect that the problem wasn't the widget, I suspect it's an issue somewhere else, just exasperated by the widget playing with the settings... most prob an issue with my gfx config and a particular setting combination while alt tabbing.

Posted: 03 Oct 2007, 13:01
by Smiff
could this widget remember last used settings and not start with everything off?
thanks

Posted: 04 Oct 2007, 01:24
by LordMatt

Code: Select all

function widget:Initialize()
  SendCommands({"water 0", "shadows 0", "advshading 0", "maxparticles 5000"})
end
This code sets what the initial settings are, which you could customize.

Posted: 04 Oct 2007, 13:07
by quantum
Here is a half-baked GUI version. It kinda supports jK's blob shadows widget, and remembers some settings.