Vacation, Localization and GIFs
July 3, 2018
Hey, what's up? My name is Henrik Chukhran aka "Neuton Mouse" and this is my blog. I'm planning to post here about game development, music production, sound design, gaming in general and other related stuff. Most of these posts will deal with my own projects but sometimes there will be exceptions. Feel free to subscribe to my newsletter or follow me on one of the social network pages placed below here.
July 3, 2018
June was quite relaxing and somewhat unproductive. After events of previous post I was pretty exhausted. The beginning of summer brought immense chunk of heat which made any attempts to do work even more harder so I decided to take a break from gamedev for good. Although, some side work still had its place during recent moments and that’s what I’m going to talk about today.
Before the break I was heavily working on Localization features. Having multiple languages is a must have in serious projects as it allows to reach a much greater audience on this planet. Not everyone speaks English and for me, apparently, this fact is hard to grasp. Interestingly, I know that some of my friends and acquaintances prefer their native language in games even though they know it by hearth. As for myself there were always preference towards English language in games from the very first days of my gaming life. Another reason of that preference could be that in early days game translations were horrible. At certain moments that was a deal breaker.
First obstacle appeared on the radar right way. Realization that Unicode character is in fact a sequence of few characters, from 1 up to 4, came after numerous attempts to debug the code in the wrong parts. It all started with a simple function to get a character from specified position of the string. I needed that character access for two reasons: first one is about dealing with keyboard input and second one is all about drawing flying letters as seen in every screen (except the main one) in Smintheus. Keyboard input wasn’t necessary for the gameplay from player’s perspective but it was a must have for level editing as I had to enter couple of strings inside game levels.
When that little ignorance ended, a new obstacle entered the scene. It appears that most custom fonts have a partial support for various characters (Duh!). Font that could draw Latin and Cyrillic letters could be missing those special characters that a present in European languages. This meant that I had to either inject those letters manually to the existing font or… search another one, preferably free one. For lazy ass reasons I picked the obvious choice :)
The last issue I had to deal it is to replace all built-in strings with the get_string function. That was rather a nuisance because at the end I had to replace nearly 500 strings all over the code. Besides that I had to write some sort of string database and give each of the string a special Enum code that would represent position in the string array. I could go with string searching but main concern was the access speed – see, accessing array with a fixed position is much faster than looking for hashed string.
String database was divided into couple of segments. That made it more organized and readable. I decided to use Lua for localization files. I already had a wrapper installed so why not use it? Besides, I added couple of functions that dealt with fonts. At the end it turned out to own mini-modding capabilities. That one file was divided into 3 files, each one responsible for certain group of strings: common strings, achievements and level related strings. Speaking of last one, I grouped 4 lua tables per game world, each one responsible for dialogs, signs, miscellaneous (like custom gadgets, quest descriptions, etc) and map texts.
Lastly, buttons in main menu were hand drawn. It will be the most hardest part in game localization mainly because it involves… drawing :). I’ve added few more functions to deal with those buttons to prevent possible issues in the future.
For the testing purpose, I’ve used Russian language for my first localization. I’m planning to have Hungarian, Slovakian, Romanian, Polish and Ukrainian languages at start (all the neighbours). I have local contacts that may help me translating the game into German, Chinese as well as those languages mentioned above. Personally I can deal with Hungarian and Slovakian but I'm not that good to translate certain twists and idioms or give those sentences a nice sounding vibe, you know… make ‘em prettier. In conclusion, I'm very happy of the outcome of localization feature – it turned out to be quite readable, versatile and easy to edit.
What have I learned from this? Learned that localization should be taken into consideration from very early development stage. I didn’t thought about it and payed for that extra working hours.
I forgot about one thing to do during the SDL migration process – migrate Algif5 library, gif animation support for Allegro 5, to SDL2/SDL_gpu. Because of petty quantities of GIF animations I totally forgot about them.
So, why GIFs for Smintheus? Well, they act as short video tutorial. Instead of writing shitload of text explaining the mechanics in details I wanted to show little animation that would make things pretty much clear to anybody. That’s it!
The problem was that there were no similar libs to Algif5 that were easy to include and deal with. I tried nearly every possible variant through out the github and all of them failed to deliver desired result. One thing that drove me crazy is that some of those projects were written as it is, without having highest warning level enabled (-Wall). As a result I got lot of warnings from those files. It’s not really a problem and it’s fixable through #pragma warning(push,0) and #pragma warning(pop) but it leaves that bitter aftertaste.
So, I ended up writing a wrapper for infamous GIFLIB. I had to deal with low level programming, which was interesting, but it was quite hard and time consuming because I sucked at it. Nevertheless, I managed to achieve animations and gain valuable experience in that field. Funny thing that when I was thinking how to properly get frame delay from all that packed mess, my search results from github came up with SDL giflib wrapper. Quickly installed it, compressed GIFLIB and Wrapper headers and sources into two fat files, included in the project and successfully integrated engine with it. I looked at wrapper’s source and finally found some answers – dude who wrote this wrapper – please accept my greatest gratitude :)
I had only one fatal obstacle – disposal method. Frankly speaking, I didn’t quite understood how should I render optimized frames without having issues so I found a quick solution: unoptimize current GIF animations through ezgif.com. It made them weight about 1 to 3 megabytes at end but everything worked just fine. Strangely, I remember that loading GIFs via Allegro 5 actually took few seconds to load but with the new approach things got really fast despite the fact that files are 3x to 10x time heavier.
Whole spring was fully dedicated to game development. March was all about finishing soundtrack for first levels. Later beta was released, tested and improved as well as migrated to SDL2/SDL_gpu. Did some marketing and made a trailer. Website got updated too! It was productive season but at the end I got tired.
I didn’t wanted a full vacation because time is running and I really want to release the game already. Development of Smintheus dragged on and realizing how much time I burned on this project and still had no complete result was really stressful. At the same time I didn’t wanted to rush because we all know what happens to rushed games… If I do rapid development the game might easily collapse, so I have to stand persistent with my tempo and do as much as I can. Eventually it will be released.
Difficulties rises with so called motivation. I have my own buttons that needs to be pushed to get me super motivated. They aren’t complicated but a bit specific: I got to go outside somewhere and stay there, preferably for few days. It should take place in countryside, near the nature and far away from civilization. Two or three day vacation will get me charged for month, taking that it will be high quality vacation.
I couldn't capture the right moment, the ideal one that I really wished for, instead I had a lot of mini-vacations through out the whole month. Fishing, hiking, taking part in spontaneous events and travelling to neighbour places just to relax. This is not exactly efficient for my motivation but it had some effect over it.
Generally speaking my head was turned off from the project. Alas, not from the whole game development. I spent bored hours to learn something and practice my programming skills. There wasn’t a day that went by without learning anything new or at least hardening existing experience. Such improvised vacation worked and managed to get charged for next phase – finishing levels and then putting full stop on project’s development.
You can keep in touch with me by subscribing to mailing list. One in a while you'll get one of these:
Ssup people! In this post I will cover game development span that took place in July, August and first half of September. The...View post