Building Android Apps using Adobe AIR - android

I am building an android application with Adobe Flash cs6 and Adobe AIR for the first time. Initially it looked good but later I faced a lot of problems. What I have till now is more of movieclip and less as3 coding. My app scales automatically according to different screen sizes. However since there are more movieclips my app somewhat lags in Kindle Fire. My question:
1. Do I need to convert my movie clips to Bitmaps or something? How is that done?
2. While converting to bitmap, do I need to specify width and height of the movieclips? Doesnt it get scaled automatically acc. to screen size?
Well, I am new to actionscript, AIR and stuff... so any help would be appreciated.

All display objects have 'cacheAsBitmap' and 'cacheAsBitmapMatrix' propertiues that help with performance, but only for certain class of objects (primarily those not frequently changed).
More info: Caching display objects
Also, make sure you have HW acceleration turned on for maximum benefit, especially on mobile: HW acceleration

Related

How to migrate from flash to adobe air iOs and android?

I have a few projects with flash that i'd like to turn into apps for mobiles, I started reading adobe air and i've noticed that it uses back some things like inframe action script, something that I have not done since as2.
Is there a way to load scripts and classes like a normal flash file?
If I have a noncomplicated swf, is there a way to migrate it easily into adobe air for android and iOs?.
I've been struggling to find examples of adobe air projects, does anyone have a tip for this?
It is easy. I have converted 30 games to run on iOS and Android. The biggest problem was that they were in AS2 and had to be converted to AS3 first. If your uncomplicated swf projects are in AS3, and developed using Flash Pro, then just change the publishing output from swf for a web page to iOS pr Android. Android would be easier to start because you don't need to get an Apple developer account, create a certificate and provisioning file. With Android you can create a certificate right in Flash Pro. You test publish on your pc or mac first. When you are ready to test on a device you create an ipa (iOS) or .apk (Android).
Yes, there are a lot of screen sizes out there. But you know how you can create Flash in a web page so that it will resize with the page and keep its aspect ratio? Well its the same on mobile - it will resize to fit whatever mobile screen it displays on. Most likely your game is in landscape orientation. Just keep it that way and test it on whatever device you have (an iPad would be good because that aspect ratio or 1024 x 768). Actually, we kept the stage to 736 x 552 and that fit on any screen out there. On tall (wide) screens like the iPhone 5 & 6 you will have space on the sides, but so what.
Just give it a shot and you'll see how easy it is to write an app for both platforms at the same time. And you don't even have to own a Mac (you only need one to upload your completed app to the store, but you can rent time on one and log into it for 10 minutes to do that.)
There's no "how to" when porting a Flash project to Ios or Android. It's the same technology so it's compatible in theory. You can simply compile and publish and you'll get a Ios and Android app in most cases. Now there's 3 major problems that probably 100% of Flash projects will face when publishing for mobile and in probably 99% of cases those problems might imply recreating the whole thing from scratch.
First problem: Sizing and Density. So many phones/tablets sizes and density, chances are your Flash project doesn't have a single line of code dealing with that and as a result your app won't display correctly across any mobile devices. You'll have to put together a big piece of code to handle that and make sure it doesn't break anything in the original project. Good Luck with that.
Second Problem: Performance and memory management, I'm yet to see a Flash project that doesn't systematically waste CPU and memory constantly. That's no problem for a Flash project except when publishing for mobile: can we still waste CPU power? NO, can we still waste memory: NO. You'll have to go through your entire Flash project and optimize everything to not waste CPU and memory. Once again Good Luck with that.
Third Problem: assets. Did you use a bunch of MovieClip here and there? Well no more on mobile unless you want your app to lag and drain the battery down and make the user experience as bad as possible. All assets have to be optimized for mobile, the right asset, the right type, the right size or else ... lag and bad experience. Here again Good Luck with that.
And this is just a small run down of the problems you'll be facing. You will spend probably hundreds of hours trying to port that Flash project to mobile and at the end it will still be running bad anyway. Chances are you should just start over.
EDIT:
Simple Guidelines:
render mode: usually "gpu" (very efficient with bitmap) but "cpu" is also possible (you get more CPU power but less bitmap display efficiency) and also "direct" if you want to use Stage3D (more complicated).
Display: usually bitmap and only rarely vector. Don't oversize them and don't undersize them either. Reuse as much as possible (saves memory and battery)
Handling sizes and density: scaling your content is the easy way but not the less efficient one, as long as your bitmaps are of good quality you should be able to get a good resolution in most density and size. Because there's so many different sizes out there you'll decide if you want your content to fit any size or to display as much as possible while filling the side gaps. AIR/Flash has no built-in system for handling that so you'll have to create your own or to find something open source out there that can do that. Basically you have a content that is n x n and it needs to display on a mobile screen that is n x n, you calculate the scale factor and scale your content and center it.
perf, memory, battery: reuse object as much as possible. If there's a bitmap that you'll use often don't get rid of it just reuse it. If you reuse you don't need more CPU, don't need more memory and don't need more battery.
how to get perf: displaying something and running code, that's the 2 things that will slow down the app so optimize both and test often. Maybe reducing the quality of some bitmap will boost your perf. maybe optimizing your code in some places will get you a few more fps, etc. This is a per project try and test.

Unity texture poor quality

I've been playing around with Xcode and Unity for a while, and have made an app in Xcode which has a scrolling background. I want to basically re-create the app in Unity 2d, using the same set of images (if possible). I've imported all of the iPad sized images that I used in Xcode, but have noticed that the quality is a lot poorer when I build using Unity remote.
The image I'm most bothered about is the background, which is a repeating texture that scrolls across the screen. Do I have to mess around with the settings in Unity to get a better image quality? I'm using PNG. Surely the image can't be too small and therefore stretching because I'm using iPad sized images and running the app on Samsung Galaxy S6. Thanks in advance.
Unity Remote stream screenshots to your device, so the quality is not the final.
Maybe you can try to change the settings of UnityRemote.
See
http://docs.unity3d.com/es/current/Manual/UnityRemote4.html
More info/same question:
http://answers.unity3d.com/questions/408896/android-image-quality-is-poor-compared-to-the-qual.html
Find you image in Project tab and select it, then you should see something like this in inspector, experiment with values until you get results you are happy with.

Android 2d game engine that supports multi screen resolution

I'm looking for an android 2d game engine, where you can create your game at the resolution you want, and the game will work the same on every phone, no matter the resolution, maybe by auto creating thoose black rectangles.
I was working with libGDX, but i could not find any ways to do that, just some viewport scalling methods, that will make the game graphics quality crappy.
I also used to work with the android sdk using surfaceview, and i had to code everything by a ratio, and also scale the bitmaps by a ratio, but i don't really think that that is a good way to do it.
Are there any android game engines that support every device resolutions?
You are asking for something you won't get. I doubt that there's a tool or engine released to the public that will automagically fix all resolutions possible to fit your needs. This is something that developers has to tackle, and it's a nice thing to handle independently.
Now when working in LibGdx, did you even try to use Texture filters? Linear filtering will smoothen your images when enlarged. They may get some blur but I've released a commercial game using this method.
All in all, i really think you should give it another shot. LibGdx will spare you a large amount of troubles and in my opinion; The request of yours ain't that hard to overtake.

Flash game with android support

I'm making a flash game this week, it needs to be compatable with both PC browsers and Android devices.
I have no problem making two slightly different versions of the game, one optimized for PC and the other optimized for mobile devices. I'm just wondering if there's anything in particular that I should keep in-mind when I'm building the first PC edition of the game, I don't want it to be too difficult to port the game over to android.
One thing that I'm concerned about is the screen size/stage size, should I have the game adjust it's self to fill the whole client area (like a youtube video in full screen) with a dynamic width and height?
Is there anything else that I should be aware of before I start on this? Like specific flaws in the android deployment of flash.
Thanks for your advice on this, it's much appreciated.
There were more number of restrictions when i started developing flash apps for android.
We need the device's processor at least 1GHz [This i am not aware of current situation , coz i am a little busy with xCode]
Screen resolution always plays more role in troubling you. For this instead of using screen size as reference , use the aspect ratio. Use flash.capabilities class's screenResolutionX and screenResolutionY and make your game objects resize them accordingly

Android Surface and ScreenResolution

To put some context, my game has been developped for android 1.5. So it was using the lowest resolution by default on any android phones. Which was great, game was running fast and all.
Now I added support for scoreloop which required my game to support android 1.6. When I runned the game I realized everything got smaller since I used unit dimension without looking at the screen density.
Now that I fixed sizing. I realize that my game seems a bit choppy. I believe that redrawing on the new screen resolution is the problem.
I draw my game in a Canvas in a SurfaceView. How can I make it faster? I use default functions like drawCircle, drawLine... I believe reducing the screen resolution should help since I don't need high screen resolution. I just don't know how or if it's possible.
Or may be doing my drawing in opengl would solve the problem too.
Read this : http://developer.android.com/guide/practices/screens_support.html
You should use the pixel format depending of your needs.

Categories

Resources