Meet Hutch the best friend of Starxi!

Hey folks, today I’m glad to introduce you Hutch. This post follows my thoughts from a previous one. I was looking for the next tech for providing mobile, desktop and web games. Starling is great, but since Flash Player is dead again, its future is less brighten. I used Flambe in the past, and was pretty happy but today it isn’t supported anymore (though we’re waiting a long time announced update!).

Looking for a good cross-platform 2D engine
I looked the interesting series of blog post by Prime31 seeking for the best 2D game engine/platform. He finally choose MonoGame, but unfortunately for me it doesn’t export for the web. In his evaluation it meets many Haxe frameworks and LibGDX. Being not so much familiar with Java and with the death of RoboVM I don’t considered LibGDX as an option.
Concerning the Haxe libraries, my issue is still the same: there aren’t enough Native Extensions (except for Flambe which targets AIR) and the js minified is close to 1Mo.

On an other part, I enjoyed working with Pixi.js and Haxe thanks to this extremely well supported externs. Unfortunately, targeting mobile application with HTML5 is a nightmare. Cordova‘s performance aren’t really good and Cocoon is just an expensive black box…

So what was the solution?

A mix of Starling and Pixi! The best of both world:
– Starling: a nice framework working fine on mobile and desktop with all the ANEs that I need.
– Pixi.js: the fastest HTML5 2D engine!

The idea came when trying NextGenActionScript. We’re able to code in AS3 and using Pixi.js that’s cool! So I started the Hutch framework using AS3 and conditional compilation, but quickly an issue came to my mind: “ok, I’ll have a display list managing both frameworks but it will be complicated to use other external libraries. For example, if I use the Box2D physics engine, if the JS implementation is not the same than the AS3 I will not only have to make a proxy API but manage the differences!” No way!

I’m a huge fan of Haxe and its awesome community. By the way today starts the WWX (awesome linup, but unfortunately I can’t participate this year), that’s why this blog post is out today. Hutch being far from stable!
A library coded with the Haxe programming language will work on all the Haxe’ supported platform, and trust me there are many! So without any doubt, Haxe is the solution rather than AS3.

Hutch is a Haxe framework exporting on the web via WebGL (thanks to Pixi.js), on desktop and mobile via AIR (thanks to Starling). Hutch offers a nice layer of abstraction since (mostly) you don’t have to bother if you’re targeting Pixi or Starling.
Starling & Pixi share a close architecture since they’re based on the traditional Flash display list architecture. Hutch respects this architecture. It is closer to the Starling’s one because it is itself a port of the Flash display list for Stage3D, whereas Pixi has mostly borrowed the display list architecture to help Flash developers move on HTML5.

Hutch is pretty new, there are many things to do! In a long run, only the raw assets will depend of the targeted platform. Its goal is to have exactly the same behavior regardless the targeted platform. It wouldn’t pretend to be the next big thing, just a good cross-platform framework for making (small) HTML5 and mobile game.

But enough talk, let see it in action:
HTML5 demo.
Flash demo.

You can click on the bird. I used the Actuate library for tweening.
The demo code:


import hutch.display.Image;
import hutch.display.MovieClip;
import hutch.display.Sprite;
import hutch.text.TextField;
import hutch.textures.Texture;
import hutch.utils.AssetManager;

import motion.Actuate;

class Game extends Sprite {

	var bunny:Image;
	public function new() {

		#if starling
			touchable = true;

		var text = new TextField("Welcome to Hutch :)", "Arial", 24, 0xFF0000);

		text.y = 150;

		var assetManager = new AssetManager();

		#if starling
		#elseif pixi

		assetManager.load(function() {

			bunny = new Image(assetManager.getTexture("bunny.png"));
			bunny.pivotX = bunny.width / 2;
			bunny.pivotY = bunny.height / 2;

			bunny.y = 50;

			var bird = new Image(assetManager.getTexture("starling.png"));
			bird.x = bird.y = 300;

			bird.buttonMode = true;
			bird.touchable = true;

			bird.onTouchBegan.add(function() {

				bird.scaleX = bird.scaleY += 0.1;

			var mc = new MovieClip(assetManager.getTextures("explosion_"));
			mc.x = 400;

			Actuate.tween(bird, 1, {alpha:0.2}).repeat().reflect();

        	Actuate.tween(bunny, 1, {alpha:0.3, x:205});

	public function onUpdate(elapsedTime:Float) {

		if (bunny != null) {
			bunny.rotation += 0.01;

Hutch uses and certainly abuses the Proxy pattern. The goal is to have almost no compilation flag on your side. I’m pretty sure many things can be improved thanks to Haxe macro, but I didn’t learn them yet…

Anyway, the journey has just begun there are many things to do. If you’re interested, feel free to contact me!
Again Hutch is pretty raw, at this time this is more a proof of concept than a real framework, the WWX was an occasion to not miss and give to Haxe the hype it deserves.

Oh and I hope you get the tilte’s joke 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.