Do you have any schedules going? I have four going during my game. Is that too many to run at once? I posted about my problems in this thread about schedules not deallocating here.
Slowdown problem
(40 posts) (11 voices)-
Posted 2 years ago #
-
I have 4 schedules, but i had only one before and i experienced the same slowdown, so i don't think it has to do with it...
Are you experiencing the same slowdowns as me? I mean, everything runs smoothly and at random fps slowdowns for less than 1/2 a sec and then returns to normal?
Or the more you play your game, the slower it becomes? (but never goes back to 60fps)
Posted 2 years ago # -
@pabloruiz55: Good to know the schedules aren't affecting the fps.
Basically my problem is that the game runs at near constant 60fps when it's a simple scene (just a background and a menu). Once I replace that scene with a scene that contains chipmunk physics, schedules, actions, and counters, I get constant 15fps. As the game progresses and particle effects are triggered, the fps randomly dips down and freezes up for a half a second. When the heavily loaded scene begins rendering itself on the next processor cycle, a few of my sprites (in chipmunk bodies) sometimes fall out of the bounds of my static chipmunk shape.
The problem rarely happens, but when it does, it ruins the game mechanic.
Posted 2 years ago # -
Yes, the same happens to me, i don't suffer from it too much because i have less than 40 sprites in my game, but sometimes if the player was around the edges and e haevy dropdown occured he would end outside of the screen... I kind of avoid this by setting a line with a bigger border but still it looks awful...
How many bodies,etc. do you have that makes the game go at 15 fps?
Have you adjusted the chipmunk's hashes correctly?
Are you sure you are correctly removing your sprites? I was having some slowdowns because i was leaving some sprites and as the game progressed there would be hundreds of unseen sprites... you could try checking this by logging the sprite count at a given time...
Also, try to check what you are doing when the game freezes, maybe you are allocating some heavy stuff at that momment.
Another thing you could try (for me it didn't give anything usefull) is running the game with instruments -> core animation which gives you the current fps... maybe you notice something strange from that...
I am telling you everything i have tried, but i am no expert at this, i recently started programming for iPhone...
Posted 2 years ago # -
@pabloruiz55: Have you cleared out all the unused sound files from your project? I tracked down and cleared out over 30MB of unused sound files from my project. My fps went up considerably and it minimized the number of memory leaks my project reported in instruments.
Also, tracking the creation and death of particles in my game, I noticed that the fps dropped from 60fps (with near 21 chipmunk physics shapes) to 30fps whenever I had an active particle system running in my game. Once the particle was destroyed, the fps went right back to 60fps.
I just posted 5 minutes of game-play at http://www.mathogen.com. That video should give you a better understanding of my game and the potential problems that could arise from low fps. Let me know if either of those suggestions helped you.
Posted 2 years ago # -
Update: Testing on my device shows that my game is consistently running at 30fps. 60fps in the simulator. Still haven't resolved the slow down issue on the device.
Posted 2 years ago # -
Looks like I got the same problem with Rope'n'Fly.
Sometimes the game starts with around 60 fps, and sometimes only with 20-30fps. This doesn't happen on the simulator.
Rope'n'Fly uses mostly 32bit PNGs, just a few layers and sprites.If the game starts with that low fps it will never get faster, meaning you can run the game for hours and fps will not get above 30fps. If the game starts with 60fps it will never get slower.
Anyone an idea whats going on here? ( when debugging and sampling it looks like most time is spent in openGl functions, called from cocos2d).
Posted 2 years ago # -
just on a 3GS or on all devices?
Posted 2 years ago # -
Definitely on 3GS and 3G, not sure if 2G or iPod Touch are affected too. (got hundred of reports from 3GS and 3G devices though).
Any idea? Something I could check or try?Posted 2 years ago # -
Robert,
I was thinking, last time I saw your name in a post, it seemed so familiar, but I couldn't place it. Then yesterday I thought hmm time to check up on hobby OS (Haiku, SkyOS, etc) so I'm reading the backlog of posts since the last time I visited each site, then I'm staring at a forum post and someone mentions Roberts been busy with iPhone games etc...
So it dawns on me. Robert Szeleney, SkyOS creator. And forum poster on that forum where I lurk, and creator of rope n fly, that game that entertains me in the toilet on occasion. Go figure! small world right? =)
Totally off topic ;)
Posted 2 years ago #
Reply
You must log in to post.