How to split up levels? (cocos2d,box2d,iphone) to save CPU and memory?

Posted by cocos2dbeginner on Stack Overflow See other posts from Stack Overflow or by cocos2dbeginner
Published on 2011-03-04T15:22:27Z Indexed on 2011/03/04 15:25 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

Hi,

so I'm going to create large levels. But there's a problem: There's much unseen space (it's a jump'n run like mario bros.) and this will use memory + cpu. so how could I split up my levels? I'm using Box2D+ cocos2d for iphone.

Any ideas?

Mayby just set the visible property to NO? But it would be still in the memory :(. But what with the box2d bodies? Destroy and recreate them would be to heavy for the FPS, because I have physics built in which should not be recreated. Should I make fix points where i want to split the level up, than if the player is 200 px away it should preload it. and if the player is 200 px away from the last part of the level I unload it. But there would be the problem with the physics, because on the start of the level it has a unique movement and later if i destroy and recreate it it would do the same. but i don't want that.

other ideas?

© Stack Overflow or respective owner

Related posts about memory

Related posts about cocos2d