People have been asking me if When Pigs Fly will ever come to mobile ever since the initial game jam release. I have always quickly dismissed the question, assuming that the performance would be too poor to be worthwhile. For my Sunday experiment this week, I decided I should confirm my doubts. The results were pretty surprising. In fact, on one device, the game ran better than it does on the laptop I use to develop it.
One of the great things about developing in Unity is how easy it is to build for different platforms. I had the game running on my phone about 10 minutes after deciding to do this test. Another 10 minutes and 8 lines of code later, I had the camera and flight controls working using the phone's touchscreen and accelerometer. Unity, like everything, has strengths and weaknesses, but in this instance it simply can't be beat.
Before I get in to the numbers, I want to take a moment to point out that I did no optimization for mobile. The graphics settings, models and shaders are all the same. The flight model and physics settings are unchanged and running at 60fps. This is the full desktop version of When Pigs Fly running on mobile.
I started out with the best case scenario, running on an iPhone 6 Plus (the most powerful mobile device I own). Much to my surprise, the game ran great. The Xcode profiler showed the framerate locked at 30fps, with absolutely no dips or stutters. Even when flying near the new bomb targets and activating their second camera overlay, the framerate didn't dip for an instant. I went back and upped the target framerate to 60, ran it again, and had the same awesome results. Steady 60fps, on mobile with no optimization. My laptop can't always manage that, and it runs at a much lower resolution than the phone! (It may be time to upgrade).
This was pretty encouraging, but I wouldn't be comfortable putting out a game that only ran on the very latest mobile device. So I pulled out my old iPhone 5 and gave it a whirl. It managed to maintain 30fps most of the time, occasionally dipping into the mid-20s. With a bit of optimization, I'm sure I could get it to stick at 30.
It appears When Pigs Fly is light enough to run on mobile after all. There are still hurdles, like a complete overhaul of build mode. While the current system is partially functional with a touchscreen (I was able to add a couple of lawnmowers to the Warthog), its extremely difficult, tedious, and error-prone. It also doesn't support rotation or part actions. Build mode on mobile would require a completely different UI than its desktop counterpart.
The results of this Sunday Experiment are encouraging. I can't say for certain that I will port When Pigs Fly to mobile, but it certainly looks like a much better possibility at this point.