Making Android games

From OHRRPGCE-Wiki
(Redirected from Android)
Jump to: navigation, search

Starting with Callipygous, the OHRRPGCE has support for Android phones and tablets, as well as specific support for the OUYA console, FireTV sticks and consoles, and Gamestick consoles. The OHRRPGCE is open source, so you can freely create free or paid games. There's also experimental support for OUYA in-app purchases, but no support for in-app ads.

Improved support for Android is an ongoing project, but quite a few OHRRPGCE games have already been released in a number of app stores. We support ARM Android 1.6+ devices, which means that your game will run on almost all Android phones and tablets. Distributing to Android platforms can't currently be done through the Distribute Game menu; instead for the moment you will need to contact James for help.

Porting your game[edit]

Really, there are three different platforms that you can consider targetting: personal computers like desktops which have keyboards and mice; mobile devices like phones and tablets with touchscreens; and consoles which are played with game controllers.

All the settings relevant to the Android port can be found in the "Platform-specific options" menu in the General Game Data menu.

If you really wanted you could create different versions of your .rpg file for the different platforms, but this makes updating your game after release painful. Instead we try to allow you to adjust the behaviour of the game depending on where it's being played.

Porting to phones and tablets[edit]

Your game will need to be playable with a touch screen. The Android port overlays a virtual gamepad on the screen consists of up, down, left, right buttons on one side and between zero and six buttons on the other which can be mapped to keyboard keys of your choice. You can disable this virtual gamepad entirely, show and hide it with script commands, and can change the button graphics. By default the gamepad disappears when a textbox is shown.

The touchscreen also acts like a mouse and can accessed with the mouse scripting commands. Touching the screen with one finger translates to a left mouse click (or a click-and-drag). Touching the screen with two fingers translates to a right mouse click (or a click-and-drag). It's not possible for the player to move the mouse cursor without clicking/dragging. Typically you shouldn't display a mouse cursor on a touch screen.

Be aware that it's possible that a player uses a bluetooth gamepad or keyboard to play games on their phone or tablet.

You can use the running on mobile command to check for touchscreen-based devices.

Porting to consoles[edit]

A 'console' is anything that is played with a gamepad instead instead of a keyboard or touchscreen. The gamepad buttons are translated to key presses; you can specific which key each button should send. You can use the running on console command to check for game controller-based devices.

When a console displays an image on a TV monitor it is normal for the edges of the screen to get cut off. The OHRRPGCE compensates for this by adding a black border around the edge of the screen: the 'safe margin'. If you wish, the more ideal way to handle this is to not put anything important such as text or user interface near the screen edges. If you do so then you can disable or reduce the built-in safe margin.

In-app purchases and ads[edit]

In-app purchases are supported only on OUYA (experimental). There is no support yet for displaying ads.

Button names[edit]

You can use text embed codes like ${B0} in your textboxes which are replaced with the names of buttons to describe the controls to players, and have these codes turn into different text on different platforms. For example ${B0} defaults to "arrow keys" on desktops, and "D-pad" everywhere else.

MIDI[edit]

Unlike desktop operating systems like Windows and Mac OSX, Android does not include a MIDI synthesizer. This means we have to include one; unfortunately a MIDI synthesizer requires a large number of instrument sound samples, typically around 10MB in size. Unless you have a huge number of MIDI tracks in your game, it's typically a space saving to convert all your MIDI tracks to .ogg files. MIDI playback might also cause slowness on very slow Android phones.

Scripting commands[edit]

The following commands may be helpful for port your game:

Packaging your game[edit]

Regardless of the specific device or console, Android apps are .apk packages which contain the Game player and your .rpg file. You can still run your game on an Android device without first packaging it into an .apk by installing the following .apk on your device, which contains just Game and lets you browse for and play .rpg files which you've copied to your device's storage.

Once you have made any necessary changes (as described above) and tested that your game works using that .apk, the next step is to create a custom .apk for your game.

Distributing your game[edit]

Finally, see Uploading your OHRRPGCE game to Android app stores. That article lists a large number of app stores and game lists you can submit to.

Be aware that .apks on Google Play are limited to 50MB!

Limitations[edit]

There are still a number of things we would like to improve about the port; things that aren't really quite finished.

  • The engine by default doesn't allow using the mouse/touchscreen for anything, so players will have to use the virtual on-screen gamepad to move about.
  • For large games there can be a long loading time.
  • If the user backgrounds the game and the device is short on memory then the game could be forced to quit. This is invisible to the user because apps are meant to save their state and automatically resume to where they were before they quit, but the OHRRPGCE does not. The player will lose their progress.
  • No (proper) support for gyroscopes, accelerometers, and multitouch events.