This is an info file about creating own levels.
This is currently unsupported, so please don't ask me why something doesn't
work. Level editing is easy if you know your way around with flag bits and
different fileformats. Therefore it is not recommended to people who aren't
familiar with these concepts.

Self made levels will not work with shareware version.

Firstly, all the files must be in level directory (default "lev/"; change with
"a2 -levdir c:/mydir/"). The main level file is "sumthing.lev" which contains
information about the level. "Sumthing" would also be the name of the level.
.Lev file contains the following information:

BGtexture       Filename for your background texture (must be 24bit BMP)
FGtexture       Filename for your foreground texture (must be 24bit BMP)
Special         Filename for special land flags (must be 8bit BMP) (see
                below) (can be specified up to 63 times in one level
                file)
BGdarken        Number indicating the amount of darkening for background
                Normally 0-2.
FGdarken        Same as BGdarken but for foreground
min_width       Minimum width of the level (must be at least 320)
min_height      Minimum height of the level (must be at least 240)
max_width       Maximum width of the level (at least min_width).
                Theoretically there is no limit but your level will take
                a lot of memory if you set this too big (512 should be
                considered maximum)
max_height      Maximum height. Again, should be 512 or less.
min_landmass    Minimum landmass of the level (usually 0)
max_landmass    Maximum landmass of the level (usually 3)
gen_type        Generation algorithm of the level (see below)
snow            Probability of snowing (0 never, 10 always)
birdcolor       16bit color of birds (-1 for no birds in level) (see
                below)
dudecolor       16bit color of dudes (-1 for no dudes) (see below)
seed            Random seed used for level generating (if specified, the same
                level will be created everytime)
ShadeBG         True/false (1/0). Should background be shaded when
                generating level (default 1)
ShadeFG         Same as ShadeBG but for foreground
Realtimeshade   Should background be shaded when some land is cleared
                out. (default 1. Normally same as ShadeBG)
Shipshadow      Should shipshadow be drawn (default 1)
Version         Required A2 version number (see below)
Checksum        This is only used with those few levels that are
                distributed with shareware version. You should just
                ignore this.

Example:
BGtexture = mytex.bmp

Note that there must be spaces before and after the equal sign.

All bitmaps must be flipped upside down beacuse of my lazyness to program
(NOT rotated 180 degrees!).

If you don't want to use generating algorithms you should use gen_type = 3,
and set min and max dimensions same. (This allows you to draw the levels and
use them as such)

Generation algorithms are:

0       Normal          Sin/cos waves. This is what you should use if
                        you want a random level.
1       Cheese		UNUSABLE for anything else
2       Puzzle          UNUSABLE for anything else
3       Do_nothing      This mode won't cut or add anything (not even docking
                        plates) to your level. Special bits should be used if
                        this mode is chosen.
4       Cloud           UNUSABLE for anything else
5       Asteroid        Turbulating fractal function (min_landmass and
                        max_landmass must be equal, and are in different scale
                        than in other algorithms; good values are 10-30)

Special bitmap is probably the hardest part of level generation. It is an
8bit BMP. It's dimensions should normally be same as your level and it
should be used only with gen_type 3. Pixel value is interpreted as a flag byte.
Currently there are only six bits in use:

Indestructible wall     1
AI Docking plate        4
Easy docking plate      8
Passable wall           32
Docking plate           64
Empty space             128

AI docking plate bit should be set on one single pixel in each
dockingplate (at the center). These pixels with AI Docking plate bit set
on tells AI where docking plates are. Do NOT fill entire dockingplate
with this bit, only the center (if you have a very big docking plate you
might consider setting two or maybe three pixels in that docking plate).
You must not put more than 31 of these pixels in one level. If gen_type
is not 3 (do_nothing), maximum amount of these pixels is 15.

Easier way to make a docking plate is to use the easy docking plate bit.
Set this bit in land just one pixel under and in middle where you want
your docking plate to be. A2 will automatically then draw a regular
docking plate and handle all the indestructible and AI things.

All other bits are reserved for future developing (or hidden secrets).
Bits are used by simply counting them together. For example if you want
a wall that is docking plate and is indestructible you would use color index
65 (1+64).
So, to make a docking plate, you first draw it to foreground bitmap. Then set
color number 65 to the same place in special bitmap. This requires some skills
with painting programs, so I suggest you wait until somebody makes a level
editor.

Another way to make a premade level is to use empty space bit in special
bitmap. Then you can use smaller foreground texture thus making the size
of the level smaller.

You can assign up to 63 special bitmaps to one level. A2 then takes on
of those by random. This way you can make one level file that uses one
fg and one bg texture but hase many premade levels in special bitmaps.

Dude/Bird color is a 16bit color number which is used for drawing
birds/dudes. It is a normal 565 color value:

red   green  blue
11111 111111 11111 = 65535

It is strongly recommended that you tell what version of A2 is required
for your level. Some features are only available in new versions. Set
the lowest version number your level is compatible with. Here is a table
what version different features require. All other features are
compatible with 1.0.00

Easy Dock bit in special bitmap                 1.0.1
Empty Space bit in special bitmap               1.0.1
Multiple special bitmaps in one level           1.0.1

Tips and limits:
        -Keep the gravity between four and zero. I'm sure someone would
         like to make level with negative gravity but it just won't work
         fine yet (things falling down, AI presumws that the gravity is
         positive, etc).
        -Computer players can't navigate in too tight places or in too
         complex mazes.
        -Level size should not be over 512*512.
        -When creating textures remember that A2 is normally in 320x240
         resolution and Microsoft Windows, OS/2, XWindows etc. usually
         use bigger resolution. Also keep in mind that although
         textures are 24bit, A2 is in 16bit color mode.
        -When distributing your levels, I strongly recommend that you
         COMPRESS all the files into one package since 24bit bitmaps
         will take a lot of space but they can usually be compressed
         with at least 1:2 ratio.
        -It would be nice if you named your files wisely. For example:
         mylevel.lev mylevel.fg, mylevel.bg, mylevel.s00, mylevel.s01
         This way everybody knows what files your level uses.
        -You may set your files to subdirectories (except the main .lev
         file) but then remember to use / intead of \ when pointing to
         that file in the main .lev file.
        -Textures should always be seamless (unless max width and height
         equals texture width and height).
        -If you don't want to cut off anything but want to place random
         docking plates, set gen_type to 0 and min and max landmass to
         -100.
        -Take a look at the .lev files and bitmaps in lev\ directory for
         reference.
        -If you want to you can write comments in the lev file by beginning
         the line with //
        -If you think that you have made a very good level, you can send
         me URL where I can download it. If the level is good enough, I might
         put it available in the official A2 homepage.
