Skip to main content
Known Participant
November 4, 2011
Question

Runtime asset loading - best practice

  • November 4, 2011
  • 2 replies
  • 861 views

Hello,

I'm creating my first mobile air app, to start with it's going to be on ios then I hope to launch on Android and other platforms. I'm wondering is it a good idea to load my bitmap assets during runtime as and when I need them or is it advised to load them all at once upfront and store in memory?

I guess obviously it's going to depend on how many, how big, whether items are reused etc but would be great to get an overview of other peoples general approach.

Thanks is advance!

This topic has been closed for replies.

2 replies

Inspiring
November 7, 2011

If your object pooling (creating assets up from before game play), I don't think there is any performance gain from embedding or loading a bitmap from an external source, with the exception of file size if your loading tons of bitmaps and dont want to package them with the application. I could be wrong though!!!

In my opinion, once you create a new bitmap instance, and its on the display list or ready to be used, it shouldn't matter how you had retrieved it..( i think)

Depending on what your doing, you may want to load your bitmaps first to store in memory (create a pool)...  if they are going to be used soon enough that is.

for example if you have a mario brothers type game with character and recyclable enemy's,coins,terrain pieces... I would recommend to create them all at the start of the level. You don't want to be creating new...() instances during game play, but do you want EVERYTHING in the app created up front? most likely not.

My personal "technique" is to pool all my game objects up front. If the user goes into the game menu, i am often creating new instances/bitmaps at that time, then calling dispose() and setting things to null when the leave the menu to attempt to save memory.

Message was edited by: boat5 // spelling

timdiaconAuthor
Known Participant
November 7, 2011

Having done some more research into this over the weekend I'm now wondering whether I should be loading the bitmap assets at all or embedding them at compile using the Meta Embed tag?

Can anyone offer some advice on the best way to manage bitmap assets on mobile devices, should I load them in and if so when or should I load them or should I embed and if I embed how do you manage different screen resolutions etc

Any advice much appreciated!

relaxatraja
Inspiring
November 7, 2011

Only load the bitmap whenever you want and use the loader to load from external source. So optimization will remains there.

timdiaconAuthor
Known Participant
November 7, 2011

Hey thanks for your reply. I've read a lot of people suggesting that the assets should be compiled into a swc - do you think loading when needed is better than that approach?