Page 1 of 1

Painkiller: Black Edition - FPS Configuration Addition

Posted: Sun Jun 14, 2015 11:50 am
by atom0s
Here is a quick guide on how to add single player fps settings to the game.

File: <Painkiller Root>\Data\LScripts\Main\Cfg.lua
File: <Painkiller Root>\Data\LScripts\Main\Game.lua
File: <Painkiller Root>\Data\LScripts\HUD\Console.lua
  • Find function Console:Cmd_SETMAXFPS, replace it with this:
    1. function Console:Cmd_SETMAXFPS(val)
    2.     if val == nil then
    3.         CONSOLE.AddMessage( "Give a new value after this command to change maxfps." )
    4.         CONSOLE.AddMessage( "Give a 0 to remove the limit." )
    5.         return
    6.     end
    7.     val = tonumber(val)
    8.     if val then
    9.         WORLD.SetMaxFPS(val)
    10.         if Game.GMode == GModes.MultiplayerClient then
    11.             Cfg.MaxFpsMP = val
    12.         else
    13.             Cfg.MaxFpsSP = val
    14.         end
    15.     end
    16. end
Now when the game loads it will default to 60 fps. You can now use the \setmaxfps command to edit the single player FPS amount and it will save/load when the game is restarted automatically.

Re: Painkiller: Black Edition - FPS Configuration Addition

Posted: Mon Jun 15, 2015 12:41 am
by Peppins
Great one, many thanks!!!!!!

But this line isn't useful:
  1. if Cfg.MaxFpsSP == 0 then
  2.         Cfg.MaxFpsSP = 60
  3.     end
You can remove it so when you write /setmaxfps 0 the value will go to 0 so unlimited fps as default (useful for benchmark):
  1. CONSOLE.AddMessage( "Give a 0 to remove the limit." )
I also prefer to set the default MaxFpsSP as default MaxFpsMP:
  1. MaxFpsMP =120,
  2. MaxFpsSP = 120,
I've also done a fix so that now the limiter work also if you start a new multiplayer game (instead of just on client..)

Added that in the Game.lua:
  1. WORLD.SetMaxFPS(Cfg.MaxFpsMP)
below:
  1. self:OnMultiplayerClientTick(delta)
Also modified a little the Console.lua, see the attachment and the readme for more info.

Here is a quick download link for who want a easy way to use the fix. Click here or see the attachment.