Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / frame drop issues in 1088

Author
Message
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Mar 2013 07:35
I've nearly finished my game and unfortunately I'm having a huge frame rate drop issue.
On my HTC Droid Incredible 2 the frame rate will drop after
my ship fires its weapons and continues to drop well below 10 and doesn't really recover when less sprites are on screen.
I tried using:
update(0)
render2dfront()
swap()
Which tremendously helped on my Nexus 7 but not on the HTC (runs android 2.3.4).

I think the issue might be that I'm updating the sprite collision shape of my ship, the bullets, and the enemies every cycle.
But I'd like to confirm that with you folks because it also seemed to happen when I added a bunch of assets and the size of the media folder got to about 6mb.
Most of the images need to be scaled down quite a bit since I developed them in much higher resolution than is ultimately needed.
But the images on the HTC will always need to be scaled down since I need to have the game look good on 1280x768 and the HTC's resolution is much smaller at 800x480.
Most of the sprites on screen are clones. Does each clone need to take the original texture and scale it properly or does it rely on the scaled texture of the original sprite?
It seems like the SetSpriteShape command should be pretty light weight, but I suppose if I'm doing it on 12 sprites * 45 times per second = 540 updates per second... still doesn't seem like a lot.

I get the same results under 1076 using Sync().
I've also tried using mode 0 and mode 1 on SetSyncRate as well as altering the syncrate anywhere from 30 to unlimited, still the issue remains.

So, I'm sorta stuck on how to tackle this. Should I start reducing the texture sizes or should I remove my calls to SetSpriteShape()?
If I need to remove my calls to SetSpriteShape() does anyone have suggestions on how best to shape the collision for a sprite with multiple frames that are oddly shaped? I have a few sprites that are best served by long rectangles, but they rotate.

Thanks!!

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Mar 2013 07:50
Well I commented out SetSpriteShape and the framerate is good on my HTC. So I guess that's the issue. Now I just have to figure out where to limit it. I was using polygons so I can imagine a 12 pt polygon on every sprite updated at 45 times per second is a drain. Looks like I'll have to find the fine line.
More suggestions and discussion on this topic is certainly welcome!

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd Mar 2013 20:27
Seems I've solved this. What I've done is create a custom SetSpriteShape function that simply skips frames. I had to set it to only update the shape every 8 frames which in my game is actually updating the shapes 6 times per second. I may further code in a calculation based on the actual frame rate. That way if frame rate drops I can force more skips.

Login to post a reply

Server time is: 2024-05-06 18:12:22
Your offset time is: 2024-05-06 18:12:22