The Computer Language

Unfortunately, robot slaves, and computers, do not speak English —- or any other human language for that matter. The only language they speak is binary code which is a series of 0's and 1's. The average conversation between two computers may look like this :

  • Computer 0 : 01110100101101011100101010100100
  • Computer 1 : 00111011101110101001010101001011
  • Computer 0 : 00001010010100110111010101010101
  • Computer 1 : 01010101010101010101010101010101

This computer speak is hard to understand. If you don't know what they are saying, I will tell you. Computer 0 has just told a knock-knock joke to Computer 1. Computer 1, thinking it's funny, laughs. Don't worry if you don't understand, most people never understand how to read binary code. As a programmer, you will probably never have to deal directly with binary code. Even I can't read binary code. I got this conversation from a friend of mine who speaks computer.

Even so, since computers only speak in binary code, you will have to somehow get your recipe (or program) into binary code so that it can cook you something delicious.

Those remarkable people, such as 10b, who can read and write binary code have given us tools to communicate with our robot slaves. Those tools come in four types, a compiler, interpreter, virtual machine, and scripting language.

The Compiler

As an amateur game designer, you won't be using compilers until you can consider yourself an advanced programmer. The reason for this is that interpreters are easier to write, especially if you used someone else's compiler. Because of this, most game programming languages use interpreters. But, it all starts with the compiler.

A compiler takes the human-readable recipe (code) and turns it into the binary code that computers like. It does it all at once, and after it has been translated the compiler isn't needed anymore.

Programming languages that use compilers usually give you more power than those that use interpreters. But, with great power comes great responsibility. This power comes with no fail-safes. If you screw up, there's nothing to keep your computer from crashing. The programming language C is famous for this.

Another advantage of using a compiler is that programs made with compliers are faster than those that require interpreters. But don't worry, most interpreters are fast enough to make any kind of game you can imagine (mostly).

C and C++ are the best known compiled programming languages.

The Interpreter

Imagine for a second your robot slave had to start cooking immediately and didn't have time for someone to translate the recipe to machine language all at once. In this case, you would use an interpreter.

Interpreters work just like a human language interpreter does, it reads one line from the source code, translates it to machine language, and then gives it to your computer. This goes on line by line until the program is over.

The advantage of using an interpreted programming language is that it doesn't have to be compiled, and therefore execution of the game or program can begin immediately. In the case of the robot cook, it doesn't have to wait around for a compiler to scribble down the entire recipe in machine before he gets started. Instead, the interpreter translates only one line at a time and immediately gives the translated line to the robot cook.

The disadvantage of using an interpreter is that interpretation itself takes time. Every time the interpreter has to look at the recipe and translate it to machine language, it slows down the entire process. And, it has to do this for ''each and every line.''

Almost all game programming languages are interpreted. BASIC, and all BASIC variants, are commonly interpreted with a few notable exceptions as PureBasic and FreeBASIC. Most web programming languages such as Perl and PHP are interpreted.

The Virtual Machine

Virtual machines are a strange best indeed. Technically, a virtual machine is just another interpreter, with a twist. It's a compiler too. Confused? Good. Let's start with the compiler.

The compiler of a virtual machine doesn't compile source code into machine language. It compiles it into something ''like'' machine language called bytecode. Computers still can't understand bytecode by itself, after all, it's not machine language. An interpreter is therefore still needed to translate the bytecode into the preferred language of computers. It sounds like alot of work for nothing doesn't it? Well, not really.

By compiling into bytecode, it is easier for an interpreter to translate the code and thereby speeding up the whole process. Remember, bytecode is "like" machine language. It's like having the interpreter translate between American English and British English instead of translating Spanish to Chinese.

The interpreter itself is called a virtual machine. The advantages of using a virtual machine is that interpretation is faster (but not quite as fast as compiled code).

Java is the most famous programming language that uses a virtual machine.

The Scripting Language

The scripting language. Yet another interpreted language. However, in this case, the programming language is tied to a specific program. For example, your web browser, most likely Internet Explorer or Mozilla Firefox, uses a scripting language to make neat things happen. This language is known as JavaScript (not really related to Java).

JavaScript has been used for other applications, but it's primary role remains the same no matter where it goes —- to control the features and functions of it's host program. In the case of the web browser, JavaScript is used to make those annoying pop-ups we all hate.

Video game engines often use scripting languages. A good example of this is Unreal Tournament and its sequels which use UnrealScript. With UnrealScript, you can control almost everything that the Unreal Engine can do. Some people put the scripting language to a completely useless purpose — making the heads of the game characters three times the normal size.

Another example of a scripting language is GML which is used by Game Maker. Game Maker has a very generic video game engine built into it. Since the game engine of Game Maker is so generic, by using GML you can make it play RPGs, action games, puzzle games, or just about everything 2D.

A Word About the Runtime

Sometimes you instantly know an interpreter when you see it. Chances are, you'll know it because you downloaded it for the purpose of using an interpreted programming language. Sometimes the interpreter is disguised. The mask it usually wears is that of a ''runtime file''.

If you've ever been told "This program needs So and So Runtime File to run", you've just been told you need the interpreter. The reason you have to have Java installed on your computer to run Java applets and applications is because without the Java Runtime, Java bytecode is pretty much useless.

Other languages that disguise the interpreter as a runtime are QBasic and Visual Basic.

Sometimes the runtime is packaged into an .exe file along with all the program's resources and uncompiled code. Game Maker and Liberty BASIC use this approach.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.