Reputation: 3937
We've been developing quite a huge game for android on the basis of AndEngine. So we have a lot of assets to load, especially textures.
At the moment everything (sound, textures etc) for every screen (menu, shop, etc etc) is loaded when the app starts (while showing a progress bar). This way the user only has to wait once about 16 seconds at the start of the game. We think that this is a pretty pleasant solution from the users perspective but might it be bad in terms of battery usage / memory usage or any other reasons?
What arguments speak for a solution where we unload all the screen specific assets of the active screen and load the assets needed for the next screen?
Upvotes: 0
Views: 179
Reputation: 11871
I've done an app that uses a lot of textures (both HD and LOW depending of the device, etc) and I use the "lazy loading" approach. This app is meant for the kids so there's a lot of animations and illustrations. My first menu is so complex that I have to load 19 textures (2044x2044) so I need to show a splash with a progress bar. From that menu you can choose to play some mini-games or watch some videos. If the kid choose to play a game I show another progress bar while the game textures are loading (another 5/6 2044x2044 textures depending on the mini game). If the kid comes back do the main menu I unload the game textures. If the kid wants to watch some movies, well in this case "it gets worse" because now I have to switch to "Android Activities" instead of AndEngine, so I unload the Main menu textures otherwise OutOfMemory would be thrown. If the kid comes back to the main menu all the textures will be loaded again. I think this is the best approach for you, "lazy loading", and you'll find out that this approach will save you a lot of memory.
Upvotes: 1
Reputation: 6018
In my opinion, the best way to go is "lazy loading", i.e., load resources only when you need them. That way you are not making the user wait for resources he will not use. So what I do is, when the app starts, I load the menu's resources during an opening splash screen, and when the user go to the play scene (for example), I unload the menu resources (hence clearing memory), and load the relevant resources for the game sequence, during yet another, different loading splash screen. That way, in total, the user waits the minimum time, and the memory is loaded with needed resources only.
Besides, from a user's point of view, I think it can be annoying to wait for a whole app to load, when all you want is to show your friend the score you reached.
Upvotes: 2