开发者

Managing big images in a game

I'm developing a side scrolling shooter, and as background I have a set of images (about 15 images in 1024x1024 in png). and with the sprites of the enemies, and shots, I'm starting to have some memory issues.

I tried to use PVRTC texture but the image is not as shiny as it should be.

Should I load the texture on the go ? What os your strategy in texture management ?

Thank you for the he开发者_运维问答lp


+1 to Aymarick comment. There is good solution in cocos2d for asynchronous texture loading: https://github.com/cocos2d/cocos2d-iphone/blob/develop/cocos2d/CCTextureCache.m:

-(void) addImageAsync: (NSString*)path target:(id)target selector:(SEL)selector

So you keep in memory your in-game screen texture and left/right screens. During scrolling (for example in right direction) you unload not visible left texture, set current screen texture as left, right texture as current screen, and asynchronously load new right texture.

But I would prefer tiled background if it is possible by art design.


"I tried to use PVRTC texture but the image is not as shiny as it should be."

Out of curiosity, which compression tool did you use? IMG's PVRTextool is sometimes better than those that get bundled with some dev packages and, I believe, a newer version (with completely rewritten compressor code) should be available in the not too distant future.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜