Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon Join the GFS Discord Server!
15. April 2013

So last week I decided to run a poll to see which gaming technology people would be most interested in and the results actually shocked me:



Haxe narrowly edged out LibGDX ( by two votes ), while my original plan of HTML5 came in a distant third.  The other category seemed to be mostly composed of people interested in MonoGame.


I have long been a fan of C# and XNA, so Monogame was an obvious option.  It was ( and is ) discounted for a couple reasons.  First is the inability to target the web.  It's a shame Microsoft put a bullet in Silverlight, as otherwise this limitation wouldn't exist.  Second, paying 300$ to deploy on iOS and another 300$ to deploy on Android is a bit steep.  LibGDX suffers this to a degree too, as you need Xamarin to target iOS.  Hopefully in time this changes.


Hello Haxe World

So over the last couple days I've taken a closer look at Haxe or more specifically Haxe + NME.  Haxe as a programming language is an interesting choice.  It has an ActionScript like syntax and compiles to it's own virtual machine like Java ( the VM is called Neko, so if you are wondering what Neko is…  well, now you know!)  If that was all Haxe did, we wouldn't be having this conversation.  More interestingly, it compiles to a number of other programming languages including HTML5 ( JavaScript ), ActionScript ( Flash ) and C++.  As a result, you can compile to C++ for Android and iOS and get native performance.  This makes Haxe quite often many times faster than ActionScript.


There is however a serious problem or flaw with Haxe.  Let's take a quick look at part of the Haxe API and you will see what I mean:


Haxe Api


Notice how there are a number of language specific apis, such as cpp, which I've expanded above.  So, what happens if you use the cpp Random api and want to target Flash? Short answer is, you can't.  If course you could right a great deal of code full of if X platform, do this, otherwise do that, but you will quickly find yourself writing the same application for each platform.  So, what do you do if you want to write for multiple platforms with a single code base?


Meet NME

This is where NME comes in.  NME builds on top of the Haxe programming language and provides a Flash like API over top.  Most importantly, it supports Windows, Mac, Linux, iOS, Android, BlackBerry, webOS, Flash and HTML5 using a single code base.  Let's take a quick look at part of the NME libraries to show you what I mean:

NME api


There are still platform/language specific libraries, like the neko.vm above.  There are also the nme.* libraries.  These provide a Flash like API for the majority of programming tasks needed to make a game.  Targeting your code towards these libraries, and minimizing the use of native libraries, and you can target a number of different platforms with a single code base.


There is another aspect to NME that makes life nice.  If you read my review of the Loom Game Engine you may recall I was a big fan of the command line interface.  NME has a very similar interface.  Once you've installed it, creating a new project from one of the samples is as simple typing nme create samplename then you can test it by running nme test platform.


Here is an example of creating the DisplayingABitmap sample and running it as an HTML5 project:

Creating an NME project


And your browser will open:

NME running as HTML5


What makes this most impressive is when you target C++, it fires off the build for you using the included tool chain.  Configuring each platform is as simple as nme setup platformname, valid platforms are currently windows, linux, android, blackberry and webos.  Unfortunately Xcode can't be installed automatically, so this process won't work for iOS or Mac, you need to setup Xcode yourself.  As you can see, setting up and running NME/Haxe is quite simple, and worked perfectly for me out of the box.  If you are curious what options you can provide for sample names, you can get them from the Github directory.  There are a fair number of samples to start with.


Now is when things take a bit of a turn for the worse…  getting an IDE up and running.  This part was a great deal less fun for me.  You can get basic syntax highlighting and autocompletion working on a number of different IDEs, here is the list of options.  This is when things got rather nasty.  I was working on MacOS so this presented a bit of a catch.  I tried getting IntelliJ to work.  Adding the plugin is trivial ,although for some reason you need to use the zip version, it's not in the plugin directory.  Configuring the debugger though… that's another story.  I spent a couple hours googling, and sadly only found information a year or two old.


Then I tried MonoDevelop, there is a plugin available and its supposed to be a great option on MacOS.  And….  MonoDevelop 3 is no longer available…  It's now Xamarin Studio 4 and the plugin doesn't work anymore.  Good luck getting a download for MonoDevelop 3!  There is also FDT, which I intend to check out, but it's built on top of Eclipse and I HATE Eclipse.  Eventually I got IntelliJ Flash debugging to work but it was a great deal less fun.


After this frustrating experience, I rebooted into Windows and things got a TON better.  FlashDevelop is easily the best option for developing with Haxe but sadly it's only available on Windows.  There was however a major catch… debugging simply did not work.  After some digging, it turns out you have to run the 32bit JDK or it doesn't work.  Seriously, in this day and age, still having Java VM problems like this is just insane.  Once I got that licked, I was up and running.


At this point I have a working development environment up and running I can get to coding.  If you are working on Windows, using FlashDevelop you can get up and running very easily, so long as you are running 32bit Java.  On MacOS though, expect a much rockier experience.  It would be great if FlashDevelop could be ported to Mac, but apparently it can't be… there have been a number of attempts.  They have however provided a configuration for working in Virtualized settings ( VMWare, Parallels, etc ).


Stay tuned for some code related posts soon.

14. April 2013

I just finished performing an upgrade on the software that runs this site. I ran into a couple small snags during the upgrade that resulted in the site being unavailable for about 15 minutes. If you we're trying to access the site earlier today and received errors... My bad, sorry.



The new software should be a little quicker, but it was mostly about server security and a few perks for me, like better blogging software support. I think the upgrade went smoothly enough, but there are a lot of moving pieces. If you encounter any errors, please let me know what and where so I can fix it!



Cheers and thanks for your patience.



12. April 2013
During GDC Havok announced Project Anarchy a collection of their gaming technologies including Physics, Animation and the Vision engine for mobile. Today a few more details where announced and its all great news!

What’s included?

We have a powerful toolset made up of Havok’s Vision Engine, Physics, AI and Animation Studio; components of which have been used to build games like Modern Combat 4, Halo 4, Skyrim, Orcs Must Die and Guild Wars 2 to name a few. Project Anarchy bundles these technologies together, allowing users to download a complete toolkit with exporters for max and maya and a full WYSIWYG editor.

The Havok Vision Engine is built on top of an extensible C++ plugin framework and Project Anarchy will include the source for the plugins we use to connect our other products to the Vision engine. This source will also be maintained online and will provide insight for users on how to extend functionality with their own offerings; mail [email protected] if you’d like to know more.

How free is “free?”

You can download and develop your game on the PC for free. Releasing that game for iOS or Android is completely free. We’ve tried to keep it simple. No crippleware, no restriction on how big you are, no hidden royalty payments on the back end. You can opt to purchase direct support from our engineers or additional source code.

What about other platforms?

Additional platforms are not free. If you want to expand and generate revenue from other platforms you can license those directly from us. Given the ability with Project Anarchy to quickly move to new platforms, the risk/reward here will be easily understood based on the game’s initial success. We’re hoping that with these options and the opportunities afforded by a large community sharing a common technology base, as well as the fact that more and more developers will grow up with our technology, we’ll all benefit from what Project Anarchy brings.

They also have a launch trailer showcasing Project Anarchy on mobile.


11. April 2013

I mentioned yesterday that i've become rather smitten with Codea but didn't exactly find the prospect of typing on the iPad screen appealing.  I could have hooked up a Bluetooth keyboard, but I don't want to carry one around with me, especially as the one I own is massive.  I didn't really feel like spending 50-100$ on a portable one, I generally can't stand them if I'm honest.  In the end I came up with the following solution and I actually rather like it.  There is a price tag attached with this setup though, about 16$  ( or 1416$ if you count the MacBook and iPad Mini…).  Which ironically enough is more than Codea costs!  I was going to buy the one app anyways for other reasons, so that was a non-factor for me.


Here is my Codea dev environment in action!




Instead of using a Bluetooth Keyboard, I am using my MacBook as one using the application Type2Phone, a simple little application that acts like a virtual bluetooth keyboard.


Connect and pair like a normal bluetooth device, then when the app has focused, anything types is sent to your iPad and the iPad's keyboard is hidden.  Type2Phone has a 4.99$ price tag, but it works very well and has plenty of options.  Even more important, it handles connects and disconnects very well.  There is a more expensive app called iKeyboard, the one you will find if you google.  It doesn't appear to be maintained, doesn't work with iOS6 and costs twice as much.  Use Type2Phone instead, even if it has a horrible name! :)  It's one of those slick little utilities that sets out to do one thing and does it well, I appreciate those.  If you are running on a PC, I am certain you will be able to find similar utilities, as long as you have bluetooth that is.


Now typing and looking at a different device is kinda awkward, so I decided to mirror my iPad's display to screen.  The easiest way to do this is with Reflector a 13$ purchase that runs on either Mac OS or Windows an enables you to mirror your iPad display on your desktop using Airplay.  So long as your network connection, the results are pretty solid.  In the above picture, I am out at a coffee shop with both devices tethered through my Android phone and it was a bit choppy at times when running a game or movie, but flawless when programming in Codea.  On my home network, it's simply flawless.

Here is Codea running mirrored on my desktop using Reflector.

Codea over airplay


Now, Reflector is a cool little application and one I was intended to purchase anyways ( it's one of the easiest ways to screen capture an iOS game at full speed without having to run the simulator.


Now you may be asking, why not just run the simulator?  At the end of the day, you can't beat running on the actual device, especially when it comes to motion controls and multitouch.  Plus, under this setup, all of my code exists in one place, on the device, no need to move from Mac to Dropbox to iPad for example, or the other various deployment mechanisms.  Plus at any time I can just pick up the device and go, the big strength of Codea.  This way, I can give myself a desktop like development experience when I am at home or have my laptop with me, but I can still take advantage of the iPad based nature of Codea when I am on the go.


There is one downside to this setup, and one I don't think I am going to be able to overcome…  you still need to touch the device… there is no mouse support in iOS ( unlike Android ) and Reflector is for display only.  You will find yourself clicking things in Reflector over and over until you get used to it.  If you know a way to control the touch screen on an iPad from a Mac, let me know!


You can see a video of the entire thing in process right here:

10. April 2013

Now that I am actually setting off to create a mobile game, it dawned on me I don't have any current iOS devices to develop and test on.  I have an iPad 1, that my daughter has pretty much co-opted, and an iPhone 3g, which is absolutely prehistoric at this point.  I have zero desire to own an iPhone ( wayyyyyyyyy too small for me ) so I decided to pick up this iPad mini last weekend.  I figured it was a good base-line target device, as it shares the same basic components as the iPad 2.  Besides, I was going to be buying one for ShadowRun eventually anyways!



Of course, with a shiny new toy, I pretty much spent the weekend playing with it.  So i've been installing the various games and applications that aren't available in Android land.  


One such application I eventually installed was Codea.


If you've never heard of it, Codea is a Lua based game development system that is run on the iPad.  That's right, it's a full IDE, code editor and game library that you run on your iPad to make games for your iPad.  As you may know I am a pretty big fan of Lua game engines and amazingly enough, Codea is pretty good.  After I installed it, the next couple hours just disappeared.


Codea comes with a pretty extensive number of demos and a great deal of art assets for you to get started with.  You also have the ability to publish to the app store.  The documentation is pretty good, although locating it from their website isn't immediately obvious.  You can take a look at the reference here, although it uses Sencha touch, so it will only run on webkit browsers ( Safari & Chrome ).  Again there are a number of demo applications with complete source code included as well.  Pretty much everything you need is actually included.  Perhaps coolest of all, there is even a book available, although only a chapter is dedicated to Codea.


So, what you may ask, is it like to program on an iPad?  Pretty freaking terrible actually.  I've never been a huge fan of the iOS keyboard, now imagine writing code with it.  Codea do have a toolbar that make accessing special character and navigating between text ( think Home and End ) easier, and it does help.  They've also made a number of things very touch friendly, like colour selection bringing up a colour select dialog or touch and drag to change a numeric value.  There are also drag and drop snippets that make the process quicker.  At the end of the day though, you still have to type a fair bit and with the onscreen keyboard it's kinda frustrating.  Codea does about everything it can to help you, but in the end, they are at the mercy of the device they run on.  You really want a bluetooth keyboard if you are going to do serious work, if only just to reclaim screen space.


I am actually rather hooked.  I can't see myself using Codea for a full release project, but as something to play or prototype with when out and about away from my PC it's great fun.  I think it would also be a good app for someone just learning the basics of programming.  This app is easily worth the 10$ cost.  As I am going to be playing with it a bit more, I might as well do a review… expect one shortly.

AppGameKit Studio

See More Tutorials on!

Month List