Hello
I am using the game loop from game academy for "yet an other game" on iOS
http://forums.runrev.com/viewtopic.php? ... 037#p79876
Works well except for random performance issue.
While my game runs I have usually a 60 milliseconds duration for one loop (not a fast action game, but still, and I don't need less)
When the game runs on an actual device, sometimes, randomly, this goes to 200 milliseconds and then comes back to normal, at the next iteration.
This can be seen on the screen because sprites are slowing down abnormally then going to normal again.
It is independent of any action from the player and happens even if nothing is touched.
Where can it come from and how to prevent it ?
Is it background processing on the iPhone/iPad that I can't control (from iOS or some sort of garbage collection) ?
It seems for example that it happens more often if I have wifi on (my game does not use it).
It seems also to be more frequent with iOS 7.
Of course I can't and I don't want to control the user's environment.
Any ideas ?
Thanks
Game loop randomly slowing down for one iteration ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 369
- Joined: Sun Dec 19, 2010 1:10 am
- Location: UK
- Contact:
Re: Game loop randomly slowing down for one iteration ?
Hi, macnomad2. Does the game loop always perform the exact same tasks on every iteration? If there's any code you can post, maybe someone will spot something..
LiveCode Development & Training : http://splash21.com
Re: Game loop randomly slowing down for one iteration ?
Thanks, I will post some code, but yes, globally a sprite simply moves at each iteration and calculations are the same.
I measured the random delays but could not find any internal reason.
It really seems that the delays come because iOS or the engine is doing something else in the background sometimes, depending on whats going on.
For example, once my phone rang while I was playing and the game started to go slow just before.
Can I see the « system messages » on iOS, so I could pause the game just in time ? It seems it happens before LC sends a message like suspend.
I wonder if it happens to other people.
I measured the random delays but could not find any internal reason.
It really seems that the delays come because iOS or the engine is doing something else in the background sometimes, depending on whats going on.
For example, once my phone rang while I was playing and the game started to go slow just before.
Can I see the « system messages » on iOS, so I could pause the game just in time ? It seems it happens before LC sends a message like suspend.
I wonder if it happens to other people.