Hey guys, I thought I'd share my experience of porting my Windows/Steam game Epic Battle Fantasy 5 to Android, using Flash and AIR. I'm gonna touch on a lot of technical details so that others can hopefully see what I did if they are lost.
EBF5 is a turn-based RPG, featuring around 50 hours of content, 12 languages, and a ton of animations and art assets. I've spent 4 years working on it full-time, doing the design, programming, art and animations myself. Most of the art is vector, so the total size of the game on PC is only around 300MB, with more than half of that being audio.
Here's a quick trailer: https://www.youtube.com/watch?v=jkzRbc2VlXY
The whole game is compiled into a single .swf file that runs on Windows using an AIR launcher app (basically a web page that opens the .swf) - this gives players the flexibility to run the .swf file on a Mac, or in a browser, or even decompile it if they want to, which is useful for modding. The FRESteamWorks ANE is used to add Steam features such as achievements, and Steam's cloud saving requires zero work - just tick some boxes in the console to backup the files in the game's installation folder. Overall, publishing a Flash game on Windows is pretty straightforward once you're familiar with it. However, one major problem for me was that AIR on Desktop doesn't support Stage quality settings, and is locked to high quality - which sucks for games that use vector art. That's the main reason I used the web Flashplayer and some annoying work-arounds - being stuck in high quality more than doubles the minimum system specs required to play my game!
Another problem is that vector graphics are not GPU powered on Desktop, which is a shame, since they are on mobile! I've done tests that show Flash animations running faster on my phone than on my gaming PC! It really makes one wonder what Flash/AIR could have been if Adobe kept working to make it a competitive game engine for 2D Desktop games. Oh well.
So the performance on Desktop wasn't great, but it was good enough, and the game was a success on Steam. But even though the game was not designed for mobile, I started thinking - how much work would it be to port it?
Well... the Windows version runs on mobile with almost no changes! Sounds like a good start!
But there's a few problems. Running the game in GPU mode on mobile handles the vector art very nicely, but this mode does not support filters, and I used a lot of them in my game. Drop-shadow was used all over the UI to make text easier to read, and Adjust Color was used on a lot of background scenery. I had to manually remove all of these filters and reproduce their effects. Flash's "Search and Replace" feature helped a lot with replacing colors and symbols, but this whole process still took several weeks. A bit tedious for sure, but it was fairly relaxing work.
Problem number two was that the game was designed to be played with a mouse. This worked perfectly if the user had a device with a stylus, but I still needed to modify the entire UI for touch controls. This involved making all of the windows, text and icons around 20% larger, repositioning stuff, making sure tooltips could be viewed without the need to "mouse over" icons, and giving the option to zoom-in on some small details. This was a pain to do. I personally hate programming UI stuff.
Problem number three was... just generally trying to improve performance. On a mobile device, a lot of performance issues show up that previously were only noticeable on very outdated PCs. So I started deleting unnecessary animations, removing unused UI elements instead of making them invisible, converting complicated backgrounds into bitmaps at runtime, adding more graphics quality options, and trying to figure out what the general bottlenecks were. Gradually the performance is improving. The game runs smoothly most of the time, but still stutters/slows down occasionally and noticeably. It doesn't seem to be my code or animations that are directly causing it. Adobe Scout shows random spikes in CPU time attributed to strange things like "swf tags" which don't make any sense to me at the times when they happen. I guess I still need to do more tests to try and understand the behind-the-scenes working of Flash content better. But on higher end mobile devices, the performance is already good.
When I finally had a viable .apk ready to send to testers, I encountered problem number 4 - there was a lot of hoops that I needed to jump through to put my game on the Play Store! I was surprised to see that .apks are outdated, and that I must use the new .aab format, which I had never heard of before. Luckily, only a few days later, AIR was updated and could compile .aab files - but it was not easy! I had to update to the latest AIR SDK, get the Android SDK (which I never needed before and was completely unfamiliar with), and get a different version of Java. I had to add the following lines to the adt.cfg file:
DefaultArch=armv8
OverrideArch=armv8
JavaXmx=4096m
CreateAndroidAppBundle=true
AndroidPlatformSDK=D:/Android/Sdk
JAVA_HOME=C:/Progra1/Java/jdk1.8.0_291
I'm using Flash CC 2015 by the way, so that's why the first two lines to force compilation in 64bit were necessary.
Java 16 gave me errors about the Gradle tool when I tried to compile my project, so I tried with Java 1.8, and that did the trick for me. I compressed my bitmaps and audio files to get my game under 150MB, and successfully compiled it as a .aab file! (though it still had the .apk extension, so I had to rename it - the .aab will be bigger than the .apk, so that's how you can tell that it worked)
I signed up for Google to manage my signing key, and uploaded my .aab. Strangely enough, I still got an error in the Play Store console: "Failed to upload". But the file still appeared in the library, so I was able to select and use it despite the error. I set up internal testing in the Play Store console, invited 60 users, and now I'm fixing the problems they report, which fortunately, are mainly related to the changes I explained above - polishing the new UI and fixing the graphics which needed filters.
So far the process has taken me 2 or 3 months, but on a game that originally took almost 4 years to develop, that's not so bad! If I had designed the game with mobile in mind from the beginning, a lot of the issues explained above could have been avoided, and porting could have been done much faster.
The main challenges remaining are implementing ANEs for in-app billing, ads, achievements, and cloud saving - but everything else appears to be almost done, so I'm finally feeling optimistic.