Kha Shmup Tutorial Part 0

Kha describes itself as a “super-portable dev kit.” The tool is kind of equivalent to the Haxe version of SDL. Essentially its a tool by which you can use Haxe to make games or other media applications, and it allows you to target Linux, OSX, Windows, Android, iOS, HTML5, and several other targets very efficiently.

Kha has always seemed super interesting to me - I love Haxe, and I am always on the lookout for open source game frameworks that have a high degree of portability. I love and continue to use Unity3d, but I feel it has a few downsides when it comes to 2d development, and often I feel its closed-source nature fights against it. Recently I was trying to learn the low-level Transport Layer Networking in Unity, and there were often questions I had that would have been easily grokkable had I access to the source.

Kha seems like a great tool, but I have had many complaints about it, which I have seen shared among a few other developers who have tried getting into it - it uses an unfamiliar build system, its api is somewhat of a moving target, and worst of all - it lacks documentation.

That last part is often a curse that kills many open source projects - no matter how good your software may be, if people can’t figure out how to use it, it won’t get used. When people are looking for a library or framework to use they aren’t often willing to read a majority of the code base, post on forums, jump into irc channels and the like.

The lack of documentation is one that is pretty easily solved - people who have actually penetrated and started undestanding the software just have to write down, talk about, or cast themselves discussing it.

I decided rather than look at Kha and say “Eh, not enough docs for me..” that I should try to understand as much of it as I can and write down what will hopefully be helpful to others. The Kha community has been very welcoming and helpful to me, someone who basically just pops up once and a while and asks “how do I…”

So my process of documenting will be the creation of a very small shoot ‘em up game, or “shmup.” I will be going step-by-step on github, so hopefully as I explain each step you will be able to see the code and how one might grow a small Kha program.

I will be assuming that you know Haxe. If you do not the documentation is alright to get started. For reference I am using 3.2.1 on OSX, but this should work on Linux or Windows.

To run my examples you will need a copy of NodeJS, which you can download here. You will also need a version of git.

Kha is often included as a submodule within an individual Kha project, which is how I have it set up in this tutorial. You can use Kha from haxelib, but the version I am targeting has not been released to haxelib yet. I will update these tutorials when it has.

Once you have Haxe ready to go and a recent version of NodeJS, we will be ready to begin putting our game together.