Note that there are some explanatory texts on larger screens.

plurals
  1. POCocos2d/Box2d game not running well on iPad Air
    primarykey
    data
    text
    <p>I was about 95% done with my first cocos2d 2 / Box2d game when the iPad air was released. The game was running perfectly smoothly on an iPad mini, but on the Air it does not run smoothly at all - lots of stuttering and jerky movement, but with a frame rate of 60!</p> <p>I use a fixed time step, and after lengthy investigation, I found that by increasing the value of MAX_CYCLES_PER_FRAME from 2 to 3 the Air would run smoothly, but the mini then runs badly.</p> <p>So my question is, has anyone run into this and how might this be solved? I guess I could try to determine the H/W and change the value, but there must be a good reason for the disruption and a better way to accommodate all devices.</p> <p>Thanks TinoK</p> <p>Adding code snippet...</p> <pre><code>- (void) update:(ccTime) dt { static double UPDATE_INTERVAL = 1.0f/60.0f; static double MAX_CYCLES_PER_FRAME = 2; // 3 or more makes iPad air happy and iPad mini unhappy static double timeAccumulator = 0; timeAccumulator += dt; if (timeAccumulator &gt; (MAX_CYCLES_PER_FRAME * UPDATE_INTERVAL)) { timeAccumulator = UPDATE_INTERVAL; } // Advance score multiplier timeout if (_scoreMultiplierTimeout &gt; 0.0) { _scoreMultiplierTimeout -= dt; if (_scoreMultiplierTimeout &lt;= 0.0) { _scoreMultiplierTimeout = 0.0; _scoreMultiplier = 1; } } //int32 velocityIterations = 8; //int32 positionIterations = 1; int32 velocityIterations = 3; int32 positionIterations = 2; while (timeAccumulator &gt;= UPDATE_INTERVAL) { timeAccumulator -= UPDATE_INTERVAL; _world-&gt;Step(UPDATE_INTERVAL, velocityIterations, positionIterations); _world-&gt;ClearForces(); // Iterate over the bodies in the physics world for (b2Body* b = _world-&gt;GetBodyList(); b; b = b-&gt;GetNext()) { if (b-&gt;GetUserData() != NULL) { ... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload