Aloha!
Sorry for the lack of update last week - I've had really limited time to work on the game recently. Today I've finally had a productive day on the game!
I'm still focused on UI at the moment. I'm made lots of improvements to how the menus are put together and added better transitions between screens. I've also refactored my font system a bit. I haven't talked about my font system before so thought I'd explain how it works.
FontsMy fonts are all hand-pixelled, which takes a little time to do but allows me to totally tailor the font to the style I want. I have three fonts at the moment - small, medium and large. They will undergo a bit of tweaking at some point but I probably won't need to make any new ones, as the game isn't exactly text-heavy.
The image for my small font looks like this:
It's the standard
ascii* layout. The font is rendered in two layers, similar to how my tiles are rendered, so the outlines (the lower half of the font image) can be coloured seperately, and can blend seamlessly with outlines of neighbouring characters.
Kerning (the process of determining spacing between individual characters) is done automatically when the font is loaded. For every possible pair of characters (aa, ab, ac, ... ), it runs through each row of pixels and calculates how close together the characters can be without overlapping. For this I ignore the font's outline layer, so the outlines of the two characters end up overlapping.
Here's an example of some text with kerning (left) and without (right). The kerning puts the "Fi" and "ct" a little closer together, which to me looks more natural and readable.
In some situations this kerning step can actually just make things look worse, particularly when punctuation is involved. I also find that numerical characters 0-9 look better when they have a consistent fixed width, especially when being used in a timer or counter that changes a lot.
I solve these problems by using a pixel colour in the font (dark turquoise in this case) that isn't rendered, but is taken into account by kerning. That gives me flexibility to fix bad kerning situations where I need to.
In the case below, the punctuation looks too cluttered on the default kerning (right). By adding the kerning adjustment (left) below the quotes and above the period, it looks a lot nicer.
The final thing to note in the font image is the top-left character, with three lines in it. These lines represent the top line (the height of capital letters or tall characters), the mid line (the height of lower case letters) and the base line (the line the characters sit on). These are used for vertically aligning the text in the desired way when it is rendered.
The new feature I recently added is the ability for a font to be put together from multiple images! I call these pages. Rather than using ascii, the characters in the additional pages each have a name. This name is referenced in the string, e.g. "Press &xboxA;", to display one of the additional characters.
So now I can use a single font with three pages to display some button prompts.
Hurrah! This will also be useful for the controls customisation options.
Supporting multiple pages in my fonts will also make it far easier to add non-ascii characters if I want to localise the game later.
* actually this wikipedia article is pretty interesting!