Submitting Applications to Google Play, App World and the App Catalog

Pirate Pig (the NME sample version) is available in Google Play, BlackBerry App World and the webOS App Catalog.

Making a game is the hardest part, especially one that has a lot of polish. Details count. There are a dozen ways Pirate Pig could be a better game, and have more replay value.

The original Pirate Pig sample, written in Javascript, was created to show that Enyo JS could be used, not only for applications, but also for games. While I was still part of the webOS Developer Relations team, I decided to create a new version of Pirate Pig to illustrate the same game might be created using NME. Personally, I like my version better, but that is okay. Enyo excels at applications which would be more difficult to create using NME right now. Being a native framework, NME has obvious advantages in performance when applied to games.

It took me a day to create the sample. I wanted to create another example you could use to help create your own projects.

If there is anything I have learned by submitting Pirate Pig to Google Play, the App Catalog and App World, it is that, in the scheme of things, the process is trivial. NME makes it very simple to target iOS, Android, BlackBerry and webOS. The “heavy lifting” of cross-platform compatibility and preparedness for submission for these catalogs is done for you. Making your game or application is the real challenge. Continue reading Submitting Applications to Google Play, App World and the App Catalog

How to Create an NME Extension

One of the things that I love about NME is that it is easy to extend. Unfortunately, there is not much documentation on the subject, so I want to take a few minutes to help describe what you can do with an NME extension, and how to create one. Trust me, it is not difficult.

include.nmml

Beginning with NME 3.2, all you need to make an extension is add a file called “include.nmml.” This file is processed just like an ordinary NMML project file, with the exception that paths are relative to where your extension is located.

For example, in the “Test” extension I have created, this is my “include.nmml” file:

<?xml version="1.0" encoding="utf-8"?>
<project>
 
	<ndll name="test" />
	<java path="project/android" />
 
</project>

You could include assets, defines, haxelib dependencies, NDLL references, Java code… practically anything you can define from an ordinary NMML project file for NME, you can define using your extension. Continue reading How to Create an NME Extension

NME Game Example: “Pirate Pig”

If you are familiar with webOS, you may have heard of Enyo, a Javascript framework which powers many of the built-in applications for the HP TouchPad. Recently, Enyo was released as open-source software, so you can use the framework on more platforms in addition to webOS, such as iOS, Android or BlackBerry.

If you need to create an application, Enyo is a choice you may want to consider. You can learn more at enyojs.com, and if you are a fan of Haxe-based development, there are externs for Enyo 1.0 on haxelib which can enable you to use the framework while also benefiting from the many advantages of haxe JS.

Although most of the samples for Enyo are applications, at least one sample, “Pirate Pig,” is that of a game. It is a quirky game that uses similar mechanics to Bejeweled. You can view the original version here:

http://www.enyojs.com/samples/piratepig/

The Challenge

I wanted to discover how difficult it would be to create the same game using NME. I would not use any of the original Javascript source code, but instead would use the same assets to recreate the same mechanics.

In the spirit of a game jam, I wanted to create the game in two days. In the interest of supporting my wife, I wanted to also keep it during the day instead of working late. Continue reading NME Game Example: “Pirate Pig”

Sample Native Extension for NME

I created a native extension sample for NME this morning that I would like to share with you:

http://www.joshuagranick.com/code/haxe/NME%20Extension%20Test.zip

Have you ever wanted to access your own code, written in C, C++ or Objective-C? This sample should help illustrate the “glue” that makes it possible to write and access native code from Haxe. I’ve also added a new “extension” tag to the NMML project file format which should make the workflow even easier. Continue reading Sample Native Extension for NME

Adding Screen Density Support to MineHX

MineHX was created a year ago. At the time, my phone used a native resolution of 320 x 480. Like most games, MineHX was designed specifically for only one or two devices.

Supporting multiple screen sizes, and worse, multiple screen densities, can be rather complicated. I’ve done some work recently to make this process less painful, and would like to share with you a sample from MineHX. The whole game is not completed at multiple resolutions, but there is still enough here that you can borrow or improve the concept for your own games.

http://www.joshuagranick.com/code/haxe/MineHX%20Sample%20(10-03-2011).zip Continue reading Adding Screen Density Support to MineHX

Cross-Platform Game Running in Flash *and* HTML5

I am very happy to share with you some of the first-fruits of integration between NME and Jeash — a working game!

Yesterday, I began the process of experimenting with adding an HTML5 target, thanks to Jeash. I am really impressed with how the project has developed since I last tried it out. Niel Drummond has done a great with the framework, as well as all others who have contributed to Jeash.

Similar to other targets in NME, I am publishing to Javascript using “haxelib run nme test MineHX.nmml html5”. Embedding assets as well as managing the build process is handled by the tool. I have unified Jeash with other targets, so you can still use a single API for loading embedded fonts, accessing bitmaps or playing sounds. The platform differences are being handled under the hood.

Flash

http://www.joshuagranick.com/examples/minehx/flash/

HTML5

http://www.joshuagranick.com/examples/minehx/html5/

NME 3: Flash, C++ and now HTML5

From the beginning, Haxe was created to be a “multi-platform programming language.”

NME relies on Haxe for reliable compilation to Flash and C++, but these aren’t the only languages Haxe supports. Meanwhile, a project (you may have heard of) called Jeash used Haxe to mirror the Flash API… but for Javascript.

For everyone who is excited by HTML5, you can now publish to Flash, C++ and Canvas as easy as…

haxelib run nme test MyProject.nmml flash
haxelib run nme test MyProject.nmml ios -simulator
haxelib run nme test MyProject.nmml webos
haxelib run nme test MyProject.nmml android
haxelib run nme test MyProject.nmml cpp
haxelib run nme test MyProject.nmml cpp -64
haxelib run nme test MyProject.nmml html5

Here is my previous “Actuate Example,” running in Flash and in Canvas as a comparison:

http://www.joshuagranick.com/examples/actuate/circles/flash/
http://www.joshuagranick.com/examples/actuate/circles/canvas/

Haxe NME Screencast Is Now Online

I have just posted a new screencast, walking through creating a new application with NME. The application compiles to Flash, Windows, Mac, Linux, webOS, iOS and Android. Starting with a blank project template, I load in bitmaps, create classes, add animations, handle key events, handle mouse events and cover some other principles that are great for understanding NME and how you can use it to create games.

http://www.joshuagranick.com/videos

The blank template I used to create this screencast is available for download, here.

Addendum

Later in the screencast, I test the application again in C++, and find that the background is not tiling like I expected. I have just tested and confirmed that setting “cacheAsBitmap” to true on the background Sprite will make it look identical in Flash and C++. You might also be able to tile graphics properly if your image follows a standard “multiples of 2” dimension.

Enyo Screencast Is Now Online

There is a new screencast online, building from a blank project template to an Enyo application with buttons, sliding views, events, custom kinds and more. This is a great introduction if you’d like to see Enyo code completion in action, or want to learn more about Enyo developer with Haxe Javascript.

http://www.joshuagranick.com/videos

The template I am using in the screencast is available for download, here.

Style Matters for Haxe JS, a “Kitchen Sink” Enyo Example

For many who are familiar with webOS development, “Style Matters” is a household name.

The original Style Matters was written by Tomomi Imura for the Palm Mojo framework. It was my favorite, “go to” reference when searching for standard CSS styles or deciding which widgets I wanted to use in my application. Following suit, the new Style Matters for Enyo is a wealth of widget and style samples.

The screenshot above illustrates check boxes. The source code for the application is broken up so that you can easily find the code which generated this page, and implement the same in your own projects. Continue reading Style Matters for Haxe JS, a “Kitchen Sink” Enyo Example