4
votes

In a game we're developing we need to animate a large sprite, of size 485x485 and the animation has about 30 frames. We have a problem animating such artifacts. I have tried some solutions as listed below, but unfortunately we haven't been able to come up with a solution yet.

Tiling

It looks like putting every frame in one big tile is not an option because:

  • The texture size needs to be a power of two, so it shows up as black on most devices
  • When I make the texture size a power of two, it becomes too big for most devices too handle
  • Recommended maximum texture size of AndEngine seems to be 1024x1024.

Seperate sprites

The other option is loading each texture, and thus each frame, seperately and putting it in a Sprite (as described here). This works quite well and toggling the visibility of each sprite at the right time causes the user to see the animation.

The problem with this method is that loading the whole animation takes quite some time. This is not visible when initially loading the game because of the loading screen, but later in the game the animation needs to be changed and the game needs then about 2-3 seconds to load. Putting a loading screen up is not an option.

Loading on seperate thread

I tried to put loading the textures in a seperate, newly created thread, but even while the thread loads the textures the drawing of the game seems to be paused.

Other options?

I don't know any option, and it appears no one else tried to animate a texture greater than 50x50 pixels because it is very difficult to find anyone with a similar case.

My question is: Is it even properly possible to animate large textures in AndEngine?

1
hey sebazzz were you able to do the seperate sprites approach successful, if yes can you please help me out for that particular line this.loadTexture("character-default", idx); where to write that or anything else needed?skygeek
Yes, it was in a certain way succesfull. It takes some time to load the animation though, but we were able to mask it. The loadTexture method just returns an ITexture instance, you can replace that statement with anything that returns an ITexture.Sebazzz
so i have to create so many ITexture as of frames and can you explain a bit more about masking, it would be better for me if you can technically help me. and thanx for reply.skygeek
I am using a TexturePackLoader. My load function looks like this: TexturePack spritesheetTexturePack = new TexturePackLoader(this.game.getTextureManager(),"gfx/").loadFromAsset(this.game.getAssets(), "monster.xml"); spritesheetTexturePack.loadTexture(); How can I use MegaAnimatedSprite with the above function? Thank you!Shailen

1 Answers

2
votes

I think your problem is going to run up against device limitiations, not andengine limitations. Designing for mobile, there are few android devices that could run that.

However, you may be able to come up with an alternative solution using VertexShaders and FramentShaders. This si an important features of Andengine GLES2

Here is an article describing that approach: http://code.zynga.com/2011/11/mesh-compression-in-dream-zoo/