SLPCreate! Version 1.0 - Instructions for use of SLPCNVT
Copyright (C) 1998 Joseph Knight. All rights reserved.
Written by Joseph Knight, knight@sad50.k12.me.us

_______________________________________________________
 Contents
_______________________________________________________
 Introduction
 File Specifications
  Intro
  C*.TXT Files
  G*.BMP Files
  S*.BMP Files
 How to make your own
  Intro
  G*.BMP Files
  S*.BMP Files
  C*.TXT Files
 Actually Building the SLP
 Credits

_______________________________________________________
 Introduction
_______________________________________________________
     By popular demand, I've written up this text file discussing how to
use SLPCNVT and your favorite image editor to create SLP files.
     SLPCNVT was created by me over the past few months to account for
the proprietary format of SLP files, the most commonly used graphic file
for Age of Empires.  Finally, after many road blocks, I cracked the commands
used to create the images and wrote SLPCNVT to convert SLPs to BMPs and back.
     When extracting the images from an SLP, SLPCNVT converts each frame (an
SLP file can contain many images) into 2 BMP files and a TXT file.  I'll get
into the specifics in a bit.  An important thing to remember is that SLPCNVT
does _not_ support long filenames.  You'll need to have downloaded the latest
SLPCNVT (version 1.2 at the time of this writing) and you'll also need an
image editing program (Paint Shop Pro works fine) and a text editor (Notepad,
or MS-DOS EDIT work _great_.)  Also you'll need to have DRSBUILD, Stoyan
Ratchev's fine DRS file extractor.
     Finally, remember that, when using DRSBUILD to rebuild your DRS files
with new SLPs, that you'll want to have already backed up your original DRS
files in case you ever want to put the graphics back to normal in the game.

_______________________________________________________
 File Specifications
_______________________________________________________
   Intro
   ~~~~~
     Before we get started we'll need some sample files to use for reference
while I'm explaining.  For these examples let's look at GRA00002.SLP.  You'll
need to extract it from GRAPHICS.DRS using DRSBUILD.  Once you've extracted
GRA00002.SLP make a new directory and put the SLP file in it.  Then you can
extract all the frames from GRA00002.SLP by typing this command:

SLPCNVT /X GRA00002.SLP

     What you'll have now is 60 files!  20 of the will be named G00002??.BMP,
20 others will be named S00002??.BMP, and 20 others will be named C00002??.TXT.
Let's start with the easiest files to explain... C*.TXTs

   C*.TXT
   ~~~~~~
     These are quite simply text files that mark the 'anchor' or 'center' of the
image.  The reason an SLP frame has to have one of these might not seem obvious
at first, but let's take a look at those extracted BMP files.  Age of Empires
(from now on refered to as AOE) needs to know exactly where to draw the images on
the screen.  If it just picked the exact center of each image, then the base of
the flames in this example would jump up and down and all over.  So what this
file does is specify _exactly_ the coordinates (in relation to the upper left
corner of the image) of the center of the image.  Sometimes these numbers are
even negative.
     To edit the text file and change the center of an image, simply open it and
make the changes.  Keep the file's coordinates both on the same line separated by
a comma, like this, for example:

 24, 43

That would be the whole file.  To get a better idea how these work, you could
change a few of the files for GRA00002.SLP to  0, 0 and rebuild them as will be
described later.

   G*.BMP
   ~~~~~~
     These are slightly more complicated files, but they are also very important.
All they are, though, are standard bitmaps drawn to certain specifications.  Basically
they are exactly what you see when playing the game.  To edit one of these files,
simply open it in any image editor that will let you work with 256 color files with
out changing their palette, and edit away!  The files must be 256 color BMP files with
the same palette as the extracted images contain.  If you edit your images and end up
changing the palette, when you rebuild them, they won't look right anymore.  I'll get
into the specifics later, but for editing existing files, you shouldn't have a problem
as long as you edit the corresponding S*.BMP file to match your G*.BMP file.
All G*.BMP file data hinges on the most complicated files, the S*.BMPs.

   S*.BMP
   ~~~~~~
     Basically, these are control files used to put the SLP frame back together again,
or to create your own.  They exist because SLP files contain control codes that I
couldn't easily encode into a single BMP file, like transparency.  There are only a
few important colors for a the S*.BMP, but the same requirements apply to them as for
the G*.BMPs.  Make sure they are 8 bit (256 color) BMP files that are the same size
(across and down) as their corresponding G*.BMP file.  When SLPCNVT rebuilds and SLP
file from many BMP and TXT files, it uses the S*.BMP file as a control bitmap.
     SLPCNVT processes the two images together on pixel at a time.  The following are
the control codes for the S*.BMP file bases on color number from the palette:

     Color  Results for SLP file
     ~~~~~  ~~~~~~~~~~~~~~~~~~~~
      0     This pixel will be transparent
      255   This pixel's color will be copied exactly from the G*.BMP file
      120   This pixel will have a shadow effect (an special color remapping in AOE)
      16-25 This pixel will be assigned a user color based on it's number, I'll
            explain more later.

If you change the G*.BMP file, you'll need to update the S*.BMP to match.  The easiest
way I know of, is to save the G*.BMP and then open it in a image editor which will
allow you to replace colors (like an erase or change color function).  And change all
the colors, except the user colors, shadows, and transparent parts, to color 255.
     Now that you've got the basic idea of how to change existing files, let's go into
creating your own files for compilation.

_______________________________________________________
 How to make your own
_______________________________________________________
   Intro
   ~~~~~
     For your first SLP file, I'd recommend making a wonder, since you won't have to
worry about making an animation work over multiple frames.  You could, for instance,
make a replacement for GRA00033.SLP, the Egyptian wonder.  I'll discuss how to make
the three files to do that now, as well as specifics for those files.

   G*.BMP
   ~~~~~~
     Basically, start your image editor, and create a new image approximately the size
you'll want your frame to be, in this case your wonder.  Then load the AOE palette.
If you don't yet have an AOE palette, then extract any image from any SLP file, open
it in your editor, and save the palette for opening later.  If your image editor doesn't
support changing palettes like that, you could extract a large image from any SLP file
and simply erase the data, or get a new image editor.
     Once you've got a new blank image with the AOE palette, simply draw the image the
way you'd want it to appear in the game.  Use color 0 (that should be your default
background color) for transparent parts.  If you want to use the game's shadowing ability
you should use color 120.  Although this is not necessary in the G*.BMP, it makes it
easier later to create the S*.BMP.  For those colors which change based on who owns them,
these are what I refer to as user colors, you should use colors 16-25.  Again, you could
use any colors (Red, Green, etc) for those user colors, but it will be easier to create
the S*.BMP file if you use 16-25.
     Finally, when you've got your image the way you want it, save it and then we'll move
on to creating the S*.BMP from that file.

   S*.BMP
   ~~~~~~
     The best way to create this file, I think, is to save the G*.BMP as S*.BMP and then
work with it.  Open the S*.BMP which you just saved (should look just like G*.BMP).  Now,
you'll want to put in your shadows, if any.  If you used color 120 for this when creating
the G*.BMP, then simply leave the 120 color alone, if not, you'll need to draw in the 120
sections exactly correctly.  If you put color 120 in the S*.BMP where you really wanted the
colors from the G*.BMP file to come through, they won't.  Also, you'll want to put in those
user colors.  You need to use colors 16-25 (Player 1's Colors from AOE) to draw these
sections in exactly as you'll want them to appear in the game.  When SLPCNVT rebuilds the
SLP file, they will be encoded into the game so that, instead of Blue, they will become
the color of whatever user owns them.  Finally, you need to replace every pixel from the
G*.BMP that you want to come through exactly the same way, with color 255.  An easy way to
do this would be to either color over large sections, or, for the delicate areas near the
edges or user color sections, you might want to try an image editor with a color replace
function.  Or, worst case scenario, draw color 255 in pixel by pixel.  Then resave it.
Now you've done the worst part.

   C*.TXT
   ~~~~~~
     Still, this is the easiest file to deal with.  If your Image editor will tell you the
location of your mouse pointer while you hover over then image, then open your image editor
and open either your G*.BMP or your S*.BMP file.  Hover your mouse over where you want the
center of your image to be, really, the center of the base of your image.  Then take note
of the X and Y coordinates of your mouse on the image.  Now all you do is create a new text
file with those coordinates in it with a comma between them, just like this:

If your mouse says X:45 Y:20 then the text file should look like this:

 45, 20

That's it.  If your image editor doesn't do that for you, you'll have to guess, then put it
in the text file, build it and try it out.  "Build it?  How do I build it?", you may say.
Well, finally the part you've all been waiting for...
   
_______________________________________________________
 Actually Building the SLP
_______________________________________________________

     This really isn't as hard as it might seem at first.  There are a couple ways to
build, or rebuild and SLP file from those loose files.  If there are only a few frames that
you want to put into the final image, you can simply put them all in the command line, for
our example replacing GRA00033.SLP, assuming that the new files were saved as G0003301.BMP,
S0003301.BMP, and C0003301.TXT the command line would look like this:

SLPCNVT /B GRA00033.SLP G0003301.BMP

That will build the SLP file.  It's also important to remember that your files _must_ be
named G???????.BMP, S???????.BMP, and C???????.TXT and the ??????? part must be the same.
for example your three files could be named GMYFILE.BMP SMYFILE.BMP and CMYFILE.TXT, but
they couldn't be named GMYFILE.BMP, SALSOIT.BMP, and CENTERS.TXT.  SLPCNVT takes the
given input filename (in our above example G0003301.BMP) and takes off the first char and
the last 3 and tacks on S or C and BMP or TXT as needed.

Now, for 1 or 2 frames, this works fine, just add to the end of the file like this:

SLPCNVT /B GRA00033.SLP G0003301.BMP G0003302.BMP G0003303.BMP G0003304.BMP

but for GRA00002.SLP what are you gonna do?  There are 20 files to rebuild there!  Well,
you could do this:

SLPCNVT /B GRA00002.SLP G00002*.BMP

But that would leave the order of the frames up to the directory listing.  So if, when
you type dir in the directory your files are in the same order you want them to be in,
fine, use that method.  But an even more reliable way is to make a text file listing the
frames you want in order.  To do this for GRA00002.SLP, make your text file look like this:

G0000201.BMP
G0000202.BMP
G0000203.BMP
G0000204.BMP
G0000205.BMP
G0000206.BMP
G0000207.BMP
G0000208.BMP
G0000209.BMP
G000020A.BMP
G000020B.BMP
G000020C.BMP
G000020D.BMP
G000020E.BMP
G000020F.BMP
G0000210.BMP
G0000211.BMP
G0000212.BMP
G0000213.BMP
G0000214.BMP

Then you could save it as LISTING.TXT, for instance.  Now comes the compiling part.
Use this command line to include text files:

SLPCNVT /B GRA00002.SLP @LISTING.TXT

Remember, you need to have matching files named almost the same as in the listing as
specified above.  You can also use combinations of these techniques, but with a
maximum of 300 frames per SLP file.

Now you've got your new SLP file ready to use, all you have to do is use DRSBUILD to
put the SLP file back in the DRS file, and startup the game and play!  If it doesn't
look quite right, simply re-edit your BMPs and try again.  If you come across any
errors using the program, first, make sure that you're using 256 color BMPs and
the right palettes, if you still have trouble, E-Mail me at knight@sad50.k12.me.us

Thanks for using the program!

_______________________________________________________
 Credits
_______________________________________________________
I would like to thank the following people for their fine
utilities, files, support, and encouragement:

Stoyan Ratchev, for creating DRSBUILD and Brian Yip, for his list
of the SLP files which encouraged me to start in the first place.

My wife, for consenting to be a computer widow for the past few months,
and a friend of mine who kept listening to my complaining that the
latest algorithms weren't working.

And, as always, Microsoft & Ensemble Studios for creating Age of Empires!
______________________________________________________
Copyright (C) 1998 Joseph Knight. All rights reserved.

