How To

by "Cajun" David Richard


About two years ago, I wrote an article on changing the sounds in our games. The
recent addition of our Add-Ons page on our Web site
(http://www.ambrosiasw.com/Ambrosia_Products/AddOns.html), and the Member
Contributions library on AOL has generated many questions about customized files. I
thought I would take the opportunity to recap some of the things covered in my last article (How To, July '94) as well as talk a little about replacing sprites and about Andrew's new programming toy.

Replacing sounds in our games is an easy task, but it does require some preparation. You will first need a program like ResEdit or SoundEdit to work with the sounds. If you do not have these programs, there are other shareware programs available for downloading from the net. SoundMover is one that should also allow you to make changes to sound resources. Regardless of what you use, replacing sounds can be a lot of fun.

The main thing to keep in mind when replacing sounds is that you need to match the format of the sound you are placing with the original. For example, Maelstrom uses sounds that have an 11kHz sample rate, are mono and that are uncompressed. All of our other games, including the ones that are forthcoming, have a 22kHz sample rate. All sounds should be mono, and none should be compressed. If your sound is in the wrong format, the program will reject it.

Another important point to keep in mind is the size of the sound. Usually, when a game is loading, it is copying the sounds into memory (among other things). If your sound is larger than the original, chances are you will have to raise the memory allocation for the game to make room for the larger sounds. You can generally compare the final size of your new sound file to that of the original and get an idea of how much you need you add to the game's memory allocation.

The third most important aspect of replacing sounds, or any resources for that matter, is maintaining the proper ID numbers. All resources are referred to by their ID's. If you replace a sound, but do not make sure the ID's are the same as the original, the program will probably not load. The cool thing about replacing resources is that the program doesn't care what is in the resource. As long as the format and ID matches what it expects, the data can be anything.

This last point brings me to the subject of replacing sprites. Sprites are very similar to an animated flipbook. You have a series of images that are flashed in the same place in a certain order. This causes the animation effect. If you crack open a sprite file from one of our games, you will notice many frames of the various characters. Sometimes the frames will be in separate resources, some of them will be comprised of a long strip of frames, each one separated by a boundary. The later is a different technique used in some of the more recent games.

Replacing sprites is a little more complicated. Adding a sound to a file is practically a matter of cutting and pasting. A sprite needs a little more work. Because there are a certain number of frames, and a certain size for a single frame, you must stay within these boundaries. You must also be able to see the frames as they are animated, to see if they work just right. You can use the game, or another animation program to test your work.

There are some other things to take into account when replacing sprites. The time between frames can vary, and you must plan your animation around this. Also, many of our games use custom color palettes. A custom color palette is a set of 256 colors that are hand picked to make the particular screen look good. If you are not working in this particular palette, then more than likely your colors can shift, giving you a result you didn't expect.

Now I know that this isn't a step by step article for creating such beasts. In fact, some of the steps needed to create different sprite files I could not fully describe to you. But, I could discover how by using a little trial and error. Sometimes, playing around can teach you many things, just ask Thomas Edison.

I also wanted to mention the new Sound_Tool that Andrew has developed. This a a very advanced set of tools that gives the programmer much more control over the way a sound is presented. After reading the tech notes on it, I must say that I am really looking forward to what will be done with it.

Here are the details: the new Sound_Tool can play up to 8, count 'em, 8 sounds at any one time. This could get confusing if all the sounds are different, but I can see possibilities, like multiple parts of one sound, accompaniments, orchestral pieces!!! Well, maybe. The new sound tool also supports separate volumes for the left and right speakers, giving something very close to stereo. Actually, it's more akin to the balance knob on your stereo, but it also presents many opportunities. If you are playing Barrack through a pair of stereo speakers, you may notice it in action.

So if you don't have those stereo speakers or a set of headphones, start saving, 'cause Ambrosia's games won't be the same without them.

Page 3