It’s been a long time since I used Haxe — my last commit to the Iridescence repository was over six years ago, and I haven’t been back to it ever since. When Flash finally reached its end-of-life and my old Flash games suddenly became unplayable, I realized that this would be a perfect opportunity to get back to it, see what had changed, and do a bit of digital preservation work while I was at it.
Continue reading →Tag / haxe
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:
R > B; G > B; B > G ! B -> [B]; B > R ! B -> [B];
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:
var reds = count(Pawns.Red); var greens = count(Pawns.Green); var blues = count(Pawns.Blue); if (reds > blues) fail(); if (greens > blues) fail(); if (blues > greens && !hasPathToExit(Pawns.Blue)) fail(); if (blues > reds && !hasPathToExit(Pawns.Blue)) fail();
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!
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.