My iPod is slower than my iPad Many of the variables in my 2D mining game were declared as constants like so:

DWConstants.h

static const int kBlockSpriteWidth = 64;
static const float kBufferFactor = 2.5;
static const int kMaxBlockDamage = 3;


This was all well and good for initial testing, but I soon found out that there were quite a few variables that I wanted to be able to adjust based on what device the game was running on.  I thought about a couple approaches to this, and I decided on this one.  The values of the variables are set based on the memory of the device.  I would love to know what you think.

DWMemoryConstants.h

#import &lt;Foundation/Foundation.h&gt;

@interface DWMemoryConstants : NSObject

@property int startingChunks;
@property int chunkSize;
@property int chunksToGenerate;
@property float maxZoom;

@end


DWMemoryConstants.m

#import "DWMemoryConstants.h"

@implementation DWMemoryConstants

-(instancetype) init {
    self = [super init];
    if (self) {

        unsigned long long memorySize = [NSProcessInfo processInfo].physicalMemory;
        unsigned long long memSize = memorySize/1000/1000;

        if (memSize &lt; 256) {
            _startingChunks = 0;
            _chunkSize = 0;
            _chunksToGenerate = 0;
            _maxZoom = 0.00;
        } else if (memSize &gt;= 256 &amp;&amp; memSize &lt; 800) {
            //ipod 5 is in this range
            _startingChunks = 8;
            _chunkSize = 16;
            _chunksToGenerate = 4;
            _maxZoom = 0.45;
        } else if (memSize &gt;= 800 &amp;&amp; memSize &lt; 1800) {
            //ipad 4 will fall in this range
            _startingChunks = 10;
            _chunkSize = 18;
            _chunksToGenerate = 6;
            _maxZoom = 0.25;
        } else if (memSize &gt;= 1800 &amp;&amp; memSize &lt; 2800) {
            //previous typical settings
            _startingChunks = 10;
            _chunkSize = 24;
            _chunksToGenerate = 8;
            _maxZoom = 0.05;
        } else if (memSize &gt;= 2800) {
            _startingChunks = 12;
            _chunkSize = 30;
            _chunksToGenerate = 10;
            _maxZoom = 0.04;
        }
    }
    return self;
}

@end


As always, I am open to any sort of feedback about the code.
I think using memory size is an interesting idea. You may want to define the values  with an expression (e.g. startingChunks = round(memSize / 600) * 2 + 8), rather than an else-if chain, tho if you want to target specific devices, an if-else chain is acceptable.

Old:

if (memSize &lt; 256) {
    _startingChunks = 0;
    _chunkSize = 0;
    _chunksToGenerate = 0;
    _maxZoom = 0.00;
} else if (memSize &gt;= 256 &amp;&amp; memSize &lt; 800) {
    //ipod 5 is in this range
    _startingChunks = 8;
    _chunkSize = 16;
    _chunksToGenerate = 4;
    _maxZoom = 0.45;
}



Underscores are annoying, is there any reason you use them in those variable names? If it's supposed to denote constants, doesn't the name work well enough? It shouldn't be doubted that chunkSize, for instance, won't change if you know how the app works. And if in a future update you want it to change, you could change it without renaming.
if (memSize &lt; 256) {} else {} – in the else block, memSize must be &gt;= 256. So there's really no need to add that to the else if.


With my changes:

if (memSize &lt; 256) {
    startingChunks = 0;
    chunkSize = 0;
    chunksToGenerate = 0;
    maxZoom = 0.00;
} else if (memSize &lt; 800) {
    //ipod 5 is in this range
    startingChunks = 8;
    chunkSize = 16;
    chunksToGenerate = 4;
    maxZoom = 0.45;
}