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:
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.
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.
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.
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:
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.
My company has invested a lot of time and money creating an iOS mobile game using AIR and GPU Rendering.
Everything was going fine, but now that the assets are creeping above the 50MB mark, we're getting Java Heap Space issues and 2+ minute compile times.
Yes, we have increased the memory allowed for Flash Builder to use, but as also stated above by mSantirso, this is far from acceptable. We've had to increase to 1GB to compile 50MB worth of assets, but the game is only one quarter complete. Does that mean by the end of the game, Flash Builder will need 4+GB of RAM to compile?
Can someone from Adobe please respond to this issue? This is a serious oversight in the AIR Mobile workfllow and will be a major deterrent to any studios considering using AIR or Flash for commercial game development.
OK ... I understand what you are talking about now. My app is ~70MB is size ... but when it runs it gobbles up 130MB of RAM. If I delete ALL the code in the document class, and keeo all of my files in the libraray ... it still hits over 100MB of RAM usage.
Basically, just adding files to your project increases the RAM useage as if everything in your project is loaded into RAM when your app launches. Not good.
@distropolis - nope, not talking about RAM usage of the game. The issue is that Flex Builder fails to compile mobile apps that embed a large amount of resources because the IDE itself runs out of RAM and throws a Java Heap Space error.
I've spent a couple days working on creating automated builds for our project using ANT and the COMPC, MXMLC and ADT SDK tools. This way, I can assign as much RAM as I want to ANT, and I can now successfully compile the app (note, the final IPA file is only 100MB, so Flash Builder falls over before being able to compile a relatively small IPA).
I'm happy now, the command line tools are more flexible and our game is no longer at risk. I've setup the Flash Builder project so that it compiles the app using low-res assets, thus keeping the memory usage down to prevent compile fails and I can at least still debug the code.
Thanks Adobe, your products are great and I'm sure Flash Mobi apps will really take off in a serious way once the tools are a little more robust
Ok, that workaround helps with the Flash Builder issue. However that does not solve the most important problem: All the embedded assets are using memory while the game is running on the device. That causes a lot of problems (app crashes) in older devices like the first iPad, iPhone 3GS or many Android devices...
we have the same problem here, our code is not that big, I reckon we can compile an apk/ipa and stay well below 40mb, but we need to load roughly 400mb of external assets, and we def. cannot squeeze everything inside one image.
has anyone found a solution for this?
We're loading several hundred MB of external assets in our iOS game and not having any problems with Flash Builder crashing, but we're not embedding much in the actual app (our SWF is only 4MB) and we create our IPA using ANT, not in FB.
Embedded assets will eat all your memory and will ruin your app - load everything at runtime and build with ANT and you'll be fine.
Also, you should run all your PNGs through PNG Quant: http://pngquant.org/ - that might help bring your file size down
thanks for reply. sorry, might have been miscommunication from my side, I don't have any problems creating the ipa/apk (btw we're using fdt) it's just that I understand that the limit for the ipa/apk is 50mb, and we have roughly 400mb of video assets that we need to import. we can push encoding parameters a bit, still we'd need to provide these assets as a separate download, e.g. android expansion files and couldn't find a decent way to do it.
please advice if possibile, many thanks in advance
Where did you hear bout this IPA limit of 50MB? Our IPA is 160MB and runs fine on iPad/iPhone, and from what I can tell, Apple will allow IPAs up to 2GB in size.
Check out this thread: http://forums.adobe.com/message/4234328
Does that help?
He was half right. Both Apple and Google have 50 MB limits for what can be downloaded over cellular, but also, with APKs there is a limit of 50 MB for what is in the app that people download. Anything over that has to be downloaded as a separate package, with its own agreement that you have to go into with Google.
thanks again for replying so quickly. so the thing is:
- apple allows ipa sizes up to 2gb in total, but won't allow to install the app over mobile networks if it's larger than 50mb (fair enough)
- androids market doesn't allow apk larger than 50mb, and all external resources must be loaded as expansion files (here's the ref: http://developer.android.com/google/play/expansion-files.html)
no one of course is telling anything about real-world best practices, e.g. interactive experiences with high-quality assets, let alone code examples to handle additional resources download using air for ios/android from different sources.
Not sure what you mean re: best practices, e.g. interactive experiences with high-quality assets
I assume you mean, best practices around handling hundreds of MB's of assets? It would seem that best practice for Apple App Store is to embed it into the App itself, since you have up to 2GB to play with. If you want you app to be downloadable over WiFi, you'll have to load your assets from your own web server at run time, but this will obviously lead to user-experience issues when a player doesn't have an internet connection, or a slow connection.
I have no idea about setting up seperate asset packages for the Google store - have you tried researching this topic on the Google play website?
thanks for reply. yeah, that's the point, since we're packaging both for ios and android we'd like to provide a consistent experience. apk are limited to 50mb + expansion packs, and we're doing a bit of research on it, while ipa larger than 50mb must be downloaded from wifi only. hence the idea of having a core app only with logic and basic assets, and provide in-app logic to download the content
I'll post here what we implement once we define the overall ux and start coding the elements.
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.
That's the obvious solution. However, there's a limitation in AIR for iOS that makes it impossible to load (and later unload) a SWF containing multiple MovieClips exported for ActionScript. If you want to load and unload assets depending on what the app is doing, you are limited to loading images and simple SWF files (everything in the stage). In games, for instance, you can easily have hundreds or thousands of animations... You would need to export each animation as a separate SWF file, making it impossible to reuse shapes through different animations of the same object.
Yeah, limitations on loading SWFs in AIR Mobi is tough, which is why I've switched to Starling. I use PNG spritesheets for all animations now. You can even animate in Flash and export to spritesheets for use with Starling.
That's ok for some games. Other games (like the one we are developing) have too many, too big large and too long animations to use spritesheets. It would be impossible for us to fit the spritesheets of the animations of just one level in the 50MB we can use for the .ipa file.
For these reasons (and some others) we switched to Scaleform for Mobile.