Game Development Reference
In-Depth Information
A tool to help you write better code is JSLint ( www.jslint.com ) . JSLint is a so-called code-quality
checker. It checks your code for things that are generally considered bad practice in coding. For
example, JavaScript lets you use variables before they're declared (although in strict mode this
isn't allowed). JSLint checks that your code doesn't contain the usage of any undeclared variables.
Another example where code-quality checking is useful is that JSLint reports the following kinds of
if instructions:
if (a = 3) {
// do something
}
The condition of the if instruction has an assignment instead of a comparison. This is syntactically
valid JavaScript code, but the programmer probably meant this:
if (a === 3) {
// do something
}
A code-quality checker is helpful for finding these kinds of programming mistakes. Furthermore, if
the programmer actually intended to do the assignment in the condition of the if , it's still a good
thing that JSLint reports it, because assigning something to a variable in a condition is an extremely
bad programming practice!
Deployment
When you want to distribute your game, you need to think about a few things. First you need
to make sure players all over the world can understand your game. Although many people can
read and write English, it's nice if your game adapts itself to the player's region: for example, by
translating all the text used in the game into the player's language. This process is called localization .
If you want to do this properly, you need to separate text from the actual game code as much as
possible. This includes the text shown on buttons and help text shown when the player hovers over
a user interface element. Localization can be costly if you want your game to be translated into any
language in the world; but you can reduce the cost by making sure the game code doesn't contain
any text elements and only uses variables that refer to text defined in a single place.
If you use spoken audio in your game, then localization may become very costly. Unfortunately,
automatic text-to-speech systems aren't quite there yet in terms of realism, so you'll need to get
voice actors to record the spoken audio in any language in which you would like to publish
your game.
You can design your game to minimize localization costs, for example by relying mainly on visuals
to communicate with the player. Text that says, “Warning: you only have ten seconds left!” requires
translation, but a blinking timer doesn't. Most games try to minimize the text displayed to the user,
but tutorial levels often contain text. Of course, if you have a word-search game or any other game
in which the gameplay heavily relies on text manipulation, you definitely need to think carefully about
localization.
 
Search WWH ::




Custom Search