So I’m making a space shooter, and before the update I was getting a solid 30 frames per second with kfps defined to be 30. The game ran really smooth, and the framerate would only drop when I would fire more than 5 missiles at once.
Now with the update, I can get over 30 fps. However, when I define kfps to be 30, the framerate hovers between 28-29, and the game is really choppy. But I can fire tons of missiles without the framerate changing.
I thought I would try the new thread based loop, but when I do I can no longer limit the fps with kfps and the game ends up choppy because the framerate won’t stay at 30, instead fluctuating between 30 and ~45.
Is kfps disabled with the new loop settings?
Any ideas on whats happening?
I got nstimer and threaded mixed up in the previous post. I can’t limit the fps with the nstimer loop. The threaded and event pump can be limited, but it doesn’t seem to be working correctly. Before 1.5 my fps would read 30.0. Now it never does, which means its dropping down to 20 for some reason. It shouldn’t do that though, because when I set kfps to 60, I get around 45 to 50 fps. Is anyone else seeing this? It seems like a bug.
kFPS effects all three loop types - there’s commented text in your AppController.mm that explains which constants effect which loop types. The only change to NSTimer compared to previous versions of Unity iPhone is that now there’s also a kThrottleFPS value, which essentially is just a multiplier for the kFPS value when running under NSTimer, since it typically needs much higher values in order to maintain decent performance. The default for kThrottleFPS is 2.0, so if you used to run your game with kFPS set to 30, then setting kFPS to 30 and kThrottleFPS to 1.0 should achieve the results you’re used to.
Out of curiosity, what are you getting your FPS value from? Are you basing it on average frametimes in the internal profiler, or some kind of on-screen text generated from script? (the latter is not really reliable on the device itself)
I was using the script from the wiki, so i guess those framerates are inaccurate. I missed those comments in the appcontroller so thanks alot for the explanation.
But the problem remains the same. The game now stutters at times like its not properly syncing to 30 fps. Its really noticeable during tight turns.
My frametimes are around min 20, max 35, and and average between 33.5 and 33.9. Now it should be 33.3 for it to be 30 frames per second, correct?
The docs say that frametimes should be multiples 16.7. I’m getting some values that are nowhere near that.
I’ve started with a new scene and am experiencing the same problem. I have a camera that is parented to a rigid body the player controls. Is it not possible to get smooth camera movement this way due to physics fluctuations of the rigid body? Is there anything I can look for that may cause these frequent pauses. I’m really lost here.