Skip to main content
Participating Frequently
July 24, 2012
Question

Recommended way to handle a serious number of assets?

  • July 24, 2012
  • 22 replies
  • 6850 views

Hi, at my company we are developing a number of commercial games for mobile devices. I can't give many details about the project due to agreements with potential publishers but I would like to emphasize that this is a large, serious project, with a lot of 2D art.

According to what we saw in many documents from Adobe, we are embedding everything in the project. At the beginning everything went fine, but as the game grows, we are facing multiple serious problems:

  1. "Java heap space" error - It seems the compiler is somehow not ready to manage the amount of embedded resources we have. We have a lot of art and resources but it is not THAT much. If Adobe wants developers to use their tools for real games, it should accept this amount of resources and many more...
  2. Memory footprint - The memory used by the game, even in the main menu, increases as we add new levels. This is a serious concern in older devices like the first version of the iPad, iPhone 3GS or similar Android devices.

So, we would like to know from someone from Adobe that can explain what's their opinion about this problem and what solutions can they offer.

NOTES:

  1. Yes, we have increased the memory allowed for Flash Builder to use, but we don't think this is a real solution. It may work for our game with 30 levels, but what if we decide to add 100 more? This is not scalable and it's far from acceptable in a professional environment.
  2. We are currently investigating the option to use the Loader class to load and unload resources as needed. However, we have read that you can't access the resources "exported for ActionScript" and that it just loads whatever is in the stage. Is this true?
This topic has been closed for replies.

22 replies

Inspiring
February 5, 2013

Is it really, really needed to have all of the assets embedded? Have you thought of externally loading them? I mean, it is mobile devices you're developing for, not computers, they have low processing power. Of course the app will slow down if you embbed loads and loads of assets at runtime.

thomas_screenname
Participating Frequently
February 5, 2013

hey ninshim,

that's exactly what I was saying: best practices to have external assets and have them downloaded after the 1st run.

Known Participant
July 25, 2012

If your memory useage keeps increasing as you travel from your menu through each level, make sure that you are disposing of your items properly.  I found that my memory useage in a LARGE iOS/Android RPG that I am making was creeping up.  I ran the profiler in Flash Builder and found that I was not disposing of my objects correctly (removeChild is not enough).

Basically, you want to get rid of ALL listeners and any objects that may connect the object to its parent object, removeChild, and then null the object.

Once an object is "cleaned" up this way the garbage collector can mark it and let it go.

I hope this helps.

PS - How large is your packaged file?  My Android APK file is about 66MB and therefore UNUSEABLE in the Google Play store.  APK files must be <50MB and there is now published way for apps created with AIR to package additional data into the expansion files allowed by Google.  I've been hunting around this forum, calling and emailing support with virtually no response.  YAY.

GOOD LUCK.

mSantirsoAuthor
Participating Frequently
July 25, 2012

This is not a memory leak issue. The memory usage grows just by adding new embedded files. We have confirmed this with an empty project.

As for the size of the apk, it's around 40 MB. As far as I knew, the apk size limit has been increased recently from 50MB to 4GB. I will investigate further to verify this; if the limit were 50MB that would be a problem.

Known Participant
July 25, 2012

If your APK is larger than 50MB, the Google Play store will not accept it.  You can bundle additional files up to 4GB in two separate expansion files as described here:

http://developer.android.com/guide/google/play/expansion-files.html

I have yet to discover how to do this using Adobe AIR.  If you figure out a way, please share it here.  I've asked about this in 3 separate forums here, filed a bug report, called and chatted online with tech support.  No one has answered this yet.