As a fledgling designer in the video game industry, it can be quite a challenge to decide what programming language to use when designing your game. After all, to maximize your effect on the market, you’ll want your game to run smoothly on multiple different platforms.
The challenge is that not all programming languages work as well on every platform, and rewriting everything in another will take plenty of time, a lot of hassle, and may never end up the way you want it. That’s where Haxe comes in.
Haxe is a programming language designed specifically to work for a host of computing platforms and all from one codebase. Even better, it’s open-source and free to use. In this guide, you’ll learn everything you need to know about Haxe, and how it can save you both time and money.
How it Started
First, a bit of history. The Haxe project was started in 2005 by Nicolas Cannasse, a French developer who worked for Motion Twin at the time, a game studio that had worked on several small indie titles at the time, and would later go on to create the popular Indie hit Dead Cells using Haxe.
Cannasse had an interest in combining technologies and programming language design and began the process of creating his own. Initially, the goal was to replace the Action Script 2 compiler, MTASC. But as the project grew, the scope became much larger.
At the start, it supported AVM-Bytecode. In 2006, a new version of Haxe was created that could generate Javascript code. In 2008, Cannasse and his team had managed to reach their goal of supporting C++. In 2011, Haxe added the use of Macros to its ever-growing tool belt.
In short, Haxe saw many quality of life improvements and major advancements as new members joined the team with the same goal; to write a programming language and compiler supported across all platforms, that could simplify the logic between them.
Languages
And they have made a lot of progress towards that goal. Currently, if you write with the Haxe programming language, you can easily compile it into Javascript, C++, PHP, C#, Java, JVM, Python, Flash, and Lua. Not only does it target these languages, but it can compile them quickly compared to other compilers on the market. It also supports the virtual machines, Hashlink and Neko, which are perfect for running tests to see if your code is working right.
The Haxe language itself uses typed code to make it easier to handle, and transferring it into other programming languages is easy. For example, if you use the command “-js :”, you can compile it into javascript. Straight-forward and simple.
The Haxe language takes note of the internal behaviors and differences of the various platforms and is able to adapt to all of them. That way, if you know how to type code in C++, doing the same in Haxe will feel very familiar to you. Modules specific to your platform of choice are included in the standard library, so you won’t be missing out on any of the features you like from the other languages.
Why Use Haxe?
So why use Haxe in particular? First, it’s incredibly flexible. Haxe can be used to develop games, websites, desktop apps, CLI development, etc. Multiple platforms: one language. All in typed code. This means you only have to write the code once, even if you want to export it onto multiple platforms.
The ability to use Macros is also a welcome feature, making use of the language faster and more convenient. On top of that, it’s open-source and free, with a large and very active community ready to support you. If there was any doubt, companies as large as Disney, Coca-Cola, and the BBC have used Haxe for their programming, as well as plenty of game developers.
A number of Indie hits such as Northgard and Papers, Please were created using the Haxe programming language.
Ecosystem
The Haxe Foundation is an organization that accepts donations from its open-source community. In return, they offer paid support plans to assist those who need help with the language, though a lot of assistance can be found within the open-source community itself. The foundation also drives community events and funds a variety of Haxe related projects and core technologies to continue its growth.
The Haxe Foundation is partnered with Gamesys, a gaming company known for their Casino and gambling games, who are always looking to hire new developers familiar with the programming language. There are also a number of enterprise and professional partners. Tivo, Flowplay, Proletariat, area 9, Docler Holding, and Innogames are all partnered with The Haxe Foundation.
In addition, the foundation maintains several programs specifically for its users. The VMI’S Neko and Hashlink were actually created and are maintained by the Haxe Foundation. The Haxlib, a huge library used by the community, is also well maintained. Blogs are regularly updated with engaging articles about using Haxe, and branding is offered for those who wish to use their logo.
All in all, Haxe has plenty of backing, both from within the foundation and outside of it. Given some of the large companies that have used this software in the past, such as Nickelodeon and Toyota, this ecosystem may only grow in the near future.
Installation
If all of that interests you, you may be wondering how to get started. Luckily, it’s simple.
Go to the Haxe Website and pick which installer works best for you. They have installers for Windows, Linux, as well as OS. They also have the Binaries of each available. Once it is downloaded, installation should not take much time. Just click past the Introduction, License, select its destination, and click install.
Tutorial
Once you have Haxe successfully installed, it’s time to begin using it. The Haxe website has provided detailed instructions on how to learn this programming language. It’s a great place to get started, and can act as a good reference for where you need it.
It will go over a fun example of how the language works, typing in “Hello, World!” as a line of code. It’s basic, but it’s very informative to how the syntax works. This tutorial will also show you how easy it is to compile using Haxe. there’s even a list of popular editors and IDE’s to get you on your way.
Additionally, simply by opening up a terminal and typing Haxe, you will be given a large array of quick commands. If you just finished installation, make sure that those commands appear, it’s a good way to check if Haxe has been installed properly. The commands that pop up are also a useful reminder of what’s possible without having to use a search bar. Among them are simple codes for compiling to javascript, bringing up help, or using a library for example.
The Haxe Code Cookbook is an amazing resource for beginners that can’t be recommended enough. It is filled with tutorials, examples of functional codes, and answers to commonly asked questions. There are sections explicitly for beginners, and the Haxe community updates it regularly, offering advice to newcomers on how to solve problems they once had.
If you’re ready to just grab a few code snippets and see how they tick, need some information about UI, or some basic training in the programming language, this is the place to go.
Finally, if the written tutorials and advice aren’t enough, there are a number of videos offered to help out beginners, as well as clips showing off updates of the system and talks about future projects. These can be an asset to start out with and can keep you well informed going forward as Haxe develops even further.
Community
As Haxe is open-sourced and free to use, it has built up a large and supportive community to help newcomers and veterans alike. One of the most impressive aspects of Haxe is its extensive library, Haxlib.
This library is full of active members sharing their code and scripts for free and allows you to browse by your favorite target, author, or tag. After all, the best way to learn what works in Haxe is to see what the community has already made, and build off of their experience.
The projects are all organized by popularity as well, letting you see what the community has had the most success with. Unsurprisingly, there is also a community forum, a Twitter account that often showcases games that use Haxe, and a Facebook group as well. The community is very friendly to newcomers, as they’ve been there before.
Many of the entries in the Haxe Code Cookbook were created not by the foundation, but by community members doing their best to offer tutorials and give examples of functional code. Throughout Haxe’s history, it has always relied on support from eager designers.
Compatibility
Haxe 4 is compatible with Windows, Linux, as well as OS on Macs. It should be noted that with the creation of Haxe 4, some of the APIs have been removed from the standard library. However, if you still want to use that API, you can by using the hx3compat library. Adobe Flash Player is also no longer compatible with Haxe 4.0
Addendum
In conclusion, designing the perfect game is already a difficult process. But compiling your game onto different platforms doesn’t have to be. Haxe is the perfect programming language to use if you want to get your video games onto multiple platforms with little difficulty, and if you follow this guide, you will be well on your way to mastering it for all of your future video game productions.