Flash -> Android

Discussion in 'Game Development (Technical)' started by andrew, Feb 9, 2011.

  1. andrew

    andrew New Member

    Joined:
    Jan 14, 2007
    Messages:
    487
    Likes Received:
    0
    So, I just released my first Android port, done via the new Flash Builder (Burrito) beta - Monomaze. Will have to wait to see how it sells, but it was an interesting experience and I figured I'd write up a bit about how it was done, in case any of you Flash people are interested in taking the leap.

    Basically, the new version of Flash Builder lets you publish to newer Android devices (anything that has like 2.1 or later). It makes a native APK which can be sold in the store, and does all the certificate signing crap that's required.

    There are various weird bits, but nothing too terrible to port, once you get the hang of it.

    #1 You must have a real device. The emulator is *ridiculously* slow, and is only useful for doing last minute sanity checks. If you have an Android phone, you basically just plug it in via USB, and Flash Builder will run the app on your device. You can debug, step through calls, see trace outs from the phone in the IDE, everything you'd need.

    #2 You have to be careful with performance. Layered alpha is slow, vectors can be slow, you don't want to constantly memory-thrash, etc. That being said, if you're smart you can get a surprising amount of performance out of the device.

    #3 Android apps natively multitask. That means your app is ALWAYS running, even if they go back to the home screen and think that they've exited the game. You need to handle Event.DEACTIVATE and basically turn all your processing off, so that it doesn't eat up battery/CPU in the background while they're doing something else. Also, things like looping sounds need to be killed, otherwise they'll keep playing when you get incoming phone calls!

    #4 It's a touch screen. Mouse-overs obviously won't work, and your hit areas need to be about 40-50 pixels square to be usable. It does register hits all the way to the edge, so you can be smart about your real-estate.

    #5 Almost all decent Android phones operate basically the same resolution (480x800). This is a very good thing. A few ones like Droid X/Incredible are slightly longer, but you can just center your display and put slim black bars on the sides instead of re-scaling. Tablets require big changes, but you can actually specify in the store that your app isn't designed for tablets and it'll only display at native (small) res. The built-in previewer does at least handle putting the app in the right size window for local testing, so you can do a lot of development without having to constantly deploy to the device.

    #6 Documentation is a bit sparse at the moment. Once you get to the point where you have to package an app up for the market, you'll be staring at your android-app.xml in confusion. Adobe wraps the Android XML's in their own system, which isn't fully documented, leaving you to fumble around a bit to do things like forcing the app into landscape mode, or properly including icons in the package.

    #7 You can set the app to require full HTTP access, so many third party packages will still work. I got Playtomic leaderboards to work with only an hour or two of fiddling.

    All said, I think the entire game port took about 20 hours, and that's with adding new features and redesigning the UI for the different screen resolution. If you have an existing Flash title, it's a good way to get a sellable standalone app in the store, while still maintaining good performance.

    - andrew
     
  2. Chris Evans

    Moderator Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,162
    Likes Received:
    0
    Thanks for the write-up!

    I was contemplating porting one of my Flash games to the iPhone and I wasn't even aware that it was possible to port to the Android as well.

    I have a question, I do all my Flash games in 640x480. Will it be hard to port to the mobile resolutions?
     
  3. Jack Norton

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    5,130
    Likes Received:
    0
    A bit OT, but how's Android market anyway compared to iPhone? I didn't hear particularly good things, like most apps going ad-based because of insane piracy...:eek:
     
  4. lennard

    Moderator Original Member Indie Author

    Joined:
    Jan 12, 2006
    Messages:
    2,390
    Likes Received:
    12
    Very helpful, thanks Andrew. I'm not sure that my games will work with that platform but I'll remember the info. just in case.

    Do the android phones support a stylus? My iTouch doesn't so I can't do very accurate small button clicking.
     
  5. electronicStar

    Original Member

    Joined:
    Feb 28, 2005
    Messages:
    2,068
    Likes Received:
    0
    This was just the kind of info I was looking for. Thanks
     
  6. andrew

    andrew New Member

    Joined:
    Jan 14, 2007
    Messages:
    487
    Likes Received:
    0
    Chris - My game originally was 640x480 as well, I just moved some UI and other things around to stretch it horizontally to 800 wide, and then locked the game to landscape resolution (800x480) so it was pretty easy.

    Jack - Hard to say at the moment. In the US the install base has now surpassed the iPhone. Google's app market isn't as polished as the App Store, but Amazon is about to launch theirs which should be considerably better.

    Lennard - Normally it requires touch, but it seems people have built new styluses that simulate the human finger and actually work now.

    - andrew
     
  7. Julio Gorge

    Original Member

    Joined:
    Nov 26, 2005
    Messages:
    152
    Likes Received:
    0
    Yes, it's insane. If your game is mildly popular, a paid to pirated ratio between 1:5 and 1:10 is common.

    @Andrew: Thanks for the writeup, very interesting!
     
  8. vjvj

    Indie Author

    Joined:
    Sep 25, 2004
    Messages:
    1,732
    Likes Received:
    0
    This is really good info, Andrew. Thanks for sharing.
     
  9. stanchat

    Indie Author

    Joined:
    Aug 30, 2004
    Messages:
    375
    Likes Received:
    0
  10. Maupin

    Original Member

    Joined:
    Jun 28, 2006
    Messages:
    1,183
    Likes Received:
    0
    Thanks, Andrew! Really appreciated.
     
  11. Karja

    Original Member

    Joined:
    Dec 5, 2004
    Messages:
    232
    Likes Received:
    0
    Thanks! Very useful info :)
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer