Hello, and welcome to Twinspire! If you are just getting started, it is likely you may not know where to start, or how. Perhaps you know Haxe, have been using it for some time, perhaps with OpenFL, but are looking for something new to use.
Based on Kha, Twinspire is (currently) a 2D video game engine that gives you a whole bunch of useful utilities which provide making games a whole lot easier. The current features include:
- Basic GUI controls (Label, TextField and Button)
Game class, which provides some simple scene management and event handling.
- The base
Object class, which provides alignment and positioning utilities to aid in designing UI.
- and the
TileMap class which allows you to draw levels.
But why use Twinspire?
Unlike many game engines and high level frameworks, which often suffer from what I like to call "API Restrictness", Twinspire's components and objects are entirely optional. Due to the nature and design of function calls such as
render, you are not strictly bound by the API philosophy that Twinspire uses.
You can use the
TileMap class and use it in a way that fits your API design philosophy, however you wish to. You may optionally use the
Game class, or you may not, to initialise and create a context for your game.
It is entirely your choice how you wish to develop your games, and you are not strictly tied to the API of this engine.
Perhaps what makes this different to other engines is the focus on User Interface design. There are few video games that get UI design right, and the only companies that can make excellent menus full of options to customise the player's gaming experience are often AAA companies. I would like to change that by offering a decent
Object system that works on both a UI level, and a gameplay level.
I have yet to get there, but there is much to be done.
If you already know Haxe, it is likely you have already installed it. Otherwise, you can download Haxe from their website.
Twinspire relies on Kha, which can be downloaded and installed from Github. If you are not familiar with the command-line, it is perhaps time to start using it.
We will need to use Git for these next steps.
- Open Command Prompt or Terminal, or your favourite command-line tool, in whichever operating system you are using.
- You can install Kha in one of two ways:
haxelib git kha https://github.com/Kode/Kha.git will use your git command-line tool and install it in the appropriate Haxe library directory. You can update Kha by using
haxelib update kha.
b. Alternatively, you can use the command
git clone https://github.com/Kode/Kha.git which will create a folder in your current working directory called
Kha, and download and install all submodules there.
- If you installed Kha via Git, instead of Haxelib, we can update Kha recursively using the command
git submodule update --recursive. It does not matter where you install Kha, because you may need to do this same command in the haxelib directory anyway.
- We now need to set Kha as a haxelib dev directory. If you installed via
haxelib, you can skip this part. Stay in the working directory for Kha's repository, and type
haxelib dev kha ./. Haxelib will now use this directory for the
Finally, you can install Twinspire. Repeat the steps above, but for Twinspire found here.
Choosing an Editor
In these tutorials, I will be using Kode Studio, which is what Kha recommends you use. Because of Kha's build system, which relies on NodeJS (probably due to the use of Visual Studio Code), Kode Studio is likely the best choice.
You can use other editors if you so desire, but Kha with Kode Studio has pre-built debugging configurations that make writing video games, among other things, so much easier than Haxe's native debugging tools, or rather a lack of.
Once you haxe installed Kode Studio and launch it up, we need to do some preparations.
- Firstly, go to File -> Preferences -> User Settings.
- In the right-hand pane, a tab showing a
settings.json file appears. Within the curly braces, type, or copy and paste:
"kha.khaPath": "path/to/kha" where the path is the Git or Haxelib dev directory where you installed Kha.
- Save the file, and close both tabs.
You are now ready to start coding with Twinspire!