[ LiB ] |
The language of BASIC was first developed in 1964 by J. Kemeny and T. Kurtz at Dartmouth College. It was designed to be a very easy language to understand, translate, and write. It was also meant to be the first step toward writing programs for tougher languages.
In the 1970s two people, Paul Allen and Bill Gates, decided to develop a BASIC language for the new Altair Personal Computer. The developers of the Altair showed a lot of interest in the BASIC language, and Gates and Allen licensed it.
Bill Gates and Paul Allen put BASIC onto other types of computers. By 1980, BASIC was moved to Atari, Commodore, and Apple computers as well as the Altair. Bill Gates developed an operating system called DOS (Disk Operating System) with a BASIC interpreter. This allowed any user that owned DOS to write programs in BASIC.
Microsoft, headed by Gates, realized how popular BASIC was and decided to write a compiler for it that did not require DOS. QuickBasic, the first standalone BASIC compiler, was born. Soon after, Microsoft decided to focus on graphics and developed Visual BASIC, which created graphical programs using BASIC as a core language.
Blitz Basic, the program we are using in this book, was developed by Mark Sibly and is geared toward the game developer. Blitz Basic is very easy to learn and understand due to its BASIC nature, and it's a good way to learn game programming without having to worry about extra code that has almost nothing to do with the actual game itself.
We need to get Blitz Basic onto our computers so that we can start writing games as soon as possible. Blitz Basic is a compiler, so it takes your code and turns it into a program that can be run from any computer. However, the demo version that is included on the CD does not-include the compiler, but only the interpreter. Unlike a compiler, an interpreter does not create an executable file that can be run on any computer; instead, it only runs from within the compiler. In other words, the programs you write will only be able to be run from the compiler on your computer. If you wish to compile the program into a standalone executable, you can purchase the full Blitz Basic package from http://www.blitzbasic.com. The Blitz Basic installer is shown in Figure 1.1.
Okay, first things first. To install this program, put the CD into your CD-ROM drive and run BlitzBasicDemo.exe. Blitz Basic will ask you where you want to install the program. Choose a directory (the default one is a good choice) and click Install. When the installation finishes, click OK, launch the program, and you're done! You now have a full BASIC interpreter on your computer.
Blitz Basic can seem a little daunting at first. The program has a lot of menus and icons, but they can be mastered with a little effort. The first thing you see when you open the program is the documentation window, pictured in Figure 1.2. If you need to find tutorials or sample programs, this is the place to do it. After you have read through anything that interests you, open a new document by selecting File->New or the New icon.
NOTE
The -> (arrow) symbol means a selection from a menu. In other words, File->New instructs you to open the File menu and select New. The menus can be found at the top of the program, right under the main toolbar.
What you see now, as in Figure 1.3, is considered the IDE. IDE means Integrated Development Environment, and it is an area in which you can write and compile your programs in the same workspace.
All of the windows , toolbars , and menus are necessary for game programming, so a good explanation of each one might be helpful.
The main window takes up most of the program space, and it is the most important part of Blitz Basic. This window is where the actual code from the game is typed. The keywords and important parts of your program will be highlighted when you type in this area. If you want to see an example, type the word "End," such that your screen looks like the one pictured in Figure 1.4. You will notice that as soon as you complete the word, it becomes a different color . This highlight feature helps in reading and understanding your program.
Take a look to the right of the screen. Although, not pictured in the previous figure, the only visible panel located on the right is under four buttons labeled Funcs, Types, Labels, and Debug. Each of these buttons displays separate info on the panel. Funcs shows which functions you have created, Types shows your defined types, Labels shows any existing labels, and Debug provides debugging information. These descriptions probably don't mean much to you now, but by the end of this book you will understand what they do.
The main toolbar (shown in Figure 1.5) is simply a set of shortcut icons. It allows you to perform actions quickly without having to search through the menus for the command. Table 1.1 briefly describes each icon, going from left to right.
Icon | Description |
---|---|
New | Opens a new blank Blitz Basic document. |
Open | Allows you to open an existing file from the disk. |
Save | If your program has been saved previously, the Save icon quick saves the open document; if not, Save asks for a filename and a location to save the file to. |
Close | Closes a single document. |
Cut, Copy, and Paste | The Cut command saves highlighted text to the clipboard but deletes the highlighted text, the Copy command saves the highlighted text to the clipboard but leaves the highlighted text untouched, and Paste places saved text from the clipboard into the document. |
Find | Allows you to search for a certain word or certain words in an opened document. |
Run | Compiles and runs an open document. |
Pause, Continue, Step Over, Step Into, Step Out, End | Advanced debug tools. |
Home, Back, Forward | All three commands allow you to enter and navigate through the Blitz Basic documentation. Unless you are in the documentation window, these commands will be grayed out. |
The menu toolbar allows you to exercise the full power of Blitz Basic. The main toolbar looks like Figure 1.6. Buried within each menu are many helpful and useful commands. Table 1.2 shows the most important ones.
Command | Description |
---|---|
Program->Check for Errors | This command allows you to error-check your code without compiling and running it. |
Program->Debug Enabled? | If this feature is enabled, you will be able to run your program in a small window (instead of the program taking the entire screen), and debugging your program becomes much easier. |
Debug->View Log | Shows the Debug Log window (messages you have written to the window during execution of your program using the DebugLog command). |
[ LiB ] |