Currently I have been thinking very carefully about how to handle localization / internationalization / globalization (I’ll just call it localization for the rest of this post). Nereid (from irc.enterthegame.com; #fragbu) gave me a run down on his thoughts when it comes to dealing with localization. Originally, I had only considered localizing text, but he had considered localizing everything. Everything ranging from textures to sounds. When I considered that, I also agreed that this is a logical step in the way game engines should go perhaps. With the internet getting faster in more remote areas of the world, it is inevitable that people will be able to get their hands on your game. While supporting English is an obvious choice, it shouldn’t be the only choice. Certainly in countries like Japan, games that only support English don’t get very far!
However, there are two main problems that immediately come to mind if you are trying to localize everything. First of all, data look up can be a rather lengthy process and I had to put some limitations in the ways people could look up data. Secondly, because data look up is a lengthy process, physical data seeking could also be a problem.
The way Brute Engine handles data look up is by using URI (Uniform Resource Identifier) structure. URI’s have three strings in them, a package string, a group string and a resource string.
The package string represents the file name of the zip without the extension. All packages have the same extension (currently packages are just zips at this point, so for ease of development are just zip).
The group string represents a folder within a package. At first I would have liked to have an array of groups rather than just a singular one as this would have allowed developers to sub divide packages into clearer names. However for the sake of fast data look ups, I decided that only a single group would be best for now. Perhaps this may change in future, I’m not entirely too sure at this point since I have not actually bench marked the performance between having a single group and having multiple groups.
The resource string represents the file name within the package and folder. For now, the resource string does have an extension attached to it, although this may be dropped in favour of having a integer to represent the data that the URI. But at the moment, an extension is useful for development purposes.
Resources vary a lot depending on the resource type they are. Some resources may hold binary data, while some resources may hold human readable ASCII data. Others may be a combination of the two. Typically, the rule for this engine is that anything made by the engine & tools alone will be human readable XML data uncooked which can be cooked into a binary form (for faster loading and parsing) and everything else will be binary (since the data is created by another program, developers should have these stored in another file). More importantly, some resources are composed on multiple files.
A example of a complex internationalized resource, that I can think of right now, would be a sound resource. A sound file is composed of multiple files in order to provide internationalization.
- One file stores the raw sound data as an array of 8-bit samples.
- One file stores the sound sample rate and other sound related numbers.
- One file stores the localized sub title text
In order to provide good localization, when Brute Engine goes to load this sound file, it must compose a virtual representation of the sound files that best represent the localization the user has chosen. This is only difficult because, not all localized versions of those sound files will contain those files. Since English is going to be the presumed fallback language, all English localized sound files would probably contain all three files. However, a French localized version of the sound file might only contain localized sub title text data … because the developer may not have hired someone to act the dialogue in French. So let’s say the user is French, and the sound is requested by a component to be played back. Thus when loading the sound file, Brute Engine will first load the French localized version, and if any other data is missing, it will then fall back through localized versions of the same sound file! (This is because Brute Engine doesn’t rely on just dual localization, it can handle variants of a language too, thus you may have French-Canadian localization which overloads a few things from the French localization which overloads many things [but not all] from the English localization).
Phew, that’s a bit of a mouthful and certainly a lot to keep in mind. In order to support this properly, I had to build some sort of a tree like structure to organise how this all works.
Lastly, to touch base on a subject that most people aren’t even concerned about is data seeking. Obviously with this sort of localization method, there is a lot of power and flexibility behind it. However, the data for a ’single’ sound file is distributed all over the place. Thus if the game was to be run off a CD/DVD/Blu-ray disc, loading times would be atrocious since the ROM drive would spend half the time just seeking to the right portion of the disc. However, since most consoles are region specific, it might be possible to simply cook the the fully localized development version into a single language specific version of the game. I certainly don’t know the dynamics of the cost involved with distributing language specific versions of the game … but it would solve this issue rather nicely! On the PC this problem isn’t really apparent since hard drives are pretty good at seeking for random data at random points on the drive, although loading performance is often increased if the data is all aligned by defragging the drive.



