Image groups and Sprites - image sheet size question

Hi all,

My partner and I are developing our first game, a turn-based strategy game targeting the iPhone4, and have some questions regarding how to best use the new imageGroup and imageSheet functionality; specifically with sprites.

Since it appears that display groups do not feature automatic culling (unlike image groups), we would like to take advantage of image groups wherever possible. Our current plan for group structure is as follows:

  • populate tilemap, insert all tiles into a tileMap imagegroup. Then, insert this imagegroup into a world display group we’re calling worldGroup. This is working just fine so far.

  • populate sprites over tileMap and insert sprites into their own imageGroup so that they cull correctly off screen without manual implementation which we understand was something of a pain in the past. After that, we would insert the sprite image group into the (display) worldGroup.

As we understand it, all objects in an imageGroup must come from the same imageSheet. However, as we have 10 characters worth of sprites in our game, each with 16 unique animations, we could only possibly fit a single character’s animations onto an imageSheet in compliance with the iphone4’s 2048x2048 image size limit.

We’re trying to figure out what our options are. Would it make sense to try and put all instances of a single character type into a single image group, or should we reserve imageGroups for environment and background tiles? It seems like using imageGroups for sprites would yield the greatest performance benefits, but it seems very difficult to do with device limitations. Is there something we are missing?

We greatly appreciate any assistance. [import]uid: 144846 topic_id: 25895 reply_id: 325895[/import]

First off, while the blog about the new sprite system talks about culling, it doesn’t say that you have to have an imageGroup to do so. Grouped or not, all images now will get culling.

Next, they didn’t actually say what the exact improvements were…just the vague sense that “stuff is faster now.” So while we don’t exactly know, it sounds like it takes advantage of drawing batches of images all at once.
This probably has something to do with keeping the texture (the group’s imagesheet) as the current bound texturebuffer in opengl to do repetitive draws quickly…or something of that nature (under the hood stuff we can’t see).
This is probably why you can only do one sheet per group.

Say you have MonsterX and you want to draw a TON of them. You may be able to get some performance out of putting it in its own imagegroup.
The problem is, if if you have MonsterX imageGroup and MonsterY imageGroup and add them both to your worldGroup displayGroup, they will be drawn in order. Which means all monsterXs will be drawn, then all MonsterYs will be drawn. Depending on your game’s style, this might cause problem if you want sprites to overlap.
I suggest just using the ImageGroup for big batch draws. Which means you’re main tileMap.

You could also do your HUD images in an imagegroup if all the elements can fit in one imagesheet.

But for character sprites, i say just stick them in a normal displayGroup. they’ll still be culled off screen and will draw fast enough. [import]uid: 145612 topic_id: 25895 reply_id: 104784[/import]