Classic Computer Magazine Archive ST-Log ISSUE 33 / JUNE 1989 / PAGE 42

BALLBUSTER

BY ERIC SCOTT

LOW RESOLUTION ONLY

Ballbuster is a fast, arcade-style game with colorful graphics and great sound effects. It will run in low resolution on all Atari ST computers with a minimum of 512K of memory, although 520ST owners should boot up without any desk accessories before playing. Ballbuster can be run from any drive, including a hard drive. Those of you who are sweating at the thought of plugging a joystick into the ST can relax! The mouse is used for all player input.

Note: Due to the large size of this program, it is available only on this month's disk version or in the databases of the ST-LOG user's group on DELPHI.

BALLBUSTER

Your task is to help Morry gather crystal balls to throw at a great spinning orb in which the Demon Lord is hording all the manna of the world. Alabarador is on a trip in a small city 200 miles away, so the fate of the Earth lies in Morry's and your hands. Hit different colored segments on the orb to release different amounts of magical energy, and each color awards you with certain amounts of points.

GAME

Starting the game

To start, double-click the BALLBUST.PRG on your disk. In a few seconds the title screen will appear. This screen will display the top six scores achieved during the current play session. If your last score made it into this list, an asterisk will be displayed next to it so that you can easily compare it with the other five. Since the scores aren't saved when you quit, the top six will initially be set to zeros each time you run the game.

The story

The title screen also introduces the two characters in this exciting drama. The little red-clad fellow is Morry Mage, a hard-working but inept apprentice of the great sorcerer Alabarador. One day he was practicing a simple spell to relieve his persistent dandruff and apparently botched the incantation, for the next thing he knew every hair had fallen out of his head. In the process he also managed to drop and break the last of his master's crystal balls.

As Morry left the ancient Hall of Enlightenment in search of more crystal balls, the golden Spring of Power hid from his view a most disturbing sight. In a far corner of the room a giant and terrible head began to form! Somehow Morry's spell had released the evil Demon Lord from the farthest reaches of the nether region to which Alabarador, after a great battle, had imprisoned him centuries ago! Well, only partially freed, for the Demon Lord's body was still trapped; even when Morry screws up, he does it wrong.

For ages the ogre had plotted his revenge, and now he began a terrible chant. A giant multicolored globe took shape in the center of the hall. Slowly at first, it began to spin. As the globe revolved faster and faster, it started to soak in mana from the far corners of the land like an immense magical sponge.

When Morry returned later that evening, hugging a sack containing three crystal balls that he had scrounged up in town, he was very worried. Strange things were happening all across the land. Flying carpets laid limply on the ground, magic washing tubs were filled with laundry that just floated aimlessly in dirty water; in fact, anything that used magic had stopped working.

He reached the Hall of Enlightenment, and stopped short when he saw the huge spinning globe with strange symbols etched into its glowing surface. As he gaped, a monstrous green head appeared above him and spoke in a hissing voice. Gloating, the Demon Lord told Morry of his terrible plans to gather all the mana in the world into the globe, where only he would have access to it. When the ogre had trapped a sufficient amount of energy, he would release himself completely from the nether region and rule the Earth forever.

Since Alabarador had gone on a trip to a small city some 200 miles away, Morry knew that any hope to defeat the Demon Lord's vile plot lay solely with him. The great globe spun far out of his reach, but perhaps a crystal ball thrown with enough force just might shatter one or more of those brightly colored segments and release the mana trapped within.

Morry took one of the balls from the sack and settled himself onto a disc of levitation. He studied the whirling orb above him and said a short prayer to the powers that be to guide him in this undertaking. Perhaps with luck he might even get the ball onto the Spring of Power! Taking aim at a red segment, Morry threw the crystal ball with all his might.

Playing the game

Your task is to help Morry release as much mana from the globe as possible. To play a game, click the left mouse button. You will now find yourself in the Hall of Enlightenment with Morry and the Demon Lord. At the top of the screen are two important readouts. MANA will show how much mana you release during the game, while the BALLS indicator will show how many of the crystal balls are left. When you have three or more crystal balls, this number will be displayed in green; if only two or one balls remain, the number will be yellow or red respectively.

In the center of the screen you will see the spinning globe of mana. Each colored segment holds a certain amount of the magical energy: Red segments hold 500 units; gold segments hold 100 units; violet segments hold 75 units; light blue segments hold 50 units; green segments hold 25 units; and dark blue segments hold ten units. For every 5,000 units of mana released, you will receive a bonus ball and be alerted to the fact by a bell tone.

The left side of the screen stands the golden Spring of Power. Should your luck and skill enable you to land a crystal ball on this amazing machine, a spell of alchemy will turn the ball to gold. After the spring shoots the golden ball back into play, any segment hit will release twice the amount of mana it normally contains. If you are truly fortunate and can get the gold ball onto the spring one or more times, all segments will be worth triple or more their original value.

Below the globe Morry Mage sits on his levitation disc. The disc will float left or right along the bottom of the screen, responding to the movements of your mouse. To tell Morry to throw a crystal ball, press both mouse buttons simultaneously. He will thank you and toss the ball straight into the air. At first the crystal ball won't go very high, because let's face it, Morry is a wimp. Keep Morry centered under the ball, though, and it will bounce off his noggin. With each bounce the ball will fly a little higher until it nearly reaches the top border. Move him to the left or right slightly, and the ball will hit one of Morry's hands, sending the crystal ball flying in the desired direction.

Whenever a ball smashes a globe segment, the ball will fly off in a new direction and speed. The ball will rebound safely off top, left and right borders, but you must always have Morry catch it with his hands or head before the ball hits the bottom. Should you fail, the ball will splinter into useless fragments and poor Morry will be very depressed. When you lose a crystal ball, click the left mouse button, and Morry will politely thank you and ready another ball. When you have lost your last ball, click either mouse button to return to the title screen and see if your score made it into the top six.

The Demon Lord will not stand idly by while you try to destroy the globe and his evil plans! He flashes in and out of the nether region, floating up and down the walls while trying to position himself to catch the crystal balls. If he does catch one, it makes a nice, crunchy snack. There is nothing more frustrating than watching him gulp down your last ball. The Demon Lord will not touch a gold ball, however; he finds they cause him severe heartburn.

A few valuable hints

Never position Morry directly beneath the globe when throwing a crystal ball. It will almost always ricochet into the ground before you have a chance of catching it.

Work on the left or right edges of the globe. This gives you some time to react if the ball suddenly shoots toward the bottom or a corner.

A good tactic to try is bouncing the ball off one of the walls after letting it build up speed. It may land on top of the globe and "sink" down, causing a lot of damage and freeing tremendous amounts of mana. This must be done with caution, however, because the crystal ball might simply slide up and down the border and give the Demon Lord an opportunity to munch out.

While you should always try to attack the side of the globe away from the Demon Lord, the left side gives you the best chance to land a ball on the Spring of Power. If you get a gold ball you can forget about the ugly green guy for a while.

About the program

Ballbuster was written in Megamax C; the graphics were developed with DEGAS Elite; and the sounds with the G.I.S.T. sound editor. Because it uses G.I.S.T., the link file SNDSUBS.O is required to create an executable program file.

The major task when writing an arcade-style game is how to coax fast graphics out of the ST without resorting to writing an all machine language program, something a little beyond my current talents. Because the only really slow C routines are the graphic functions, all I needed to concentrate on in this case was a replacement for the vro__cpyfm() function. After a long period of searching through the rather limited number of books and articles dealing specifically with Atari ST graphics, I came up with a few valuable nuggets.

The ST screen memory is divided up into 16-bit words. A "sprite" that you put into that memory must be able to fall on any horizontal pixel within those 16-bit words. This is done by shifting the sprite between 0 and 15 pixels right so that it fits into the correct bit position like a jig-saw puzzle piece.

Usually this process occurs while the sprite is being drawn. When you try to have a large number of sprites moving around the screen at video-game speeds, it becomes hopeless! The normally fast Atari is so busy calculating and shifting that the graphics barely trudge along. The solution became obvious; just do all the shifting before the game even begins.

I send the sprite data and the amount to shift it to a function called shift__sprite(), where an assembly routine performs all the calculations and places the shifted sprite into the proper array position. This is done up to 16 times for each sprite, although some sprites that don't need to move horizontally can get by with only one shift. The arrays will now hold sprites that need only to be plotted to a screen buffer. When you initially set up the arrays, you need to "Malloc" twice the amount of memory used in the original sprite for each position that will hold a shifted sprite. This is the only drawback to preshifting; it does use quite a bit more memory than standard methods of drawing sprites.

The function plot__sprite() quickly draws a shifted sprite onto a screen buffer. This assembly routine takes the sprite array and by ANDing the X coordinate of the sprite with 15, determines which shifted sprite in the array to plot. Each word of the sprite is then ORed with the buffer at the correct XY coordinates. If "mode" was 0, it will instead erase a 16 by 16 segment of the globe by repeatedly ANDing the first two words of the "blank" sprite with the buffer. A few simple changes to this part of the routine would allow you to use masks for the sprites. Note that both the shift__sprite() and plot__sprite() functions can be used with any size sprite, as long as its width is evenly divisible by 16.

Two other small functions, copy__buffer() and flip__buffer(), complete all the assembly routines I needed for Ballbuster. The function copy__buffer() rapidly copies the contents of one graphic buffer to another, while flip__buffer() waits for a vertical blank, sets the screen to the HIDDEN buffer, and swaps the addresses for the HIDDEN and SHOWN buffers.

These four functions can easily be used by anyone in their own Megamax or Laser C programs to achieve near machine language speeds for their game graphics with little programing effort.

Eric Scott's first computer was a Sinclair ZX-81. After he outgrew that machine, he purchased an Atari 400, followed by an 800XL. He now owns a 1040ST and hopes to make a living programming it.