Monday 15 April 2013

android - How to create a big TextureRegion from multiple small TextureRegions in Andengine? -


I am making a 2D runner game with endangin and my platforms have been created from 32x32 sprites, which are separate There are textured fields. I want to be able to create platforms with different sizes, so I can not make a platform with a single image file.

Therefore, each of my platforms is created from several sprites with hundreds of sprites if the platform is large. This clearly reduces the performance of my game This is the reason why I am trying to find a way to make a big texture practice from my small tiles which I am making my platform, so I make less prints I will be able to.

Whether I create the graphic design of a platform that does not always have the same shape or not to make the texture desert of the entire phase (made up of many platforms).

How can I touch texture vacancies simultaneously in an efficient way?

As far as I understand the texture rules, they are only certain types of a given atlas There are references (in which memorable image) will not help by increasing the size of a texture area to reduce the memory, instead you will only increase the cutout / clipping to see it from your atlas

For example, Your image looks like this (with texture areas A, B, C, D):

AB

CD

made its own Texture ABC and D (and probably it is not what you want) in a large texture area as a result of width and height doubling of the region area

If your platform contains only one texture area A, So you can load it into a new Atlas as a single PNG and you can add TextureOptions to the REPEATING_NEARIST_PREMULTIPLYALPHA in the manufacturer then you can stretch the width and height of the teststore area Per width and can set the height and Atlas will repeat it - if you

  textureRegionHeight = imageHeight then you will be made AAAAA; TextureRegionWidth = 5 * imageWidth; SpriteWidth = textureRegionHeight; SpriteHeight = textureRegionHeight; To improve performance,   

Additional Information

, you should do the following:

  • Sprite pooling (more: object pooling in general) (you can never show more than 100 plus 32x32 sprites next to each other, because some of them will be out of the screen soon)
  • Spratbatch Sprites for non-immovable / static, Sprite Group for others (as you know That can be more than 5 to 10 sprites with the same texture, I have never measured that these groups are better or worse than the REPEATING_NEAREST option)
  • Sprite.setCullingEnabled (true) < / Ul>

    These points should improve performance P>

    More information can be found in the Andygen Forum or

No comments:

Post a Comment