The ordeals of porting to mobile


Ubiquatopia isn’t very resource-intensive (advantages of having average graphics at best), and given it is a slow-paced strategy game, I thought it would feel right at home in a mobile platform. I’m creating it in Unity, which has specific utilities to directly port to Android, so it should be easy. It’s just clicking a button, really.

So I built it, which was indeed just clicking a button, and passed it to my Android (luckily I already had the Android development toolkit installed in my computer, so that saved time).

So I run it and… the very first screen has graphical glitches. Okay, that’s understandable. I’m using some weird shader where I use a signal noise to create kind of fuzzy “shadowy” borders, and I’m guessing that shader doesn’t translate well to Android. It’s fine. It’s non-fundamental, I could remove it if needed.

So I start the game and… I cannot move. Well, obviously. I only have keyboard controls for the exploration part of the game, so I clearly need to implement touchscreen controls. I opted for the classic on-screen joystick. Getting its dead zone to respond properly was anything but fun, but other than that it wasn’t that much of a headache. I’m still not entirely happy with how it feels, though.

Now that I can move I decide to enter a battle and… of course, battle has a wholly different set of controls. Now, Unity automatically translates computer clicks into mobile taps, but that doesn’t work all that well. Normally I use mouse hovering to show information on units, cards and the like, and clicking to actually select the unit or card, but there is no “hovering” on mobile. I will have to implement some behavior like tapping once to show info and tapping twice to actually select it.

And that’s just the start of it. I have to also take into account other controls like cancelling orders, zooming or scrolling around, ending the turn, showing unit info, and so on. I might have to create actual onscreen buttons for some of those commands, since there are only so many ways a user can interact with a touchscreen otherwise.

And then there’s every other menu in the game, which I will also have to adapt. Other than actually opening the main menu (by adding an onscreen button, I suppose?), I have to deal with the map screen, the deck edit menu, all the alchemy menus, the collection menus, and a few other specific menus. Thank goodness most of the input behavior for those menus is shared.

Also, I just now realized that I also have to modify the in-game tutorial for Android. So that too.

And then after playing for a bit I reach my first cutscene, and, lo and behold, no characters appear. I’m debugging this right now to try find the problem (I’m actually writing this to make time while the build finishes, since it takes roughly half an hour). My best bet right now is that this is either a positioning problem, some camera or canvas issue, or some issue with some shader. I really hope it’s not the last one, because I wouldn’t even know where to start. (Quick edit: It’s none of those. It’s a stupid formatting error with the XML Reader. Beautiful.)

All of this, of course, also means that I need to learn how to debug in a mobile platform with Unity, which is actually not that bad. For future reference for myself (and anyone else this might help, I guess):

  • Download the Android SDK and NDK and assign them to Unity (Edit > Preferences > External Tools). Get the Android SDK command line.
  • When building with Unity for Android, make sure to check “Development Build” and “Script Debugging”.
  • Connect phone via USB (after enabling debugging in phone and whatnot).  In the Android SDK command line, run “adb devices -l” to ensure that the phone is detected.
  • Run “adb logcat -s Unity DEBUG” in computer before the app is launched in phone. Then, launch the app. Any Debug.Log in the phone should appear on the computer.

There’s also the issue of resolution. My phone just so happens to have the same resolution as my computer, so I’ll have to deal with alternate resolutions somehow else. I’m still not even sure how to test this.

So overall this is going to be very time consuming but I think I know what to do and how to do it. Mostly. Now it’s just a matter of actually putting some time into it.

Get Ubiquatopia

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.