Usability Changes
December 19th, 2008
I spent today making usability changes to the game. Several of my testers had noted that certain mixing rules for the colours took longer to learn than others. Today I put in a “Mixing Guide” popup. If you look at the screenshot of the game posted on the Dapple site, you’ll see a colour wheel/palette at the bottom of the screen. It was there to provide the user a hint as to what colours mixed to form new colours. However, now if you hold your finger on the colour wheel, a handy popup comes up that actually shows you each of the mixing rules for your current colour. I think it should really help new players learn the rules of the game better. The best part is, the solution didn’t require any new screen-space! Hooray!
The other big change I made today was to the colour-blind mode art. One of the people testing my game is partially colour-blind, so the feedback I get from this person is great. They pointed out a few issues they were having with the art as I had currently done it. Today I completely reworked all of the colour-blind mode artwork and I think it’s much more successful. I know that I find colour-blind mode much easier to play with the new art. Once I get a new build out to the testers I’ll see if they find it to be the case.
Technical part of the post now (nerd alert!):
Earlier this week my artist pointed out to me that semi-transparent whites in the game weren’t blending properly so yesterday I spent the afternoon tracking down yet another alpha blending bug. The problem was this, for anyone else who runs into this issue:
In my OpenGL initialization code I was initializing alpha blending like this:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
This is the way most websites (and the OpenGL Red Book) tell you to normally initialize alpha blending. This produces the effect that you normally want from a blend. However, what I hadn’t realised is that when you load a PNG textures through UIKit or Quartz (i.e. you load it into a CGImage or a UIImage) the iPhone pre-multiplies the alpha! This means that if you have a texture that’s got a semi-transparent white in it, when you layer it in your scene, it will actually darken the texture behind it. This is not usually the desired behaviour.
The solution is then to ignore the source alpha on the source, but still use it for the destination, then do your own alpha modulation at the time you draw the texture. So the blending function you want is actually this:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
Then when you go to draw the texture, modulate the colour of the vertices by the alpha value for the verts:
glColor4f(red * alpha, green * alpha, blue * alpha, alpha);
Now you’ll have stuff blending the way you want. HOWEVER, if you started with the CrashLanding demo, it has some really handy code for drawing dynamic text. Because these textures are created on the fly, their alpha is not pre-multiplied. This means that when you’re drawing the dynamic text textures, you have to change the blending function back to the original one above. So you need two different blending functions, depending on whether or not the texture was loaded, or created dynamically. Isn’t that fun?!
If you want a much longer discussion on this, read this forum thread (most of the relevant stuff is near the end of the thread):
- Multiply Blending Problem (www.idevgames.com)
Thanks to a friend of mine for helping me find this info. I’m not sure if he’d want me to mention his name or not, so I’ll leave it out for now.
Have a good weekend everyone!
Owen





