Apportable SDK ported Space Cups game

Discussion in 'Public Game Developers Forum' started by energy, Jun 6, 2013.

  1. energy

    energy Active Member

    Apr 9, 2012
    27
    0
    0
    Hey guys,
    We recently ported our iPhone game Space Cups using Apportable SDK. Game is now available in Google Play store, so you can check it out and compare with IOS version.

    [​IMG]

    iTunes:

    [iPad version] https://itunes.apple.com/app/space-cups-hd-find-ball-under/id493857716?mt=8
    [iPhone version] https://itunes.apple.com/app/space-cups-futuristic/id459514312?mt=8

    Google Play:
    [Android version]https://play.google.com/store/apps/details?id=com.estoty.SpaceThimblesHD

    If you are interested to port your Cocos2D game in future to Android - Apportable SDK looks promising to support most of the functions out of the box.

    [About our game porting process]

    "Space Cups" game was made using Cocos2D 1.x framework for IOS devices.

    Additional IOS libraries/classes we used in our game:
    - Admob SDK - showing Ads
    - Game Center - players achievements/results
    - In-App Purchase helper - manage in-app purchases
    - Flurry, Localytics - gathering stats about played levels
    - Reachability Class - easier to check if is available internet on user device


    To port our application we have used http://apportable.com tool (Free version) . Installation took 10-15 minutes, by copy/pasting shell command to MAC terminal (shell script downloaded Apportable SDK and installed additional tools).

    So in 15 minutes you are ready to go.

    To start porting you need to navigate through terminal into Xcode project main folder and execute console command:
    Code:
    apportable load
    This command launching Apportable SDK system and starting your project code compilation to APK, it take ~1 minute to compile full project and compilation progress you can see in console. As expected first conversion run of SDK wasn't successful, got notification in console that there is problem converting Reachability class can't, so we excluded it from project and adjusted few code lines where it was in use, added static stubs return YES/NO.

    Next error we received was about Localytics and Admob SDK's, after checked Apportable documentation(they recommend to exclude third party API's for now). Or top priority was to get working version of the game in Google play store to see how it works on Android device, so we decided to remove third party API's from project and check for equivalent solution later.

    Code adjustments took 5-10 minutes using Xcode, it was quite easy to do because after removing Include to SDK, Xcode pointing you to place where SDK code was in use.

    It was amazing in 30 minutes after first time we visited Apportable site, we got working APK file on our Nexus 7.

    To test ported application you just need to connect Android device in USB debug mode to your MAC and Apportable SDK after compile automatically will install APK file on it. After first tests we decided to upload in Google play to see how it performs there - if APK passing Google Play store validation. What I can say :) first upload wasn't successful :) Google Play showed notification that APK file is not signed with correct key - it is in debug mode - after checking apportable documentation we found out that we need to generate key with simple command and use this key to sign game for Google play.

    There is instruction to prepare your app for Goole Play store:

    1) Generate sign key for app to terminal/console paste:
    Code:
    keytool -genkey -v -keystore release.keystore -alias mykey -keyalg RSA -keysize 2048 -validity 10000
    After completing this command you will get file named "release.keystore" - keep it, because it will be needed to update your application in future.

    2) You should set Apportbale SDK system variables to link your generated aign key before compiling release APK file. It is done by using following commands:
    Code:
    export ANDROID_KEYSTORE=/path/to/your/keystore/release.keystore
    export ANDROID_KEYSTORE_PASS=password_used_whene_generating_key
    3) To build APK and sign it with your key run console command:
    Code:
    BUILD=release apportable load
    You are ready to upload it on Google Play :)

    Some tweaks before generating APK file:

    Game resolution, by default it is not scaled to fit full screen, our game was ported from iPad game version, so graphics took only 80% of Nexus 7 screen. After checking documentation there was solution to make game work in full screen and adjust game resolution for any required device. We have added following code at the top of applicationDidFinishLaunching function in AppDelegate.m file

    Code:
    #ifdef ANDROID
    [UIScreen mainScreen].currentMode = [UIScreenMode emulatedMode:UIScreenIPadEmulationMode];
    ifdef
    Implement Exit button on Android, added this code to RootViewControler.m file :

    Code:
    #ifdef ANDROID
    - (void)buttonUpWithEvent:(UIEvent *)event {
    switch(event.buttonCode) {
          caseUIEventButtonCodeBack:
         // handle back button if possible, otherwise exit(0)
         exit(0);
          break;
          caseUIEventButtonCodeMenu:
         // show menu if possible.break;
          default:break;
          }
    }
    - (BOOL)canBecomeFirstResponder {returnYES; }
    ifdef
    
    Little summary for Apportable SDK:
    - Apportable SDK stating as beta so you can expect some problems when porting gane but mostly everything works our of the box.
    - You can get help from Apportable Developers by posting on StackOverflow forum, don't forget to link tag "apportable"
    - For now SDK not supporting non ASCII characters in file names, so if you get error "UnicodeEncodeError:'ascii' codec can't encode character u'\u0421' in position 58: ordinal not in range(128)" it's mean you have non ASCII character in your filename :) we found out that on same stage by mistake user Russian C letter instead of Latin C :)
    - Seems there is problem with reading plist files where in filenames is spaces, so you should remove them.
    - Fonts extension should should be in lowercase: .ttf instead of .TTF
    - Sounds extension in Cocos2D code should match real extension to work properly on Android. We had .aif in code, but real was .m4a - worked fine on IOS on Android not problem.
    - Icons is taken from Xcode project by default so don't worry about them
    - Port from Cocos2D to Android is real :)

    Future plans:
    - Fix bugs if you will find them :)
    -Make adjustments in game to support - Ads and analytics tools
    -Port our other games: Swipe Bo and Swipe Bo Xmas
     

Share This Page