Classic Computer Magazine Archive ST-Log ISSUE 19 / MAY 1988 / PAGE 27

ST Sprite Factory

FUTURE SOFTWARE SYSTEMS
21125 Chatsworth Street
Chatsworth, CA 91311
(818) 341-8681
Low resolution $39.95

by David Plotkin

David Plotkin, a chemical engineer by trade, currently works as a human resources analyst for Chevron Corp. in San Francisco. His first computer was an Atari 400, purchased in 1980. Currently he uses a 520ST (two monitors) with 1 meg memory and hard disk. His interests include writing and games.

ST Sprite Factory (SSF for short) is a utility for creating your own sprites and animating them. It includes the actual program for creating multicolored sprites and some sample programs showing how to use sprites in GFA BASIC, C and Personal Pascal.

Sprites are blocks of data which form a picture for display on the screen. Atari 8-bit users are familiar with this concept called "Player-Missile Graphics." A good example of sprites are the characters in MichTron's Time Bandits.

If done properly, a small, colorful sprite can move across the screen without affecting the background. But defining the sprites themselves can be a difficult and time-consuming procedure. This is especially true if you want multiple versions of the sprite—each one slightly different from the one before—to use in an animation sequence. SSF solves this problem by providing a whole host of tools for "point-and-click" design of up to 60 sprites, each 32 lines high and 32 bits wide, using all 16 available colors. Once you've designed some sprites, SSF lets you animate any sequence of the 60 frames, in any order, at your chosen speed.

When you boot SSF, you'll see the main screen where you design your sprites. To the left is a large 32×32 grid area. To "turn on" a pixel in your sprite, just click in this area. As the sprite takes shape, you can view it at its actual size in a small area on the right of the screen. Across the top of the screen is a color bar where you can use the mouse pointer to select the current color for drawing. On the right side of the screen are boxes which you can click to activate the tools used to draw your sprite. These include several styles of fill; mirroring horizontally and vertically (or both); and drawing lines, circles, boxes and filled shapes.

You can rotate the sprite in 1-degree increments or quickly in 90-degree jumps; flip the image; shift it up, down, left and right; and shrink the image in pixel increments. You can also swap colors in the palette, as well as set the palette to the colors you want.

SSF also supports cutting, copying and pasting to another file—it can hold two in memory at once—and to a special "paste" buffer where you can work on the image using the tools mentioned above. You can view all 60 frames (or however many you have defined) on a separate screen, and select which frame to edit next from this screen. Of course, you can load and save the frames to disk, in standard DEGAS format files. SSF will also automatically create a "mask" file to prepare the background to receive a sprite, without distorting the colors in certain modes.

Once you've defined some frames, you can animate them. To do this, you switch to the screen showing all the frames, then select with the mouse pointer the frames in the order you want to use them. You can also set the animation speed. The order and speed can be saved in a special animation file, which can be reloaded and used in future animations with the joystick demo included. An animation sequence can consist of up to 1,000 frames.

If SSF only consisted of the utility to create sprites, it would still be a good program; it just wouldn't be particularly useful to programmers who aren't familiar with the ins and outs of bit-blitting. But there is much more included on the disk. Three archived files contain demos showing how to use the sprites you've created. The carefully written manual also provides tutorials on screen memory, using GEM, the various bit-blitting modes and what they mean, and performing sprite collision detection.

The most thorough demo is called "Joystick." With this program, you can load a sprite file and set up animation sequences corresponding to the 16 joystick directions (eight with button up, eight with button down). These sequence files can be saved, and you can plug in a joystick and move your sprite over the screen.

Your control of each frame is extensive. You can set the speed of changing frames, the speed at which the sprite moves across the screen and even the blitting mode (OR, NOT, XOR, AND, etc.) and mask mode. It's somewhat cumbersome to set all the variables for each frame of the animation, but the high degree of control can produce some outstanding effects.

By studying the source code (Personal Pascal) included on the disk, you can see how to use sprite files and animation files in your own programs. Most of this information is also detailed in the manual, although no demonstration code is included, nor is the exact code to include in your program shown. However, the file structure for animation files is shown in the manual, as is a good section on animation theory, and which GEM calls you will need to make. You can even load a DEGAS format "playfield" (background) to move your sprite on top of.

The second demo is called "Mapmaker." In Mapmaker, you can load up to three sprite files and build maps that are not only bigger than the screen, but can be many levels "deep," with passages leading between levels. By defining your sprites to look like passages, stairs and parts of buildings, you can build mazes, caverns, or anything else you can imagine.

Three sprite files are included on the disk for those (like me) lacking in artistic ability. By pressing a function key, you can switch to screens that show the contents of the three sprite files. You select the sprite you want to use with the mouse, and return to your map to place a copy wherever you choose.

The noteworthy thing about Mapmaker is that it uses so little memory. The included map, which is 500 screens, takes up only about 60K of data. This is because the large sprites which fill the screen take up only one byte each. Atari 8-bit programmers will recognize this: It's similar to using redefined characters instead of graphics modes to set up a playfield. The Mapmaker program even lets you "coarse scroll" over the playfield you've built. Again, you will have to study the source code of the Mapmaker program to see how the scrolling is achieved in such a small amount of memory, but the effort is worth it.

The final demo shows fine scrolling using only half the screen. Studying the listing here also reveals some interesting programming tricks only loosely related to building sprites.

The ST Sprite Factory is an excellent programmer's tool. Because the Joystick demo can be used by non-programmers, SSF can produce custom animations that are joystick sensitive with nothing more than an artistic eye, a little patience and a copy of DEGAS. The manual gets a little technical in sections (especially the part about sprite collision detection), but then the subject of "bit-blitting" is quite technical. The portion of the manual dealing with the actual use of SSF is not hard to follow and, overall, the documentation is well written and complete. If you're serious about learning the tricks of your ST, I highly recommend ST Sprite Factory.