Classic Computer Magazine Archive ST-Log ISSUE 21 / JULY 1988 / PAGE 55

GAME

Battle Blips!

by Patrick Dell'Era

Low or Medium Resolution

Even the stodgiest, "sophisticated" computer curmudgeon enjoys an occassional game against the computer. But oftentimes the computer becomes too predictable in its play to remain challenging. If only a computer could be programmed to have the irrational quirks of a real human!

Increasingly, gamesters want to be able to play against other people instead of just the computer. With Battle Blips! (BB) you have just that option. But unlike most other person vs. person games, your human opponent doesn't even have to be in the same country as you!

Howz'at? Well, you see, BB lets you use your modem to play against someone else. What, you don't have a modem yet? That's okay, BB will still play you a pretty tough game against the computer!

BB is a strategy game based on the classic game of Battleship. You and your opponent each have a 10×10-inch grid on which to place your fleet of five ships. Then each tries to sink the other's fleet first. Each ship can take as many hits as it is long. The ships range in length from two for a Destroyer to five for a Battleship.

BB was written as a desk accessory, so it is available to you at any time you are using a GEM program with the menu bar accessible. You can start up a game, interrupt it to go back to your main program, and then click it on again to continue from the exact place you left off.

To install BB, you must copy it to your boot disk with the extension .ACC. Then turn off your ST for ten seconds, and turn it back on. When you drop down the Desk menu, you should see the title "Battle Blips!"

To start playing, click it on. BB will work in either mono or medium resolution color.

After clicking BB, you will be presented with a menu that allows you to "Play against computer," "Play as HOST against modem," "Play as GUEST against modem," or "Exit Battle Blips!..." Move your mouse arrow to your choice and click.

Playing against the computer and exiting are pretty self-evident. They allow you to play the computer only or to return to the desktop.

When you start playing BB, you will see the play screen with two grids separated down the middle with a ships-sunk box. The grid on the left is your opponent's grid, the one on the right is yours. Next to the ship names are small empty boxes. When the named ship is sunk, a check mark will appear in the appropriate box. At the bottom of the screen is the message window. Here's where you will see whose turn it is, if the shot is a hit or a miss, etc.

Whether playing the modem or playing the computer, you must first place your ships on your grid. Move the dark cursor to the square that marks one end of your ship. Use the cursor keys to move around, or optionally, you may use the 1, 2, 3 and 5 keys of the keypad. Note that the keypad option is laid out and used exactly the same as the cursor keys, but places the Enter key right under your little finger so you don't have to move your hand to place a ship or make your shot.

Your cursor will jump to the opposite side of the grid if you move it off an edge. When the cursor is at the desired position, press RETURN or ENTER. If the ship you are placing will fit only down or across, it will be placed in position. If it could fit in both directions, you will be asked to indicate which you want. Press the down arrow (or 2 on the keypad) to indicate down, or press the right arrow (or 3 on the keypad) to indicate across. Pressing RETURN or ENTER is not necessary to indicate the direction to lay the ship.

If the ship you are placing does not fit in either direction, you will be told. Note that another ship may be in the way, not just the edge of the grid. Simply move to another location and try again.

After you have placed your ships, there will be an invisible (but fair—trust me!) coin toss to see who will go first. If you are playing the modem as a Host (don't panic, you'll see what that means. . .), then your guest will make the call, and you will be told the outcome.

Once you and your opponent have placed your ships on your own grids, it is time to do your best to sink your opponent's fleet before he/she/it sinks yours. When it is your turn, your cursor will be placed in your opponent's grid. Move it to where you want to take a shot and press RETURN or ENTER. On your opponent's turn, you will see him/her/it move his/her/its (oh, the hell with it!) cursor to where she will take her shot. The message box will indicate whose turn it is, whether the shot taken is a hit or a miss, and, if necessary, if a hit has sunk the ship.

Squares that have not been shot at have an outlined cross in them. Shots that hit are marked with an oval with an "X" in it (you may recognize it!), and misses are shown with blank squares. If you take a shot at a square that you have already shot at, you will be told. Then you get another chance.

You may exit back to the desktop by pressing Undo. If you are playing the computer alone, when you come back to BB you will have the option of continuing the game or starting a new game. Continued games pick up right where you left off.

Playing the modem takes a little more explanation. First you boot up with BB installed as a desk accessory. Then you enter your terminal program, make a call to your waiting friend (or answer a call from your calling friend), and establish your modem connection. You may have your terminal paramaters set any way you want. BB doesn't care what baud, parity, etc. you choose, just so long as you can communicate with your opponent through your terminal program.

You and your friend need to agree before entering BB who will be the host and who will be the guest. Needless to say, you have to have one of each before you can get anywhere. It's probably a good idea to make the caller the host and the answerer the guest, but it doesn't matter to BB, so long as you do have one of each.

The reason BB was written as a desk accessory is so that you may use your favorite terminal program to make the connection with your modem.

(Let's face it, the terminal program you have and love is far better and more familiar than any kind of simple terminal program I would have put together.)

After you and your friend have connected and established who will be the guest and who will be the host, you both need to access the menu bar by whatever means is necessary with your terminal software. Flash users will have to press the right mouse button. VT-52 Emulator users will have to press UNDO, dumping you back to the desktop but not disconnecting the line. Mi-Term and other terminal programs have the menu bar available at all times.

Once back at the menu bar, drop down the Desk menu and click on Battle Blips. When you see BB's options, click on the appropriate choice (dictated by whether you are the designated host or guest).

Then place your ships on your grid. When both people have completed that, the information will be passed back to the host computer and the guest will choose heads or tails to determine who will start first. Then the play begins!

You may at any time suspend the game and return to the desktop or the terminal program that you launched BB from. Then you and your friend may type messages back and forth, perhaps congratulating each other on a game well played.

You both may re-enter the game in the same way as you started it. Of course, you will be presented with different options from BB. You may continue the game, or exit. You don't have the option of starting a new game at this point, just so someone doesn't "accidentally" make a mistake and trash the game in progress. Re-entering the game puts you back at exactly the same point that you had suspended the game from.

A Few Technical Notes

Battle Blips! is written in Personal Personal Pascal v.1.11 from O.S.S., Inc. It was developed first as a stand-alone program for ease of testing. When it was working well, it was converted to a desk accessory using built-in commands available in Pascal 1.11 or later versions.

You can re-compile the source into a stand-alone application by commenting out the first line:

($A+, D-, $20)

and commenting out the existing last block and installing the already commented out last block. If you do it right, it really takes only a few keystrokes!

While most of BB is written in fairly standard Pascal parlance (hey, what do I know?), there are a couple of tricks worth looking at.

The message window used shows an interesting use of an undocumented procedure of Personal Pascal—Obj__Draw. With it, you can have the AES draw your dialogs just like in the call Do__Dialog. But after it draws the dialog, it returns to the calling program. Then you can manage the dialog yourself.

Check the procedure Pause. There you see how to enter Supervisor mode in Personal Pascal and access the timer for precise timing. From Supervisor mode there is no limit to the fun you can have crashing your system!

It was decided to use BIOS calls for modem input/output rather than the traditional Pascal system of Reset/Write. While the traditional Pascal means is an excellent learning tool, it just gets in the way (as far as I am concerned) for real applications. Besides, there is no provision for determining whether there is data waiting on the modem without using the Bconstat call.

BB should work just fine through networking systems such as CompuServe and Delphi. It doesn't use any but the standard readable ASCII characters for sending data, so the filtering common to such networks would not hinder BB.

To use a network, you and a friend would have to call it at a given time. Then enter into a private conference with each other. Then go for it!

Why would you want to use a network for such a thing? To keep Ma Bell from taking all your money when playing long-distance. Most cities have local access numbers to call the networks. The local call plus the network charges might be lower in some instances than long-distance direct calls.

Check it out.

My thanks to O.S.S. in general and Mark Rose in particular for the little tricks used to coerce Pascal to do what is needed.