Classic Computer Magazine Archive START VOL. 3 NO. 2 / SPECIAL ISSUE #4

NAVAL BATTLE

START's Version of a Classic Game

by John L. Hutchinson


Loose mice sink ships! Check out NAVAL.ARC on your START disk.

Bring the thrill and adventure of combat on the high seas to your ST! In this special entertainment issue, START brings you a great rendition of an all-time classic game--Battleship. Hunt down the ships hidden in your opponent's waters; the first to find and destroy all five ships is the winner. Challenge the computer or a friend in one of three difficulty levels. Naval Battle runs in color or monochrome.

As a child, one of my all-time favorite games was "Salvo." You remember the game--you draw grids of 100 squares on sheets of paper, writing letters across the top and numbers down the side. Two players draw ships of varying sizes and then take turns "shooting" at their opponent with shouts of "A-3", "H-7" and the like. The first to find and "sink" the other's five ships was the winner. It was fun and had a simple concept. As I recall, however, drawing all those grids was almost as difficult as finding an opponent.

In the true spirit of "like father, like son," my two boys also enjoy the game. Of course, they have it a little easier with Parker Brother's "Battleship!" playing board. With it, they no longer have to go through the pencil and paper drill. However, they are still faced with the problem of finding a willing opponent. It didn't take long to occur to me that our Atari computer could be the ideal solution to this problem. Naval Battle was born.

NOW HEAR THIS, NOW HEAR THIS. . .

While based on the traditional game, Naval Battle does incorporate a few unique features. Don't be surprised when your computer verbally challenges you to a game. Naval Battle ST includes a computerized voice, courtesy of the public domain routine STSPEECH. While far from digitized sound quality, it does add an interesting aspect to the game. Because STSPEECH is in dhe public domain, feel free to use it in your own programs.

If you can't find a willing human opponent, the one-player mode pits you against the computer which uses "artificial logic" (not true "artificial intelligence") to hunt down and sink your ships. The computer will even position your ships for you if you wish. As another variation on the original theme, Naval Battle uses a scoring system that demands speed, logic, and, of course, a Iittle luck. Naval Battle saves high scores to disk according to three different levels of difficulty.

To set up Naval Battle, first un-ARC the file NAVAL.ARC from your START Disk, following the instructions found elsewhere in this issue. For the game to work properly, make sure that all of Naval Battle ST's files are in the same directory or folder as GFABASRO.PRG, MichTron's public domain run-only version of GFA BASIC. Naval Battle ST uses two low resolution color and two high resolution monochrome DEGAS Elite-compatible picture files for its background screens. To save disk space, you need only include the picture files for the monitor you will be using.

PLAYING NAVAL BATTLE

To play Naval Battle, double-click on GFABASRO.PRG. When the file selector box appears, click on NAVAL.BAS and press Return. When the program starts, you can either play a game of Naval Battle, visit the Hall of Fame or quit back to the Desktop. Here and throughout the game, use the mouse to select your choices; no keyboard entries are required. If you select "Visit Hall of Fame," you will see the current high scores. (Keep the write-protect window on your disk closed, so that the program can update the High Scores file.)

If you choose to "Play Naval Battle" you will need to select your desired game options. Using the mouse, click on the option buttons you want to activate. Your choices are: one or two players, sound on or off, timer on or off and automatic or manual ship positioning. You also have a choice of three difficulty levels: Ensign, Captain or Admiral. Ensign is the least difficult level; the computer opponent makes almost totally random, rather unintelligent shot decisions and the human player has considerable time to place shots. At the intermediate Captain level, the computer optimizes its shot patterns while giving the player less time to place shots. The Admiral level is the most difficult, requiring the player to make very rapid shot decisions and is best reserved for Naval Battle veterans. If you beat the computer consistency at this level, you should join the Navy--your country needs you!

battlenaval.jpg Figure 1: Naval Battle
ST, START's version of
the classic Battleship
game.

If you turn the sound off, you may fight your battle in relative silence and at a slightly faster pace. Note that if you choose to disable the timer function, you must use the Captain difficulty level. Also, if you decide to play the two-player version, you must let the computer plot your ships. This is to prevent any inadvertent "cheating" by human players. . . not that you ever would, of course.

In Naval Battle, you have a total of five ships in your armada, ranging from two to five grid squares in length. These are a PT boat (two squares), submarine (three squares), destroyer (three squares), Battleship (four squares) and aircraft carrier (five squares). If you use the automatic plotting feature in the one-player mode, the computer will quickly and randomly place your ships on the playing grid and then ask you if these positions are acceptable. Select OK to continue, or CANCEL to see another playing board.

If you use the manual plotting mode, you may position each individual ship either horizontally or vertically. Click on the vertical or horizontal arrow buttons for each ship in turn, and the mouse cursor will change to an arrow shape on the playing grid. Move the mouse to the desired location and press the button to plot each ship on the grid. The computer will scold you if you try to place two ships on the same grid square but is generous enough to let you try again.

Once you are satisfied with your ship placement, select OK to begin playing. The human player always goes first in one player mode; in two-player mode player number one always begins. Place the mouse cursor on any of the 100 grid squares of your opponent's grid and press the mouse button. Animated graphics and sound effects (if enabled) will indicate either a "miss" or a "hit." If you are using the countdown timer don't let it run out before you make your shot or you will lose your turn.

Your opponent will then fire at your ships. As ships are hit, squares will light up in the ship hit indicators along the right hand side of the playfield. These indicators are for reference only; they show how many additional hits you need to sink a ship, but not the exact position of a hit. Play continues in this fashion until either you or your opponent succeed in sinking all five ships. When the game is over you may quit back to the Desktop or play another round.

At any time during your turn, you may use the mouse to toggle the SOUND on or off, PAUSE the game, start a NEW game, or QUIT by clicking on the appropriate button in the lower right hand corner of the screen. Turning SOUND off will hush a talkative computer opponent, disable the animated graphics and increase the speed of play. In addition to the button, you may initiate a PAUSE by simply pressing any key on the keyboard. During a pause, the Hall of Fame high scores will cover the playfield, effectively preventing you from studying your opponent's grid at leisure. When you are ready to resume, press either mouse key or any key on the keyboard to continue.

SCORING

As an addidonal variation to the traditional game, human players and the computer earn points as ships are hit and eventually sunk. While huge aircraft carriers and lumbering battleships may be more lucrative targets in real life, Naval Battle ST takes a slightly different yet altogether logical approach. Since the smaller ships are the most difficult to find, they are worth the most points.

Points are awarded for each hit achieved according to the table shown below:

Aircraft Carrier100 points
Batheship200 points
Destroyer300 points
Submarine400 points
PT Boat500 points

You also earn a considerable bonus depending on the selected difficulty level, time used to place each shot and the number of shots made since beginning the game. Since the computer makes its shot decisions so quickly, time is not a factor in its scoring. Although it is practically impossible, a perfect score at the Admiral level would exceed 14,000 points! Regardless of score, the only way to win is to sink all of your opponent's ships first. If you do so and manage to top the current high score in that level, you may enter your name in the Naval Battle Hall of Fame. This information will be written to disk in a data file called NAVLBATL.DAT; to erase previous high scores, just delete this file from your disk.

navalpattern.gif
Figure 2: Use a checkerboard pattern to
maximize your search efficiency.

PLAYING STRATEGY

One of the best playing strategies is to always go after your opponent's largest remaining (as yet unhit) ship. Select grid squares where the ship could fit both horizontally and vertically. If no such squares exist, then select a square in which the ship could fit either way. You should also stagger your shots in a checkerboard pattern to maximize their effectiveness. (See Figure 2.)

Whenever possible, try to avoid placing two shots side-by-side. Since the smallest Naval Battle ship, the PT boat, is only two squares in length, skipping squares can logically eliminate spaces where your opponent's ships cannot possibly fit. Keep in mind that while it's not likely, the computer may place two or more ships next to each other to fool you.

So the next time you get the urge to play a rousing game of "Salvo!" why not give Naval Battle a try? You will find your ST is always willing to take up the challenge to determine the supreme commander of the seven seas. Have fun and "good hunting!"

PROGRAMMING NOTES

If you own the GFA BASIC interpreter, you are free to load the NAVAL.BAS source code for closer examination. The code is relatively straightforward so you can examine or modify it. Don't try to compile this program with the GFA BASIC Compiler, however; it won't work. The STSPEECH routine uses some memory locations that get shuffled in the compilation process. This results in two bombs when you attempt to execute the compiled program. Widt luck, the new compiler with the forthcoming GFA BASIC 3.0 will fix this problem.

Major John L. Hutchinson is putting his experience writing computer battle games to use; he is on a two year tour of duty at the Australian Army War Games Center in Sydny.