• Getting OneSignal Working On A Multi-Module Project

    Recently, upon attempting to implement OneSignal for user notifications (and following their installation instructions), a wide variety of intriguing and mysterious build errors were encountered.

  • Getting Started with Sugar ORM

    Sugar is a very easy to use ORM library used to make handling databases on Android hassle-free. Whilst it lacks some features, it is ideally suited to smaller projects due to the simple syntax.

  • Auto-detecting Device Orientation Whilst Allowing User to Override

    When creating games (and other apps), screen orientation is very important. In general, more casual games use portrait, whilst more hardcore / intense games use landscape. However, some games may be inbetween these two categories, or may wish to reach a wider audience by supporting both. Automatically rotating to match device orientation is easy, but allowing the user to “lock” one orientation is a little trickier.

  • Selectively Playing Tracks Whilst Game Is Active / Open

    Playing background music on Android is pretty easy: just start a service with a media player. Great, that was easy! However, when the user presses the home button, the music… continues. This is good for music apps, but awful for games. In this example, Blacksmith Slots had one music track for the intro, and one for the main game.

  • Implementing A Locale / Language Selector

    Android applications are distributed to users around the world, and these users aren’t always going to speak the same languages as you. Luckily, Android has excellent built-in support for automatically applying the right language, however this isn’t always enough. Sometimes a user may want to choose their language, and unfortunately there’s no built-in way to support this. The game Pixel Blacksmith uses the technique described in this article.

  • Custom Alert Dialog With Dynamic Buttons in Android

    Alert Dialogs are an excellent way of providing a confirmation screen, or letting users select from a set of options. However, customising them can be tricky, and they have a maximum of 3 buttons (positive, neutral, negative), all of which are positioned differently in different Android versions. If advanced customisation or more than 3 buttons are required, the usual method of modifying colours etc (styles) isn’t enough!

  • Importing Levels From QR Codes (Camera / File) in Android

    In a previous post, it was discussed how to export levels from an Android game (in this case Connect Quest) so that other players could play them. Now that they’re exported, we need to be able to import them again! This post will explain how to import QR codes either directly from the camera, or embedded within an image on the file system.

  • Exporting Levels Into QR Codes Using ZXing

    Connect Quest is an android game where players rotate tiles to make a city flow. They also have the ability to create their own levels, and share them with other players. The data transfer method chosen was QR codes, since it was the most widely-used and compact method available.

  • Converting Levels Into XP & Vice Versa

    Many games (such as my own Pixel Blacksmith and Blacksmith Slots) contain an XP / level system, where performing actions will reward experience, and eventually new levels. These new levels often unlock new content, or provide currency, so keeping players incentivised without feeling like a “grind” is a tricky balance.

  • Calculating Weapon Damage Using Ideal Ranges

    Whilst building a turn based strategy shooter, weapons needed to have “ideal ranges”. For example, a melee weapon should only work from 1 tile away, a shotgun should prefer short ranges, a sniper rifle should prefer long ranges, etc. The non-melee weapons should still work outside of their ideal range, but with reduced damage.