Skip to content

Commit

Permalink
validationtests: remove speed adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
abma committed Jun 30, 2012
1 parent 204a6c9 commit b279c1f
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions test/validation/LuaUI/Widgets/test.lua
Expand Up @@ -11,30 +11,17 @@ return {
end end


local maxframes = 27000 -- run spring 15 minutes (ingame time) local maxframes = 27000 -- run spring 15 minutes (ingame time)
local minfps = 10 -- slow down gamespeed if below this value local initialspeed = 120 -- speed at the beginning
local maxfps = 30 -- increase gamespeed if fps higher as this value
local initialspeed = 30 -- speed at the beginning
local os_clock = os.clock
local lastcheck = math.floor(os_clock())


function widget:GameFrame(n) function widget:GameFrame(n)
if n==0 then -- set gamespeed at start of game if n==0 then -- set gamespeed at start of game
Spring.SendCommands("setmaxspeed " .. 1000, Spring.SendCommands("setmaxspeed " .. 1000,
"setminspeed " .. initialspeed, "setminspeed " .. initialspeed,
"setminspeed 1") "setminspeed 1")
end end
local now = math.floor(os_clock()) --try to run it at frame rate >10 and <30 by adjusting game speed
if n==maxframes then if n==maxframes then
Spring.Echo("Tests run long enough, quitting...") Spring.Echo("Tests run long enough, quitting...")
Spring.SendCommands("quit") Spring.SendCommands("quit")
elseif (n>100) and (now > lastcheck) then -- adjust fps only once a second
lastcheck = now
fps = Spring.GetFPS()
if (fps<minfps) then
Spring.SendCommands("slowdown")
elseif (fps>maxfps) then
Spring.SendCommands("speedup")
end
end end
end end


0 comments on commit b279c1f

Please sign in to comment.