Gaming Your Way

May contain nuts.

Flash is for video, apparently

Today was the start of the big UI push, which I've been putting off. One thing I really wanted in the game was video clips to show the different power-ups so the player could select which one they preferred and could see it in action.

As we're using a combination of Away3D and Starling, I can't use stageVideo. Because it's always displayed beneath everything means trying to cut a mask out would just be a nightmare and not even worth thinking about.

My first thought was to use a sprite sheet, just load it in on demand and update a sprites texture every frame to make a cheap and cheerful video clip.

I made my grab ( Using Screenflow, OSX only I'm afraid, but the best there is ), imported it into Flash and spat out the png frames. Nope, even with it just being 256x256 it blew the 2048x2048 texture size and it was only a short clip.

Ok, let's try FLV using the native display list. It's probably going to run like a pig but best to test these things. Unbelievably it performs well, the clip is really high quality albeit small, but it worked much better than I thought.

Cool, problem solved. Let's just get it looping and... hang on, what now ? Looping it ( Check for it to be finished via an event and then tell it to seek(0) ) makes it glitch really badly, there's a delay, sometimes a fraction of a second, sometimes a whole second. It's a 68k clip loading from a SSD, and it's not streaming quickly enough at the start. For fucks sake.

The solution I came up with was to make a feature of it ( As I'm not going to be able to fix it ).

I grabbed the last frame and used the excellent ImageGlitcher to make it look distorted on purpose. Not ideal I know, and I'm going to have to screw around doing this for every different clip and manage all that, but the best I can come up with.

I should really comment about what a fiddly pain using Flash's own perspective is and trying to align that with an image in Away3D ( Or just trying to get a grab that's loopable ), but I've been moany enough for one post.

Squize.

Comments are closed