Gaming Your Way

May contain nuts.

Let's have some UI in there

The past couple of days I've been working on some of the UI aspects of the game, the level complete sequence in this case.

I thought adding a star rating would be a nice touch, adds a bit of replay ability and enables me to add a simple achievement or two. Little did I know what a complete ball ache it was going to be.

I wanted to use Away3D to display it as I wanted perspective on the panel. In the main game the camera is constantly rotating around, so I thought I'd just figure out where the camera is looking and position the panel relative to that, updating it's position every frame so it appeared static.
Simple in theory, but totally beyond me. I just couldn't figure a way out to work out where the camera was looking ( There's camera.projec()t, which I guess is the way, here's the docs for that ). After dicking around for hours, I cracked and binned that approach, the maths is beyond me.

So let's just add another view and another camera and treat it as a separate entity from the main background. Sweet, all done. Now let's add some love to our texture, a specular map and some nice lighting. Sweet, that looks awesome, I'm really pleased with it, and I dropped some lens flares and moisture effects on top using Starling, looks great. I guess I should test it on the iPad now...

...ah, it runs at less than 30fps. Bollocks.

I've just spent the last hour or so removing all the sexy love I'd added in there, it still looks pretty good ( The grab above is from the cut right back down version ) but it was painful to do.
In my other recent iPad project I found that scaling images seems to cause a real hit on the first time, I don't know why, mipmaps being created on the fly ? Which means that you have to display your meshes scaled up but hide the textures with alpha=0, wait one frame, hide the meshes and restore the textures, that makes it skip that initial performance spike.

All in all a lot more painful than it should have been, but it does look good in motion, those stars fly into it and have a little impact shudder and as you can see a shower of particles. When I get some sound in there the impact should feel nice and weighty.

And that's what my last two days have been.

Squize. 

Comments are closed