RPG MAKER MV TO ANDROID PROJECT

Now un-neutered and stuff

  • TehGuy
  • 09/16/2017 04:40 PM
  • 8850 views
NOTICE: No longer under active development
Please give a look at this project here if you would like to move MV games to Android. Should you need Google Play stuff, follow the guide in that previous link but use my google play services branch of the project. If you need OBB/Expansion support, well, read on at your own peril; this hasn't been updated in forever so some things will have changed

---------------------------------------

Heya folks, guess what time it is? Time to actually get your game on mobile in just a few steps! But first, a few things

REQUIREMENTS
  • Android Studio (1.9GB+ download, and that's before the needed SDKs and build tools)
  • Dev options enabled on your phone
  • Java JDK
  • Whatever Android SDKs and APIs Studio complains about you not having installed when you try to build the project
  • The project itself which should be linked on this page


Things You Should Probably Add To Your PATH Variable
  • %ANDROID_SDK_INSTALL_LOC%\tools\bin
  • %ANDROID_SDK_INSTALL_LOC%\tools
  • %ANDROID_SDK_INSTALL_LOC%\platform-tools
  • %JDK_INSTALL_LOC%\bin


It just makes it easier to call tools and things you'll probably be needing via command prompt or power shell or whatever you're using

Things To Change If You Just Want An APK
Open the AndroidManifest.xml under the android project, change the string in package="org.rpgm.main" to whatever you want; resync the project or invalidate cache and restart so the change happens.

IMPORTANT!!: take the <intent-filter ...> </intent-filter> flag from Lines 43 - 46 and MOVE it under Line 33 if it's not already there or else your program WILL crash trying to access google play stuff



Deploy your MV game as Android/iOS and follow the README in this project's assets folder.

Read how to deploy your APK and how to sign it with your key

Expansion Files?
Hey now you get to shove all the big junk in an expansion file so the main APK stays under 100mb! That means you get to be on the Google Play Store. Take the audio, img, movies folders and move them somewhere else. Why these folders? 'Cause they hold the largest amount of data in your whole game between audio and img alone, so they get to go in the file that get's to be, like, 2GB in size

You're gonna thank me if you added those directories up there to your PATH because it makes this a bit easier. Look up how to use the JOBB tool in Google's documentation. Pay close attention as the -pv and -pn options will determine whether or not your app can open it, so don't get those wrong

Here's an example
author=me
jobb -pn org.rpgm.main -pv 1 -d "%some_path%\main_extension" -o "%some_path%\main.1.org.rpgm.main.obb"


The output file should go on your phone/device (NOT THE SD CARD) under the Android/obb/%your_package_name% directory. Don't worry about how others will get the OBB file, you upload it to the Play Store with your APK and Google should serve the file when the main thing gets downloaded

For more info on expansion files, naming, and locations, consult this Google Dev page on the matter.

Head over to the Android Studio project and open up MVExternalStorageManager.java (android > java > org > rpgm > filehandling) and Line 14 should look like this
private static String obb = "main." + BuildConfig.VERSION_CODE + "." + BuildConfig.APPLICATION_ID + ".obb";


Change "main." + BuildConfig.VERSION_CODE + "." to "main.%version number you chose as -pv%." so the app goes looking for the right obb

NOW go to your outputted game and run under the js folder. The script you're looking for is rpg_managers.js as this handles how things load up.

Replace it with this version

Now just follow the rest of the steps under the "Things To Change If You Just Want An APK" header

Important Js Commands For Your Game
Need to open the achievement window in your game? Use
try{
gameInterface.showAchievementWindow();
}
catch (err){

}


If the window doesn't appear, then you are not connected to Google Play Games services

Need to load in some file that isn't handled by MV and is in your OBB file? Use
exposureInterface.getMountedOBBPath(%path%)

Note that %path% is the relative path in the OBB file, so if you have "lol.jpeg" in the top level you'd just call exposureInterface.getMountedOBBPath('lol.jpeg'), if it's in a folder you'd call exposureInterface.getMountedOBBPath('some_folder\lol.jpeg') and so forth

What If I Want Google Play, Too?
Go in the android module and look under res\values. Open strings.xml and go to the very bottom where there's a USER_CHANGE value. Follow the instructions in the comment right above it to set that.

Now go to ids.xml. If you've already got your stuff set up on Google's Development Console then take your appid from that and replace USER_CHANGE with it.

If you want achievements, look up Google's documentation on the matter as I'm only going to really go over what you need to modify to get your project going. Just replace the string in name="SOME_ACHIEVEMENT" and replace SOME_ACHIEVEMENT_ID with your's, add more entries as needed.

NOTE: Google Play is kinda touchy at times, you may have to debug the program or at least hook up your device to your PC to get Logcat entries that may help. Generally, you may have mistyped an ID somewhere and it wont let you in so check those first

To Conclude
At the end of all this, you should have a proper APK that can also be expanded with other features if you so choose (and provided you figure out how Android works with the API) and is ready to go on practically any store if you decided to use expansion files.

I may have missed some stuff and, if I have, I'll update this accordingly. If you feel I haven't explained something fully (which is a possibility 'cause I can't document for the life of me) then do ask about it so I can go back and expand upon that part (which helps everyone else)

Sample App
Here's a test app I threw together to show some of the points; achievements currently don't pop up when unlocked but as long as you can pull the achievement window up then unlocking one should work

Important part: the code in the GitHub is licensed under the Apache License 2.0 which really just means that if you use the project then you should at least credit me somewhere. You could stick my name in some txt file or somethin (or maybe in the game >-> ), I suppose, but just dont go out and say that all of this was your stuff :3

Changelog
This is kept by the repo's releases page since I think this is already long enough and there's no need to duplicate info

Details

  • Offsite
  • N/A
  • Never

Actions

Posts

Pages: 1
TehGuy
Resident Nonexistence
1827
author=sanggameboy
Can you show me where to replace codes in rpg_manager so the expansion files work? The engine keeps updating so there could be some changes to the original rpg_manager.js. And if the replace file you gave was from an older version of RPG Maker MV, I afraid it could occur some unwanted errors.

Heyo, this isn't being maintained any more and I had posted on the related thread (though it seems like I forgot to change things here) that it has been supersceded by: https://forums.rpgmakerweb.com/index.php?threads/exporting-to-android-mv-android-client.84971/

which doesn't need you to replace things in the Js files. Now, if you need OBB/expansion support, you're still stuck with this currently and you'd be looking at

Line 881 (entire function)
ImageManager.loadNormalBitmap = function(path, hue) {
    var key = this._generateCacheKey(path, hue);
    var bitmap = this._imageCache.get(key);
    if (!bitmap) {
        if(exposureInterface.checkPath(path)){
			bitmap = Bitmap.load(path);
		}
		else{
			bitmap = Bitmap.load(exposureInterface.getMountedOBBPath(path));
		}
        bitmap.addLoadListener(function() {
            bitmap.rotateHue(hue);
        });
        this._imageCache.add(key, bitmap);
    }else if(!bitmap.isReady()){
        bitmap.decode();
    }
	
    return bitmap;
};

Line 987 (entire fuunction)
ImageManager.reserveNormalBitmap = function(path, hue, reservationId){
	var obbPath = exposureInterface.getMountedOBBPath(path);
    var bitmap = this.loadNormalBitmap(obbPath, hue);
    this._imageCache.reserve(this._generateCacheKey(obbPath, hue), bitmap, reservationId);

    return bitmap;
};

Line 1117
AudioManager._path           = exposureInterface.getMountedOBBPath('audio/');

Line 1825
Graphics.setLoadingImage(exposureInterface.getMountedOBBPath('img/system/Loading.png'));

At least as far as changes between the posted Js and the current MV one; I currently don't know if changes like this need to be done elsewhere.
Can you show me where to replace codes in rpg_manager so the expansion files work? The engine keeps updating so there could be some changes to the original rpg_manager.js. And if the replace file you gave was from an older version of RPG Maker MV, I afraid it could occur some unwanted errors.
Pages: 1