A Brief Introduction To Backgrounds

This document assumes that you are already familiar with how to create SFF 
files.

A background in MUGEN consists of the following elements:
*) One or more background sprites, drawn from back to front, with or 
   without masking, and with or without parallax effects
*) Specifications of how those sprites should move in relation to the camera
*) Animation data for background animations
*) Specifications of the width and height of the playing field
*) Specification of the "ground level" for the stage
*) More miscellaneous settings
*) Background controller definitions for more advanced effects.

The simplest kind of stage will simply have a single layer in the background.
Suppose you have a single PCX file which you want to use as a background 
picture. Create a file stage1.sff with this PCX as sprite 0,0. Place the axis
on the center of the bottom edge of the PCX. Now copy stage0.def to 
stage1.def and open stage1.def up in a text editor.

In the [Info] group, you can customize the name of the stage. Stage names
should be enclosed in double quotes.

To get the stage up and running as quickly as possible, simply go to the 
[BGDef] group. Change the spr parameter to point to stage1.sff, and set
debugbg to 1. Now go to the [BG 0] group. Make sure the type parameter is
set to normal (since this is not a parallaxing background element). Make
sure the spriteno parameter is set to 0,0. Set the layerno to 0 to prevent
the background from being drawn in front of the characters. Finally, set 
the start parameter to the desired starting location of the background. 
The coordinates are measured from the center of the bottom edge of the
screen. If you placed the axis for sprite 0,0 in the bottom center as 
suggested, then you can just set start = 0, 0.

Other parameters that can be set for this BG element:
delta = xdelta, ydelta
xdelta and ydelta are scaling factors: for each pixel the camera moves
horizontally, the background element will move xdelta pixels, etc. If you
only have a single background image, you will generally want to set delta to
1, 1. Using smaller deltas for the rear background layers can create the 
illusion of depth when you have multiple layers.

trans = none, add, or sub
Controls the transparency of the background element.

mask = 0 or 1
If you have multiple layers, set mask = 1 on the foreground layers to prevent
drawing color 0 for them. If masking is not necessary, then make sure to set
mask = 0.

tile = x, y
tilespacing = x, y
window = x1, y1, x2, y2

Unless you are using a small image which you want to tile to fill up the whole
background, you should set tile to 0,0. window should be left at 0,0,639,479
for now.

Finally, delete or comment out the [BG 1] block, since we don't have any 
other background elements.

Now test your stage:
mugen kfm kfm -s stage1

Try walking and jumping around. Depending on the dimensions of sprite 0,0, you
may not be able to see all of the background, or you may end up scrolling past
the edge of the background and seeing a solid magenta color (the result of 
setting debugbg = 1). To fix this problem, and to further customize the stage,
you can adjust the parameters listed below.

In the [Camera] group, the boundleft and boundright parameters control how
far the camera can scroll left and right from its initial starting position.
You should adjust these so that the camera cannot scroll past the edge of the
background. For instance, if your background image is 1000 pixels wide and 
the camera view is 640 pixels wide, then you should set boundleft to -180
and boundright to 180.

Similarly, the boundhigh and boundlow parameters control how far the camera
can scroll vertically. boundlow should be kept at 0 in most circumstances.
If your background image is 750 pixels high and the screen is 480 pixels 
tall, then boundhigh should be set to -290.

You can leave the verticalfollow, floortension, and tension parameters alone
for now. These are used to tweak camera behavior according to the comments
in stage0.def.

The [PlayerInfo] and [Scaling] groups can also be left alone for now.

The [Bound] group contains the parameters screenleft and screenright, which 
control how much a character can protrude off the edge of the screen. These
parameters are typically set to about 15.

The [StageInfo] group contains the zoffset, autoturn, and resetBG parameters.
zoffset determines the ground level of the stage. It is measured in pixels
from the top of the screen when the camera is in its starting position. You
should adjust this value to make sure the players actually stand on the 
ground level of your image. The autoturn parameter makes players turn around
to face each other if necessary, and should be left at 1. The resetBG 
parameter, if set to 1, resets stage animations and background controllers 
to their initial states. Since we won't be using animations or background
controllers in this example, you can leave resetBG alone.

The [Shadow] group determines how player shadows are displayed on the stage.
Player shadows are just vertically scaled copies of the player sprites. The
yscale parameter controls the scaling factor (where 1 means no scaling).
The color parameter can be set like this:
color = R,G,B
where R,G,B are the corresponding color components (ranging between 0 and 
255). The higher the number, the less of the corresponding color there is in
the shadow.
Finally, the reflect parameter enables reflection shadows if set to 1. This
is useful for "shiny-floor" effects.

Once your BG is working, be sure to turn debugbg back off.
