Make sure the promises aren't dropping frames
This commit is contained in:
parent
63f7147458
commit
6149f72d98
1 changed files with 10 additions and 2 deletions
12
runner.lua
12
runner.lua
|
@ -419,7 +419,12 @@ local function rewind()
|
||||||
return promise
|
return promise
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local frame = 0
|
||||||
|
local lastFrame = 0
|
||||||
|
|
||||||
local function rewound()
|
local function rewound()
|
||||||
|
frame = 0
|
||||||
|
lastFrame = 0
|
||||||
for i=#rewinds,1,-1 do
|
for i=#rewinds,1,-1 do
|
||||||
local promise = table.remove(rewinds, i)
|
local promise = table.remove(rewinds, i)
|
||||||
promise:resolve()
|
promise:resolve()
|
||||||
|
@ -521,10 +526,13 @@ local function initializeRun(_M)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local frame = 0
|
|
||||||
|
|
||||||
local function mainLoop(_M, genome)
|
local function mainLoop(_M, genome)
|
||||||
return advanceFrame(_M):next(function()
|
return advanceFrame(_M):next(function()
|
||||||
|
if lastFrame + 1 ~= frame then
|
||||||
|
message(_M, string.format("We missed %d frames", frame - lastFrame), 0x00990000)
|
||||||
|
end
|
||||||
|
lastFrame = frame
|
||||||
|
|
||||||
if genome ~= nil then
|
if genome ~= nil then
|
||||||
_M.currentFrame = _M.currentFrame + 1
|
_M.currentFrame = _M.currentFrame + 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue