NME is over 8 years old now, and stronger than ever.
As seen at the wwx2015, there are now many great frameworks you can use with haxe. I would like to outline what I believe are the core values of NME to help you, the developer, choose a framework for future developments, or entice you into trying out NME with your existing project.
- Stability. Stability is the #1 priority. If your code compiled with NME yesterday, then it will compile with NME tommorrow unless there is a very good reason. NME is older than a lot of programming languages and sometimes this could be considered a bad thing, however NME’s #2 core value means that stability translates into reliability, not obsolescence.
- Innovation. We love innovation in NME- we’re always looking at how new technology can be applied to existing problems. When NME was conceived, there were no iPhones and no Android phones, however once they came out, these were quickly targeted by NME. NME also tracks (and inspires) cutting-edge development in the haxe compiler and the hxcpp backend. This can be seen with the latest Cppia integration. This combination of stability and innovation means that you can try out these new technologies risk-free.
- Pragmatism. NME concentrates on practical solutions to real problems. For example, when it became apparent how painful it was to set up an Android project then the nme tool was developed to solve this problem. Later the android testing workflow was significantly improved with the Acadnme backend.
NME is also very light (50% lighter than other “light” media engines), and includes everything you need to build an app – no “dependency hell”. The stable versioning and automated build process means that you can easily try side-by-side fully-working cutting-edge or historical versions simply by downloading a single haxelib-ready zip file from nmehost.
The extent to which the flash Api is mirrored is also governed by practical considerations. NME is not emulous of the name or implementation of flash – NME will happily add functions like drawTiles to help out developers, or to add the OpenGLView to allow the default rendering to be mixed with or replaced by traditional OpenGL rendering.
NME takes a pragmatic approach to licensing too – wherever possible (currently everywhere) libraries are chosen to avoid any potential GPL issues and workflows are designed to avoid any patent issues (particularly with audio).
Pragmatism is also a consideration when choosing what targets are supported by NME. Some targets such as BlackBerry, Tizen and Windows sandbox apps are not supported due to what I perceive as their cost/benefit ratio. This can change in the future if the benefits go up – perhaps Windows 10 will see some more interesting applications.
Getting (re)acquainted with NME.
For existing haxe users, NME is super easy to get started with. First, install the latest release with “haxelib install nme”, then create an alias for running the nme tool with “haxelib run nme setup”. Now you are setup with the “nme” command. If you do not want to create the alias, you can simply use “haxelib run nme” in wherever the “nme” command is used in the following discussion.
You can run the demos without needing to actually clone any demo code, but you probably want to start in a clean directory since the intermediate and application files will be created in a subdirectory of the working directory. Use “nme demo” for a list of NME demos. This list includes the first few letters in square brackets – this shows the shortcut you can use run the demo. eg, “nme demo ca” will run the “Camera” demo, with the default target “neko”.
NME is still largely compatible with Openfl projects, including flixel projects. And, it can make guesses about demos from other haxelibs, eg: “nme demo flixel” will list the flixel demos (assuming you have them installed), and “nme demo flixel:mode” will run the demo with neko, or “nme demo flixel:neon cpp” will compile + run a demo with hxcpp.
If you have an existing Openfl project, you can simple try nme by running “nme” or “nme cpp” in your project directory.
If you want to start a simple test from scratch, you do not even need a project file. You can start with a single haxe file, like you might with flash. eg, start by typing in Test.hx:
class Test extends nme.display.Sprite {
public function new() {
super();
graphics.beginFill(0xff0000);
graphics.drawCircle(100,100,100);
}
}
then just run “nme”.
Acadnme
One of the big innovations for this year is the cppia target and the Acadnme runtime.
This scripting target has the advantages of the neko target – being lighting fast to compile – combined with the versatility of the cpp target – that is, run on almost any device.
Acadnme comes precompiled for desktops targets (currently, Windows and Mac) in the acadnme haxelib (haxelib install acadnme), and for Android via the Google Play store. Once installed, you can test your program with cppia with something like “nme demo flixel:neon cppia”. This particular demo has some trouble with neko due to Floats initializing to null, whereas the cppia script follow the hxcpp quirks extremely closely and initialize these variables (more usefully) to zero.
To test on Android you need to be on the same wireless network. First, install and run the app and take note of the ip address displayed on the startup page. Then provide this to the nme tool as the “deploy” variable, like: “nme demo Stage cppia deploy=192.168.1.21”. Your app obviously needs to be “Android ready” for this to work well, that is, ready for touch input and screen scaling.
You can create your own cppia target to use instead of acadnme, with “nme set cppiaHost /path/to/your/host”. Have a look at the opensource acadnme project to get an idea of what might be involved.
Give it a go.
I understand that there is not a one-size-fits-all approach for app frameworks. Other projects place higher values on things such as console targets, modularity of multiple libraries, re-architecting to get things 100% right and either avoiding or embracing the flash Api. NME’s core values are stability, innovation and pragmatism. If you also value these things, then we would love to have you on the team. If you prefer another framework, you can still have NME installed to use for testing and comparison, or for quick scripting via Acadnme.
It is very easy try out NME to see if it suits you needs. See how you like it, and tweet me @gamehaxe.