Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

15. May 2013

Today during the Google IO event there was an announcement that both shocked and pleased me.  They are releasing a new IDE for Android development.  Best of all, it's based on IntelliJ, easily my favourite Java IDE.



(Photo's are from Verge )


One of the coolest new features is the addition of a tool allowing you to see your code running on a multitude of different devices at the same time:

Verge super wide


I can say easily one of the things I hate most about Android development is Eclipse, which is pretty much the defacto tool for Android. You could always work in IntelliJ or Netbeans, but it was never quite as seamless and always seem to have a gap or two in functionality.  Any news that might potentially keep me away from the hateful IDE that is Eclipse is great news to me!


You can read more about the announcement over at The Verge.  As of yet, no downloads are available on Googles websites.



Edit: Download link now available.  Also, so hands on screenshots available here.

News , ,

8. March 2013

Version 1.6 of the cross platform Java based game library PlayN was released recently.  PlayN enables you to target desktop, HTML 5, iOS and Android all using a single Java code base. 



Here are the release notes for this release:

PlayN v1.6

  • The complete API changes are summarized in this JDiff report.
  • Below is a summary of the interesting changes.

Project Layout

  • The way projects are organized has changed, please see Migrating15to16 for details.


  • Implemented tinting for layers (only on GL backends). See Layer.setTint and Layer.tint.
  • Added Log.setMinLevel to allow suppressing log messages below a certain level. (Recommended by Google for Android release builds.)
  • Added Sound.release for releasing audio resources sooner than waiting for GC to do it.
  • Added Assets.getMusic which allows backends to make some optimizations relating to large audio files.
  • Graphics.setSize was removed, and special setSize methods were added to individual platform backend code that can reasonably support them (e.g. HtmlGraphics.setSize).
  • Added GLContext.Stats for debugging rendering performance on GL backends. (See Triple Play's HUD class for an easy way to display these stats.)
  • Deprecated Canvas.setTransform because it interacts poorly with automatic scale factor management in HiDPI modes.
  • Added CanvasImage.snapshot which can be used to create an immutable snapshot of a canvas image which has higher render performance.
  • Added TextLayout.ascent/descent/leading for cases where an app needs to know more about the text that will be rendered by aTextLayout (for underlining, for example).
  • Added Json.Writer.useVerboseFormat to cause the JSON writer to generate pretty printed output (rather than compact, everything on one line output).
  • Added support for nested clipping regions (e.g. clipped groups inside of clipped groups).


  • Made the Java backend look for .wav audio files and then fall back to .mp3. This allows a game to use uncompressed .wav audio files, and only compress them when preparing an Android, iOS, or HTML build.
  • Made playback of large MP3s work (when loaded as music).


  • Added HtmlAssets.ImageManifest which can be used to pre-load the dimensions of all images known to your app, and enableAssets.getImageSync to (sort of) work in the HTML backend. A wiki article explaining this will be forthcoming.
  • Added support for HiDPI mode. See HtmlPlatform.Config.scaleFactor and HtmlAssets.setAssetScale.
  • Added HtmlGraphics.registerFontMetrics for overriding the (hacky) measurement of font line height.
  • Removed source code from the stock POMs. HTML backends now need to add the source jar files to their html/pom.xml. See playn-samples for an example.


  • Fixed issue with audio not stopping when device was put to sleep.
  • Images loaded locally are now marked as "purgeable" and "input shareable". Google for "android" and those terms to learn more.
  • Added AndroidGraphics.setCanvasScaleFunc which allows games to use lower resolution canvas images if desired. This is useful on devices with low memory.
  • Added AndroidAssets.BitmapOptions which allows games to downsample images if desired. This is useful on devices with low memory.
  • Added GameActivity.prefsName for customizing the name of the Android preferences file.
  • Added GameActivity.logIdent for customizing the Android log identifier. It defaults to playn which is what was hard-coded before.
  • Rewrote sound backend based on SoundPool. Music (large audio files) still relies on the old more-hardware-resource-intensive approach.


  • Added IOSPlatform.Config for specifying configuration options.
  • Added IOSPlatform.Config.frameInterval for specifying target FPS on iOS.
  • Added IOSImage.toUIImage for custom platform code that needs to manipulate an image loaded via IOSAssets.getImage.
  • Numerous bug fixes and performance improvements.


Additionally, TriplePlay 1.6 was also released.  TriplePlay is a library built over top of PlayN to support higher level functionality like UIs and animation.

The following are TriplePlays release notes:



  • Added Scroller makeVisible.
  • Added LongPressButton which supports both a normal press interaction and a long-press interaction.
  • Added AxisLayout.Policy CONSTRAIN off-axis sizing policy.
  • Added Field MAXIMUM_INPUT_LENGTH style.
  • Added TableLayout colspan for configuring a column span on an element.
  • Added ValueLabel.
  • Added Style ICON_CUDDLE and UNDERLINE (the latter for underlined text).
  • Added TableLayout.Column free to allow weighting of free columns.


  • Added AnimGroup for creating a group of invoked-in-parallel of animations that are either added to an Animator later, or are added to a serial animation chain.
  • Moved animation creation methods from Animator to AnimBuilderAnimation then now returns an AnimBuilder which is a cleaner design.
  • Clarified behavior of Animator add and then, made then freak out if used incorrectly.
  • Fixed bugs with repeating animations.



  • Added Transform randomScale and randomOffset.


  • Various bug fixes and small API improvements. See API changes.


  • Added NativeTextField Validator and Transformer for (native) text validation and transformation.


  • TintingShader was removed as PlayN layers now support tinting directly.




For existing PlayN 1.5 developers, there is a guide for migrating to 1.6.


27. January 2013


LibGDX is a popular Java based open source cross platform game programming library that supports desktop, Android, HTML5 and now… iOS.


Other details about this release:


  • Minor changes to the Livewallpaper API. Note that the LWP support is still a little buggy. It’s a contribution, and while i did quite a bit of clean-up it’s still not entirely where it should be. I’d be super happy if someone took on that backend!
  • If you want to deploy to HTML5 you now need to use GWT 2.5!
  • We have rudimentary Maven support. Thanks a ton to Team Gemserk for libgdx mavenizer and all their help with this!.
  • Android Daydream support, a contribution by talklittle! This one is stable.
  • Gdx controllers extension, for Android/Ouya and desktop. HTML5 could be an option too! Volunteers? (looking at you Nex) Some notes on the current stub backend for HTML5
  • The gdx-net API is now part of core. Fetching things via HTTP should work on all backends. Here’s a little test. Big thanks to Noblemaster and Gemserk who led this effort!
  • Not exactly part of the release, but here’s a quick rundown on how to make your libgdx game work with Ouya!
  • Again, not exactly part of the release, but here’s an awesome guide by Swarm on how to integrate Swarm with your libgdx app! Note that you should probably interface the Swarm API so your desktop project continues to work.
  • First release of the iOS backend



The iOS release does have some caveats though.  You need a Mac, XCode and ( here’s the stickler ) a MonoTouch license, just like the PlayN project’s iOS port.  Unfortunately, MonoTouch costs 400$, so this is one of those things you should be aware of upfront.


That said, iOS is often the biggest market place, so being able to port your game could be easily worth the 400$ price tag. 


The following features are in the queue for the 0.9.9 release:



You can read the entire release notes here, and access the source code here.


Nice work LIBGDX team.

News , ,

28. August 2012


This guide will run through the process of creating and building an Android host for use with Moai.


There are a number of installs and configurations you need to perform before you can build Moai for Android.  If you need details on any of the individual steps, click the link to jump to more details on that part of the process.  If you think it seems like quite a list… you are right, it is!  Fortunately you only have to do it once!


In order to build the Android host you need to:


Install and configure all of those items before continuing these instructions.  Seriously, you need everything above, so install and perform every configuration step or the following is guaranteed to fail!



Creating an Android Host


Open a cygwin terminal

Change directory to where you want to install the Moai source code.  I am going to install to C:\, which under cygwin is /cygdrive/c, so:

cd /cygdrive/c

Now run git to download the newest Moai source code, enter:

git clone git://

Let git run, it will download and clone the most recent source code to the folder c:\moai-dev.  Make a cup of coffee, it might take a few minutes.



Now we want to build our Android host, to do so, change into the folder c:\moai-dev\ant\ and run the script  You pass in the name of the  package you want created in Java form ( reverse url, com.yourdomain.yourappname ) like so:

cd /cygdrive/c/moai-dev/ant

./ –p com.gamefromscratch.moai

It should run and complete without issue.  Should being the operative word, in my case I was actually getting a permission denied error on one the library files.  A quick chmod 644 permission setting on the file fixed that issue.  Once the script completes, it will have created a directory in the /ant folder called untitled-host.



In untitled-host, locate and edit the file, locate the the line android_sdk_root and edit it to match the path to your android sdk ( note, SDK not NDK! ), mine looks like:


Then scroll down to the section src_dirs and set it to the directory containing your Lua project, such as:

src_dirs=( "cygdrive/c/luasource" )

Save your changes and exit.


Now optionally edit  Most importantly, locate the line:

requires=( "miscellaneous" "adcolony" "google-billing" "chartboost" "crittercism" "facebook" "google-push" "tapjoy" )

and change it to just:

requires=( "miscellaneous"  )


Unless you specifically need to include those libraries.  Tapjoy and Facebook are currently broken though, so if you include them, you will have trouble later!  You can optionally set your app name, version number, icon names, etc at this point. (Actually, this part seems to be ignored anyways…)

Save and exit.


Not type ( in the untitled-host folder ) :



So long as you didn’t get any errors, your project should now have been created. 


Loading and running the generated project in Eclipse


Fire up Eclipse.

Select the menu File->Import…

Select General->Existing Project into Workspace, like so:



Click Next.


Check Select root directory and navigate to c:\moai-dev\ant\untitled-host\build\project like so:



Click Finish.


As you can see, even though you said you didn’t want them, Facebook and Tapjoy are still included, and are still broken.




Right click and choose Delete for each one.


Once those are removed ( or you can optionally find and fix the external libraries they depend on instead of removing them. ), your application should build just fine.  Make sure your Android device is plugged in and has debugging enabled ( in the settings on the device ).  Right click your project, select Run As… Android Application



A few seconds later, your application should appear on your device.


The actual lua code for your application will be located in the lua folder within the assets folder.




Happy Androiding!



If these instructions don’t work for you, do not be surprised.


1- Moai is under active development

2- The whole Java build system is horrifically complex and exceedingly fragile

3- Eclipse is the devil




Installing Cygwin


Cygwin is a unix like environment for windows and is critical to successfully building the Android hosts with Moai.  First thing download setup.exe from here (direct link to exe).  Your browser may fight you a bit about downloading an executable directly.


Once downloaded, run setup.exe, saying yes to any security prompts.


Select Download from Internet.


Click Next.


Pick whatever directory you want to install to, I kept the default of c:\Cygwin. 


Click Next.


Next you need to pick the directory to download to, again I just went with the defaults:


Click Next.


Defaults again unless there is something odd about your internet connection:


Click Next.


Select the download location that is closest to you, then click Next:




The downloader will run for a few seconds.  You may get a prompt saying this is the first time you have installed Cygwin and be sure to check the documentation.  Simply click OK.  At this point, you will get a window asking you to select the packages to install, like so:




Install the devel selection of tools, simply click the icon beside the Devel tree and it will switch from Default to Install, like this:


NOTE: *** You don’t actually need the entire Devel tree and this process will take a really long time to complete ( two hours on my laptop ) if you select the full Devel tree.  However, selecting all developer tools guarantees that you get everything required as part of the build process.  You can experiment with selecting individual packages if you wish.


Click Next.


You will most likely get a prompt about resolving dependencies, like so:



This is normal, click Next.



Setup will now download all of the packages you have selected:





This process is not… short.  Have patience, lots of patience.  Have you considered picking up a new hobby?  Knitting perhaps?  Go for it!  You have plenty of time.


Cygwin installation is now complete.





You can always run setup.exe again if you want to enable or remove features in the future.


Cygwin is now configured.


Installing the Android NDK


Head over to the Android NDK page and download the appropriate file. I went with, but this will obviously change in version name over time.


Once downloaded, open the archive and extract the folder inside to somewhere on your drive.  In my case the folder was called android-ndk-r8b and I extracted it to c:\.  After it is extracted, rename it to android-ndk.  There are 17,000+ files in that archive, so expect it to take a while to extract.


Later in the process, Moai will need to know the location of the NDK, specifically ndk-build.  The easiest way to make this file discoverable is to add it to your path environment variable, this can be configured via the command line:


setx PATH ‘%PATH;c:\android-ndk’.


The NDK is now installed.



Installing the Java JDK and set the JAVA_HOME environment variable


You need to have a Java JDK installed and configured.


Download the JDK from this website.  Chose whichever version you want, it shouldn’t matter.  There are some annoyances with using Android tools with Java 7 ( 1.7 ), so Java 6 may be the best choice for now.


Once downloaded and installed, be sure that JAVA_HOME is set to your install directory.  Mine for example is c:\Program Files\Java\jdk1.7.0_03


Once again, you can set this environment variable from the command line using the setx command.




Installing Apache Ant


Go here to the Apache Ant download page and download the zip file.  I selected

Open the archive and extract the folder (apache-ant-1.8.4 in this case ) to a location on your drive.  I went with c:\ again.


Set the environment variable ANT_HOME and point it to this directory ( c:\apache-ant-1.8.4 in my case), you can do this from the command prompt with the command:

setx ANT_HOME c:\apache-ant-1.8.4

Like so:



Ant is now configured.



Installing the Android SDK, Eclipse and the Android Plugins


You can download the Android SDK here, which full instructions here.  Be sure to install at least the Android 2.2 ( Platform 10 ) platform as described here.


The first half of this guide covers the installation process for installing Eclipse.  You need to install Eclipse as well as the Google ADT to complete this process. Eclipse 3.7 or 3.8 will work, although might require a minor change during the install process.

Programming , ,

17. July 2012


Google’s cross platform PlayN game library has just released version 1.4.  PlayN enables you to target desktop, iOS, Android, HTML5 and Flash using a single Java code base.



Details of this release:



PlayN 1.4 highlights:

- You can now find out when your Android or iOS game is paused and
resumed via PlayN.LifecycleListener.

- WebSocket support has been added (only works on HTML and Java
backends right now).

- Custom GLSL shaders are now supported on all GL-based backends
(HTML5/WebGL, iOS, Android, Java).

- You can use JavaPlatform for your unit tests without having to wire
up the LWJGL native libraries: use JavaPlatform.registerHeadless.

TriplePlay 1.4 highlights:

- Page turn and (iOS-style) flip transitions that use custom shaders
to achieve real 3D perspective (check out the demo on a WebGL-capable

- The long awaited particle system has arrived, break out the
fireworks. This currently only works on GL-based backends, but may
some day work on non-GL backends (less performantly).

- There are a couple of not-yet-finished cool new things:

  • a mechanism for syncing persistent storage across multiple clients
    with conflict resolution (so people can play your games on all their
    devices with the same save game state)
  • a player for our Flash animation exporter
    (, so you can export animations
    from the Flash authoring tool and use them in PlayN games


Full release notes available here.


I have created a number of getting started guides for PlayN, start here for Eclipse and right here for Netbeans.  Of course, be sure to update the version number in either guide.  Once you get through the install process, it’s a very nice library to work with.

News ,

Month List

Popular Comments