3

I'm making a fighting game, so I have giant character sprites (300px X 350px) with lots of frames of animation (~150 per character), so the maximum 2048 x 2048 texture size won't fit all frames of animation for a character. So, I'll need multiple TextureAtlases, right?

Do I need to worry about the costly GPU texture swapping, then, if I'm switching TextureAtlases on a MovieClip?

To change animation frames, would it be sensible to create a manager to select the frame and the atlas?

Or can I combine TextureAtlases so that one atlas stores multiple 2048 x 2048 sprite sheets?

How would you approach this?

Pup
  • 9,476
  • 6
  • 42
  • 61

4 Answers4

4

A recommendation from Daniel Sperl on the Starling forum:

If you're sprites are so huge, I'm afraid you'll run into problems with texture memory. Unfortunately, there is no easy workaround for that at the moment, except creating that animation with "Spriter" (beta):

http://www.kickstarter.com/projects/539087245/spriter

Pup
  • 9,476
  • 6
  • 42
  • 61
1

Consider whether you can reduce your animation demands by doing skeletal animation. Instead of drawing every single frame of your character directly into textures, break the character up into animatable parts, position the parts using transforms and then composite them into your animation frame at runtime. It's a fighting game, so this should be manageable (presumably you only have two animated characters, plus perhaps some relatively inexpensive environmental effects). As a result, you only need each unique part of each character, which should drastically reduce your texture budget (but increases the complexity of your animation engine).

You might look at DragonBones (http://dragonbones.github.com/getting_started_en.html) for help in achieving that.

Tim Keating
  • 5,636
  • 4
  • 41
  • 51
  • The accepted answer also mentions Spriter, which is now released. Another great tool for doing 2D animation is Spine http://esotericsoftware.com/. – Tim Keating Feb 27 '14 at 15:58
0

Where is this 2048 x 2048 limitation documented? I've never read such a thing. The only thing i could find in the Starling 1.1 documentation concerning texture atlas size is:

Any Stage3D texture has to have side lengths that are powers of two. Starling hides this limitation from you, but at the cost of additional graphics memory. By using a texture atlas, you avoid both texture switches and the power-of-two limitation. All textures are within one big "super-texture", and Starling takes care that the correct part of this texture is displayed.

Assuming i haven't completely missed this important detail and there is no size limitation on texture atlases, just create a one at 4096 x 4096 or 8192 x 8192.

Chunky Chunk
  • 14,884
  • 13
  • 75
  • 149
  • 2048 x 2048 is max texture size for context3D -- and a lot of devices even. – ansiart May 09 '12 at 22:48
  • 1
    ah, there it is: flash.display3D.Context3D.createTexture() - `ArgumentError — Texture Too Big: if either the width or the height parameter is greater than 2048.` – Chunky Chunk May 10 '12 at 00:23
0

hmm - my guess is that using textures larger than 2048x2048 has an effect on performance. And i would further posit that shifting between textures of that size will also cause performance to take a hit. Have you looked into scaling down your texture assets and upscaling them in the game?

fideldonson
  • 522
  • 3
  • 14
  • +1. I would agree with this. You could always scale them down, and then re-scale them up with mipmapping to get trilinear sampling – ansiart May 10 '12 at 19:59
  • I literally do not understand what you are trying to say by "scale them up with mipmapping." Mipmapping has nothing to do with scaling, save that it's basically a cache for textures at specific scale points. This is a technique for throwing away information you don't need, not for adding information magically out of thin air! – Tim Keating Nov 28 '12 at 22:35
  • Also? This is a terrible suggestion. If you are going to throw away detail in your art, just create it at a low detail level in the first place. You almost never want to upscale if you can avoid it, because it very quickly gets to looking awful. – Tim Keating Nov 28 '12 at 22:36