Tag Archives: haxe

Iridescence mobile development update

When I was at the Boston Festival of Indie Games with Iridescence, I’d tell anyone who asked about the mobile versions that they were about two or three weeks out. At the time I had every reason to believe that to be the case, but it turned out to be a little more complicated than I had anticipated.

This will be a moderately technical post, so the short version: Iridescence is still coming out on mobile devices (iOS, Android, and even Windows 8 phones), but it won’t be as soon as I had hoped.

Now onto the technical side of things.

Iridescence is written in Haxe, which is a language that aims to act as an intermediary between platforms. Instead of writing C++ for desktop platforms, Java for Android, Objective C for iOS, and C# for Windows phone, Haxe allows you to write in one language for all platforms, translating itself into the one that’s best supported by each target. On top of Haxe comes OpenFL, a framework that mimics the Flash API but has support for OpenGL and runs as a native application. A single codebase, a familiar API, and great performance? Almost sounds too good to be true.

It is.

A week before launch, I plugged in my Android tablet to get a build running. It had been my intention to have a tablet on the exhibition table so people could see the game running on a variety of platforms. I’d had it working in the past without any issues and without having to change a single line of code, so I expected it to be uneventful.

It wasn't.

It wasn’t.

I’m at a total loss to explain what’s going on. At first I thought it was just a matter of the renderer acting up, but the music doesn’t start either. Worse, I get this same behavior if the app is entirely empty. Other games work just fine, so it’s not a problem with the device. On my friend’s brand new Moto X nothing displays at all, so it’s not a matter of the tablet being below required specifications.

I’ve spoken to the OpenFL community and development team to no avail. A new beta version of the framework came out and had the same problem. Worst of all, I tried to roll back to an earlier version that had worked before and I couldn’t even compile. The OpenFL ecosystem is in a constant state of flux, with new build toolchains and dependencies popping up seemingly every time it updates, and the older (working) versions weren’t compatible with the new tools.

At this point it was time to start considering my options.

  • I could hunker down, wait for another OpenFL release, and hope that it would solve my problems.
  • Or I could bite the bullet and port the whole game back to C# (the language I wrote the original gamejam version in) and use Unity.

I’m choosing Unity. I’ll be using the Futile framework, partially because the API is Flash-inspired and will be easier to translate code between, but mainly because it’s a fully code-oriented workflow and only has support for 2D. When I first started working on the improved version of Iridescence Unity still didn’t have support for Linux and doing 2D work was a hassle. Not so any more. When I’m finished, this version will replace the current Windows/Mac/Linux Haxe-based one.

It’ll be a tough road but I’m ready to do what it takes. I leave you with the first step.

long road

Stuck Scripting overhaul

Early on in the development of Slide (before Iridescence had come to be), I added support for small script files to allow levels to contain more complicated puzzles without running into false positives that caused the reset button to show up while the level was still perfectly solvable. I was using C# at the time, and options for proper scripting languages on the .NET platform are shamefully limited, so I rolled my own.

Here’s a sample of what it looked like:

The use-case for stuck scripts is extremely specific, so the language itself didn’t need too many bells and whistles. All I needed to do at any time was compare the number of game objects of a given color, and check if pawns had a valid path to their targets. The snippet above basically translates like so:

The puzzle is unsolvable if any of these are true:

there are more red pawns than blue
there are more green pawns than blue
there are more blue pawns than green, unless all blue pawns can reach a target
there are more blue pawns than red, unless all blue pawns can reach a target

Needless to say, it’s as ugly as it is functional, and adding new features proved difficult. The inflexibility of the original design meant for some truly impressive hijinks as I tried to implement more complex behaviors with only the original syntax.

Today I stripped the whole system out and replaced it with a new one. Since I’m using Haxe for this remake, I was able to take advantage of hscript, a subset of Haxe that allows for runtime interpretation. Now, the script above looks like this:

Much better.

The original scripting system was designed as a black box, with a minimal number of inputs and outputs. By keeping the interface consistent between implementations, I was able to completely change the underlying code without changing any other aspect of the program. It’s nice to be able to change something so integral to the gameplay without worrying about side effects.

Menu work

This week in development on Iridescence I’ve been focusing on menus, settings, and save data. Here’s what I’ve implemented as feedback when the player tries to open a level that hasn’t been unlocked yet. The animation is inspired by WordPress’ login window, and I think it’s pretty clear what’s going on.

Color/Shift demo

Since Slide originally came about as an entry for OneGameAMonth, I thought it would make sense for me to release the Colorshift demo as one as well!

iconWindows iconNG Get it now!

This is an early release that doesn’t add any additional levels beyond those included in Slide, so if you’ve played it already there won’t be a lot more to see here besides a bunch of bugfixes and some polish to the core mechanics. I’m still working on adding a bunch of extra features, like drag-and-drop support for custom levels and a menu to replay puzzles you’ve beaten already or resume where you left off.

I’m working on native builds for Mac and Linux, but for now non-windows users can play in a browser at Newgrounds.

Please let me know what you think! I’m still in heavy development and I’d love to incorporate your feedback and criticism.