Gold Leader on GameShed!

Gold Leader (Flash) has been released!  GameShed made an offer late Sunday and by early this morning (Wednesday) it was all resolved and posted.  Check it out!

Gold Leader on the front page of GameShed!

Gold Leader on the front page of GameShed!

All in all I’m super happy with how this turned out.  GameShed seems pretty legit and so far the game’s been well received there.  As importantly, the GameShed people were super easy to work with, their API and branding were easy to incorporate, and they seemed genuinely excited about the game.  Based on their comments and the artwork they pulled out, it was clear they’d played through it several times, and the play tracking on FGL shows them looking at it quite a bit.

Though it’s short and simple I’m super proud of how Gold Leader turned out.  It’s a fun, well implemented game with a high level of polish and it found a great sponsor, so go give it a whirl!

Play External SWF MovieClip from Haxe/NME

To tease with some exciting news, Gold Leader has been picked up for a sponsorship!

On an immediate coding topic though, this has meant dealing with something I’d been dreading: Incorporating the sponsor’s splash screen.  As expected they gave me an FLA and compiled SWF.  Fortunately it turned out to be just a simple movie, no buttons to hook up or anything.  Quite typically for Haxe/NME/ActionScript, making this work turned out to be not muchcode, but kind of a pain to figure out.

NME, along with the SWF library, does now include some cross-platform support for playing SWFs.  Josh Granick has notes here, although be sure to read the comments as the API has been updated since that post (I don’t see a particularly better update post).  However, as far as I can tell, at the moment this only supports the graphics.  It wouldn’t play the sound effect associated with my movie and threw an error trying to decode it (something like “Unknown sub-tag SoundStreamHead2,” where the latter begins the encoded sound chunk in the SWF).

I really only care about playing the SWF in Flash though, so happily instead I can just have Flash load and play the movie.  First off, the movie gets included in the compiled program SWF as a binary asset.  Simply copy the movie SWF into your assets folder, include with the assets command in your .nmml as usual, and NME will assume it’s a binary asset.

The code to then play that movie clip looks something like this:

import nme.display.Sprite;

import nme.Assets;
import nme.Lib;

import nme.display.Loader;
import nme.display.MovieClip;
import nme.events.Event;

class Main extends Sprite {

public function new () {

  super ();

  var bytes = Assets.getBytes("assets/splash.swf");
  trace("Bytes " + bytes.length);

  var loader:Loader = new Loader();
  loader.loadBytes(bytes);

  loader.contentLoaderInfo.addEventListener
    (Event.COMPLETE,
     function (_) {
       var mc:MovieClip = cast(loader.content, MovieClip);
       trace("Frames: " + mc.totalFrames);
       mc.addFrameScript(mc.totalFrames-1,
                         function():Void {
                           trace("Done.");
                           mc.stop();
                           removeChild(mc);
                         });
       addChild(mc);
     });

    // end main
  }

  // end Main
}

Note that you could skip the dynamic cast to MovieClip and simply add the loader object to the stage/parent directly. However, I need the movie object itself so I can detect when it has stopped and move on to the actual game.

That last point is itself somewhat interesting. Utterly shockingly, ActionScript3 has an event for absolutely everything except movie clips completing. Seemingly it’s just not there, doesn’t exist… This blew my mind.

What most people do is add a function to the ENTER_FRAME event that checks every frame to see whether or not the current frame is the last frame, and throw another event or set a property if so.  However, Flash internally can associate a script with each frame, to be executed as it plays.  The seemingly undocumented function MovieClip.addFrameScript() allows you to add a function to particular frames of the movie.  In general you’d have to be careful about blowing away other code, but here I don’t have that problem—there’s nothing there, and I just want to bail.  So, I add a function to the last frame of the movie to do some housekeeping, and we’re all set!

Like I said, this is all fairly simple in the code, but I haven’t seen anybody spell out how to make this work, so hopefully this will be of use.

e7

In a discussion about mutable terrain somebody mentioned e7, which turned out to be pretty amazing.  The first, most obvious standout is the gorgeous visuals:

These static shots don’t do it justice.  You really need to see the parallax, lighting, and the little details like meteors or ships crashing in the background to fully appreciate it.  Although very sparse, the world does also have some nice little touches like the sunken ruins you can see in the first screen shot.

Excellently complementing those empty, haunted scenes is some similarly quiet, eery audio.  Most of it consists of just the wind blowing and occasional beeps and knocks as you do things, with just a few musical notes to accent the mood.  It’s very subdued and conveys a quiet, exploratory, introspective atmosphere perfectly.

Finally, the gameplay is pretty novel.  You slide around the world like a little hockey punk of a drone or ship, deforming the terrain (maybe via some local gravity generator or something???) and then releasing to launch yourself around as it rebounds.  Using this you need to jump and wall jump between platforms, as well as hurl yourself at unfriendlies to knock them apart.  It’s a really interesting mechanic and implemented well, it all runs really smoothly even on my older laptop.

The one downside of the game is that I think it takes the mechanic a bit too far.  Some of the fights are very difficult, time consuming, and very easy to fail at the last moment and have to start all over.  I couldn’t bring myself to play through the last third of the game and wound up watching a YouTube recap to catch some highlights and the end of the story.  The latter was also somewhat predictable, but basically the way it had to be given the atmosphere.

So, e7’s not a game that I think has a ton of replay value or long term engagement as it’s somewhat of a 1-trick pony, but it’s well worth giving it a play for the great aesthetic and the novel gameplay mechanics.  You can check it out on Jay is Games as well as a bunch of other places.