When I run my game in the corona simulator all is well. However when I run the game on my iPad mini retina with iOS 8.1 it crashes at the same moment in time due to the following error:
Exception Type: EXC_RESOURCE
Exception Subtype: WAKEUPS
Exception Message: (Limit 150/sec) Observed 368/sec over 300 secs
I’ve created a rather big and complex railroad tycoon sort of game that’s using a gameLoop with an enterFrame listener to handle all screen updates, gameModel updates, etc.
when further in the game, a lot is going on and per second some 25-50 objects need to be updated.
I’m using Corona SDK 2393a on a Mac with Yosemite.
I’ve got a couple of questions:
I understood after reading through the forum that corona is single thread only?
What specifically triggers a sleep/wakeup cycle in corona?
Any idea how to get the amount of wakeups below the limit of 150/s?
Here’s some example code from my gameLoop class:
function loop:enterFrame() self.frames = self.frames + 1 if self.minutes == 5 then self.minutes = 0 end if self.seconds == 60 then self.seconds = 0 self.minutes = self.minutes + 1 logger:debug("minutes: " .. self.minutes) end if self.frames == 60 then self.frames = 0 self.seconds = self.seconds + 1 end self:update() end function loop:update() --update every frame self:updateTrains() --update every second if self.frames == 0 and self.seconds % 1 == 0 then self:updateGameStatus("updateDate") end --update every 3 seconds if self.frames == 0 and self.seconds % 3 == 0 then self:updateGameStatus("updateLevelGoals") end --update every 5 seconds if self.frames == 0 and self.seconds % 5 == 0 then self:updateCities() self:updateResources() end --update every 5 minutes if self.minutes == 5 then self:updateEconomy() end end