What should we be "shooting" for in terms of iPhone resource usage

Forums Programming iPhone SDK / UIKit / Objective-C / Xcode What should we be "shooting" for in terms of iPhone resource usage

This topic contains 3 replies, has 2 voices, and was last updated by  liquidfire 2 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
May 12, 2011 at 12:38 am #231239

par02
@par02

So, I am doing everything I can to keep my resource usage down. But doing a google search just doesnt help w/ the following questions:

1) What is the recommended limit for memory usage (Real Memory on the profiler)? Right now, I am trying to stay under 40MB as most games I see do this. But what can I push? I am attempting to court iPhone 3G and on.

  • Angry Birds: ~36MB
  • Tiny Wings: ~17MB

2) What is the recommended limit for CPU usage? I have noticed that CPU usage doesnt quite relate to FPS. I have been (up until recently) only using around 10% CPU usage and FPS was pegged between 59-60. Now im around 35% as I have added game logic and although “most” of the time my FPS is around 59-60, I do see drops to 45 during transitions (i.e. threading changes).

3) With threading in mind, is there a way to lower the priority of a thread that you kick off? Almost all of my thread required code is NOT time sensitive. Which means, when I kick off a thread, I can happily wait to do anything with the results until its done. I would like to kick off a thread at a low priority and let the game run as fast as it can… when the thread is done THEN I do whatever I need w/ the results of the threads resulting work.

4) If you are using a scrolling background and tiling the textures for the background, would you recommend using straight pngs for EACH tile or would using a spritesheet for the tiles be a good idea? The main reason I ask THIS question is that when I was using individual images for each tile, I had no tiling lines. Now that I have my backgrounds in a spritesheet, I am seeing tiling and no matter what I do I cannot get rid of them. I tried offsets, I’ve tried different formats of the spritesheet container (i.e. png vs pvr vs compressed pvr). I am pretty much ready to give up and just use straight images for my tiles but that does use more memory :(

5) When using CCSpriteFrameCache “removeUnusedSpriteFrames” and CCTextureCache “removeUnusedTextures”, I notice it removes everything that isnt currently used (even though not 1 frame later there might be a sprite in a frame you need). So I’m going to assume it isnt very smart. But one thing I HAVE noticed, is after awhile (i.e. running the game for a couple mins) my memory usage goes up to the level I would have if I had loaded and kept all images in memory but these removeUnusedX calls still remove a lot of images AND cause stuttering. Is there some special way to use these that is not documented anywhere?

6) Is there a document that tells “Things to look for that Apple will use to refuse your game”? So, if they see me using XMB of Real Memory that will be a red flag. Or some other set of criteria to watch out for.

7) What is the recommended maximum size of a game? I read somewhere that 2GB is the limit.. now I will never reach that w/ this current project but the answer would be nice to know.

Thats about it for now. Thanks much for any responses!

PAR

May 12, 2011 at 1:17 am #329239

liquidfire
Participant
@liquidfire

1) As low as possible without adversely affecting your gameplay too much. This means that you should always aim for the lowest possible memory usage so that your application is at a low risk of getting terminated in low-memory situation, but at the same time, I wouldn’t just go with one or two sprites per scene, since that would look empty. You just have to find that balance.

3) Look into the NSThread Class Reference, there is one (well, two since there is both a class and instance method version) method called +/- setThreadPriority:(double)priority, where priority ranges from 0.0 to 1.0, with 1.0 being the highest priority.

6) The only thing that I can think of is the App Store Review Guidelines. Regarding memory usage, Apple doesn’t really care about how much memory your app uses, as long as it doesn’t crash because of memory usage. It still is best to keep your used memory down to a minimum.

7) In the US, the app download limit over 3G is 20mb, anything above will require WiFi to be downloaded. I personally think that it is very important to keep your app under this limit because if you don’t, you won’t be able to get those impulse purchases from someone on a train, for example, where WiFi might not be available, but they are very bored and want to buy a game. The limit is 2GB, though. Basically, if possible keep your app under 20mb.

Sorry I wasn’t able to answer all of your questions, but I just don’t know the answer to some :)

May 12, 2011 at 6:32 pm #329240

par02
@par02

Hey thanks so much for the info! I got the thread priority going and its exactly what I wanted, thanks!

As for determining your game’s actual “hard drive” size… how do you do this? I’m new to Mac development, Xcode and ObjC so I really have no clue how to determine the actual current size of my application. I really like your suggestion of keeping it under the 20MB limit.

Thanks!

PAR

May 15, 2011 at 10:34 pm #329241

liquidfire
Participant
@liquidfire

It isn’t anything that needs to be done at runtime, you just look at the size of your app bundle once it is all compiled and such.

Here is a good link to determine the final size: http://www.cocos2d-iphone.org/forum/topic/4963

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.