Animated Background Using Libgdx

I am creating a user interface system for an Android game, which will have a large (up to 4096x4096) background area in which the menu can be placed anywhere on this screen, and the camera will fly to this place when another menu is required, Instead of having a large static image, I would like to revive it a little. I would like to know how to do this efficiently, keeping up with the device. These are the methods that I have come up with so far, but maybe there is something better.

1) You have 3 separate 4096x4096 static layers for the background, 1 - sky, one - landscape, one - like clouds and trees. Each layer is placed on top of each other with a small difference in space Z, so that with a slight parallax effect, when the camera moves.

2) You have a large stationary background image with a layer on top of it with individual specific sprites of clouds, trees and other things that need to be animated. I think this may be the most efficient route, since I can not animate parts that are not visible, but also limits reuse, since each individual object must be manually placed in space. My goal is to be able to just change assets and be able to have a whole new game.

3) You have 1 large background layer with several frames that play almost like a video. I feel that it will be worse in performance (loading several 4096x4096 frames and drawing different 30 times per second), but it will give me the scene exactly the way I want it right from After Effects. I doubt that this is even possible, not only because of the drawing, but also for storage on Android devices only for the user interface of the menu, it will not allow using several frames of 6 MB in size.

Are they in the right direction? I saw several similar questions, but no one came close enough to what I needed (a large, moving background that does not consist of tiles).

Any help is appreciated.

+6
source share
1 answer

As far as your question is noted for Android, I would recommend a second solution.

The main reason is that the solution # 1 and # 3 involves loading multiple 4096x4096 textures. Fast calculation: three 32-bit textures with this resolution will use at least 200 MB of video memory. This means that you can immediately drop many Android devices.

On the other hand, solution No. 2 will include only two large textures: a large still background image and a texture atlas containing specific sprites of clouds, trees ... This solution is really more memory friendly and will lead to the same aesthetic result.

TL DR: 3 solutions will work just fine, but only # 2 will match the embedded device

+3
source

All Articles