Game Development Reference
In-Depth Information
Mark: “We have our own localization tool. Every game has its own dictionary file that
stores each text in the game with a unique ID, in all languages. We make a special
tool to edit these texts. A lot of texts are not game specific, and they are part of our
framework, so we export them together with the game-specific texts. Our tool can
also generate this data as a spreadsheet so we can send this to a translator who
then simply has to fill in a single column. For localization, it is important that all your
code works with Unicode, because you want to be able to work with Asian fonts
as well.”
Peter: “With Angry Birds we created a game that works everywhere, because it is
mostly visual. We localize the little text that we have in the game. Although you could
build games created for very local markets, we design our games such that we use
very little text, so that there is very little requirement to do any localization.”
In addition to localization, you need to make sure your code is as compact as possible when you
release your game. All the example code in this topic is distributed over several files. When you
release your game, ideally you want all the code in a single JavaScript file. You also may not want
players to be able to easily understand your code. For example, if you've written an innovative
algorithm for dealing with physics in games very efficiently, you may want to avoid others copying
that code from your game so you retain a competitive advantage. A very useful tool that helps you
do all these things is Google Closure ( https://developers.google.com/closure ). Closure allows you
to compile your JavaScript files into a single file that is optimized for size so players can download
it quickly. You can choose the level of optimization that the Closure compiler uses to generate the
optimized JavaScript file. Closure's highest possible level of optimization is known as the advanced
optimization level. If you were to open and read such a highly optimized file, you wouldn't be able
to make much sense of the code. Therefore, this advanced optimization mode is also called code
obfuscation mode . Obfuscation is useful because it allows you to protect your code from copying
by others.
Mark: “We use the Closure compiler from Google for minification and obfuscation,
which can be run in three different modes. The first two modes are basically only
minification. The third mode is a kind of recompilation where code is rearranged,
unused parts are removed, and so on. Our condition is that any game code we
release needs to be able to go through that process and still come out working
afterward.”
Code obfuscation may introduce problems when you call code from an external library. In that case,
the obfuscation process shouldn't change the names of functions or variables that you call from that
library, because then the names won't match anymore. You have to either provide directives to the
obfuscator so it doesn't do renaming operations in those cases, or avoid using external libraries.
Search WWH ::




Custom Search