Welcome to the (late) August update for King under the Mountain! Apologies for the lateness of this, August was a crazily busy month personally, but I thought it still worth putting out a delayed dev update rather than nothing at all until the end of September.
The good news is that tooltips for nearly everything in the game have now all been implemented (thousands of words in total!) and there’s a new alpha build (Alpha 2.6) available on the Itch.io page for all current and future owners to get hold of with these tooltips in. As well as providing some super useful information to the player (especially to explain what a pillar actually does), this is also the start of background lore in the world of King under the Mountain with references to the magic system and the world at large.
Now that there’s larger sections of text in the game, it really started to highlight the issues with the font currently in use. King under the Mountain is built using LibGDX, a gamedev application framework that works as a fairly high level API over graphics (OpenGL) and sound (OpenAL) and other things such as input devices, but it is not a full game engine like Unity or Unreal. Instead, for example, it gives you commands to load images from a file as a texture, or draw those textures to the screen, or play a sound from an audio file. Everything on top of that is written by game developers so you don’t see as much similarity as you do with some games using Unity – not that that’s a good or bad thing! Slay the Spire is an amazing game also written in LibGDX, and it plays very differently to King under the Mountain! When it comes to text drawn on screen, LibGDX works with glyphs in a sprite sheet that it then renders to the screen, in exactly the same way other images are drawn to the screen from spritesheets. If you don’t supply your own font image, you get the LibGDX default which is Arial in 15 point and looks like this:
Early on I decided I didn’t want the absolute default to at least differentiate the game from other basic LibGDX projects, so I decided to use Google’s Roboto font, mostly because it’s designed to be clear and readable, but more importantly that it was also released under a permissive license – most fonts have restrictions around their licensing.
However, armed with the Roboto font file, it needed turning into a spritesheet of glyphs similar to the above. One of the several tools LibGDX provides is a tool called Hiero which performs this task. Running that with the Roboto font file produces the following (actually done for several different font sizes):
Note the greatly expanded set of characters to the above, this is to include cyrllic characters to support languages such as Russian.
That was all fine for a while, but it became apparent that the spacing around some letters (the “kerning”) was a bit off, leading to weird gaps in some blocks of text as you can see here:
It’s subtle, but the letter “e” tends to not have enough space around it, while the “a” has too much space in most cases. This has really bothered me for a long time and makes the game feel lower quality in my opinion. I put this down to a quirk of either the Heiro tool and/or the Roboto font and decided I’d replace it at some point in the future, because there was another problem I wanted to tackle…
Creating a spritesheet of glyphs is fine for the number of characters shown above, but as someone who knows a little Japanese, I really wanted to be able to include the main East Asian languages – Japanese, Korean and Chinese. The Korean language with only 24 characters in Hangul would be fine to add, but Chinese with potentially thousands of characters, and Japanese also using these alongside hiragana and katakana would potentially be too much to include depending on the size of the font and the max texture size allowed on any given graphics card. As an aside, games in 2019 and onwards can probably safely rely on a max texture size of 4096px in both dimensions or even 8192px, depending on how old the hardware that a game wants to support is, so this may be a non-issue by the time of release.
This problem of supporting East Asian languages in LibGDX is often discussed with several possible solutions. Most rely on the fact that there is an extension to LibGDX (gdx-freetype) that generates font bitmaps on the fly from font files, rather than the developer providing a pre-generated bitmap image like the above. From there you can either just generate the snippets of text that you need at any given time, or perhaps generate a spritesheet with all the characters your game is ever going to use but crucially not the entire set of Chinese characters that exist.
While I was improving the tooltips from what you can see in last month’s video (for example, improving the way they break over multiple lines and tidying up whitespace around them), I thought it was a good time to finally try to improve the game’s font too, now that there were larger sections of text which was really highlighting the kerning problem. Coupled with the desire to get East Asian fonts working, I switched from Google’s Roboto font to Google’s Noto font family as the latter aims to cover all unicode characters. Having added quite a large body of text to the game’s translation files, I figured I could calculate all the unique characters across every language and generate a font bitmap from these using the gdx-freetype extension to get closer to using the actual font rather than the pre-generated bitmap from Hiero.
In something of a happy accident, this led to a much clearer looking font with massively improved kerning:
Look how smooth the kerning and font itself is in “dwarven woodcutter” now! The light blue also denotes that you can hover over it for a tooltip, actually separate tooltips for “dwarven” and “woodcutter”.
It doesn’t look like much has changed in the UI but adding tooltips was actually a massive change to the way all text is handled in the game, and the main reason this took so long to get done alongside the large amount of words that needed adding. Instead of simple strings of characters, every section of text is now broken into sections which can have their own independent tooltips, which is what we see here for the dwarf’s description text. Those tooltips themselves draw more of this text which can have further tooltips, and so on from there. It also handles and inserts line breaks which is an incredibly basic feature of displaying text but something that I had to build on top of what LibGDX already does! I’m quite proud that the tooltip is neatly tied into different classes of each word that can be translated and replaced into other text, for example the noun, adjective and plural of “dwarf”, “dwarven” and “dwarves” would all share the same tooltip, and this tooltip would be applied to any text where this “single” word has been replaced.
This also means that with a slight swap of the default Noto font to one of the Noto font files that includes Chinese and Japanese, I was able to prove that, finally, these languages can work in the game (despite LibGDX making it slightly difficult)!
Now that all of this is accomplished, and the tooltips are in place, the game is in a good place to be opened up to supporting other languages. Alpha 3 is all about modding practically everything in the game, but I’m going to focus on translation support initially as there’s been quite a bit of interest and offers of help from the community with translations.
This month marks one year since the Kickstarter campaign was completed successfully, and while I’m sometimes frustrated by what feels like slow progress month-to-month, the game has developed massively since the pre-alpha that was available alongside the Kickstarter, right through to being released in Early Access on Itch.io and now heading towards a more polished, fully-featured Steam Early Access release! On that front, I’ve recently updated the Steam store page to be marked as “coming soon” in 2020 rather than 2019. I’m very sorry to push back any dates that have already been written down like this. The roadmap still has quite a way to go before I think the game is ready for the Steam audience, but I’m fully committed to getting it there in 2020 rather than any further delays!
And with that I’ll leave for a few more weeks until the September update, where I’ll get into more detail on how translations are actually going to work, and if you want to, how you can get involved and help out with them!