To understand how a stage is functional, you must first understand the basic principles of it. The fundamentals revolve around simple coding, in order for you to build the stage as you see fit. For each line of code listed, there will be a definition associated with it. So you will understand what is being said, and what it means. For starters, the term “Backgrounds”, is a reference to both foreground & background objects as a whole.
Basic Coding Parameters: The lines of code below, that tell MUGEN what parameters to use, to control the stages camera & character positioning. Among a few other things.
[Info] code line: name,author= Name of your stage & author. This is pretty self explanatory. Whatever you put in this line, MUGEN will understand & display this, as the definite name for your stage. I will be using my “River in the Gorge” stage def, as an example for this. Anything you see *** above said coding, is coding you will have to manually check & change, to get it right for your stage. Take note of that. Now…let’s begin with the basics
name = “River in the Gorge”
author = “DarkValentine”
The above will always tell MUGEN name and author. This CAN be changed, but I do NOT recommend you do this, to a stage that is NOT your creation. Only do this for private use, if you want the stage to have an easier name for you to remember or understand.
[Camera] = This is the Camera coding line. Everything in this line, is to allow you to have the camera move to a specific degree. As well as a specific height or depth. It comes with the following lines. They will be explained as displayed.
startx = 0 (horizontal position)
starty = 0 (vertical position)
Camera starting position: Usually 0 for both. You do NOT have to change the values here, unless your stage demands it.
boundleft = -208
boundright = 208
Left and right bound of camera. The values that are adjusted here, will denote where the “edge” of your layer is, that you want to use, as the wall for your stage. Boundleft is ALWAYS a negative number. Keep this in mind, for this line of coding, at ALL times.
boundhigh = -220
boundlow = 0
High and low bound of camera. bound in MUGEN terms is short for “boundary”. boundhigh should ALWAYS be a negative number. This dictates how high up you want the camera to scroll. This will highly depend on the image you use. An acceptable number is anywhere between -220 to -256. Only go higher if necessary (or if you are making a stage for mugen 1.0). boundlow is often left at 0, and should NOT be changed, unless your stage demands it.
PROTIP: If your stage does not have a layer that has a top, or is unable to scroll. boundhigh can be set to 0. Unless you can edit, or the layer you have can allow it, leave it at 0, or adjust as needed.
tension = 60
The horizontal distance for all players are, from either left or right edge of the screen, before the camera moves left & right. 50 or 60 is usually an acceptable number. If unsure, leave it at 60.
floortension = 90
Minimum vertical distance that the players have to be in the air, before the camera starts to follow. Another name for it, is called “pixelheight”. For larger stages, a larger floortension value has to be used. The bigger the stage, the larger the number. 20-30 are acceptable numbers for moderate stages. Larger stages can go higher. You will need to adjust the next value, to compensate, which is…
verticalfollow = 1
This value will determine how much the camera will move upwards, to whoever is the highest off the ground, during a “super jump” like effect. This gives the illusion of such a move. Another name is “aerial rave”. You can use either 1 to force the camera to always follow the highest player. You can use 0 to prevent the camera from moving upwards. Or, you can use .2 for normal sized backgrounds. Adjust this value to your discretion, based on your stage needs.
This line of coding, determines the player starting X & Y position on the screen. These values are usually not altered, and can be left alone. You will only need to adjust this, if you have large characters and a large stage, or small characters on a very small stage. Example:
;— Player 1 —
;Player 1 starting coordinates.
;p1startx is typically -70 and p2startx is 70.
;p1starty and p1startz should be 0.
p1startx = -70 ;Starting x coordinates
p1starty = 0 ;Starting y coordinates
p1startz = 0 ;Starting z coordinates
p1facing = 1 ;Direction player faces: 1=right, -1=left
;— Player 2 —
p2startx = 70
p2starty = 0
p2startz = 0
p2facing = -1
The above values do NOT need to be changed for the majority of stages. So DO NOT ALTER them, unless you know what you are doing.
leftbound = -1000
rightbound = 1000
This line of coding, unlike boundleft & boundright, are completely different. This determines the amount of space in pixels both characters & projectiles can move, to either side of the screen. This value is always to be increased in increments of 100. Example: River in the Gorge has a boundleft & right of 208. The default numbers to be used, is 1000. Even if your stage is below 500, you can use 1000 as a starting number. As soon as your stage goes beyond this, you MUST increase it by 500, for every value over 500. Otherwise, you will hit an invisible wall. If your stage bounds are 1500, you must make leftbound & rightbound 2000, and so forth.
PROTIP: While it is NOT necessary to change leftbound & rightbound, you NEED to do so, if you plan on having a long scrolling stage in either direction. If you have no plans on making such a stage, leave it at the default values of 1000.
topz = 0
botz = 50
topscale = 1
botscale = 1.2
The above line is for stage scaling purposes. 96% of all MUGEN stages, do not have this value altered. So you can leave this alone. Unless your stage demands it.
screenleft = 15
screenright = 15
This works hand in hand with boundleft & boundright, as well as leftbound &rightbound. It determines the distance of left/right edge of the screen for all players on screen, that can move to it. The default number is 15. In most cases, you NEVER need to change this.
StageInfo refers to the Z offset value for drawing. And a few other lines of code.
zoffset = 212
zoffset determines the value for the ground level. Adjust this number to a higher or lower number, to allow all characters to stand at the height you deem fit. A lower number will raise them higher up, while a higher number will drop them lower. The optimap value for zoffset is anywhere between 210 & 256. Adjust as needed.
zoffsetlink = 1
It is usually a null number. The line of coding here is optional, and it is not needed for a stage to function. Some stages however do require it. So if unsure, leave it in, or take it out.
autoturn = 1
This line of code tells MUGEN to make players always face each other, no matter how many times they cross each other after a jump, or special move. By changing this value from 1 to 0, you are telling MUGEN that characters will be able to turn left or right, as they see fit. Take care though, this setting tends to break moves. So, if unsure, leave it set at 1.
resetBG = 0
This line of coding enables the stage you are creating to reset it’s background animations at the start of each round. While it is a novelty line of code, not all creators want to see the stage reset to it’s starting animation each and every single round. The default value is ALWAYS 0, unless you make a stage that requires the animation to start over at the beginning of each new round, then you would set it to 1. Otherwise, leave it at default.
Hires = 0
This line of coding tells MUGEN that you are creating a HiRes stage. This will increase the scaling factor of the stage, but you may need to make adjustments. This value, depending on the stage, can be omitted. If you are using mugen 1.0, then the value will always be 1. Otherwise, any stage you create for Winmugen Plus, this value can be set to 0. If unsure, delete or set this to 0 at ALL times.
intensity = 64
This controls how dark you want your shadow (if you want one visible on the stage). Any number from 0 being the lightest, to 256 being the darkest, can be used. If you omit this line of code, MUGEN will automatically default intensity values to 128. Adjust this to your needs, based on the lighting in your stage.
color = 0,0,0
The 3 numbers represent Red, Green & Blue respectively. Adjust these numbers to your discretion, based on you wanting to give your shadow some type of fidelity. It is recommended that you leave all 3 values of color to the default of 0. It is not necessary to change it, unless you want to do so.
yscale = .2
This line of code, tells MUGEN the scaling factor of your character’s shadow. using a normal number will allow it to appear as “positive” and appear behind the character. Using a Negative Number will allow it to “fall” into the floor. Mostly aiming towards you. If unsure, the default number is -.1. If omitted, it will default to 0.4
fade.range = -400,-100
This interesting piece of coding, because it will allow you to set the range of your visible shadow, as you jump in the air. the first value is the high value, and the second value is the middle value. Both numbers represent the Y position of a character in the air. The shadow on the ground will turn invisible, once said character reaches a specific height. It becomes fully visible if it’s below the middle value. You can adjust this to your liking, to have a shadow disappear before the camera scrolls up, and appear before character touches the ground.
intensity = 128
This value determines if you want a reflection along the ground. This line of coding should ONLY be used on a stage, that has a shiny floor. You can use any number between 0 and 256, with 128 being the sweet spot. If this value or line of code is omitted, it will use just the shadow. Depending on your stage, you can have both a shadow & a reflection.
This value tells MUGEN, that you want to run the engine in debug mode. This allows you to find problems within your stage, such as the color you used as the transparent color, to allow your stages to have visible layers. It also makes mugen run harder than usual. Newer computers don’t have an issue with debug being left on…BUT, the rule of thumb is ALWAYS keep this off, if you are going to release a stage.
this is self explanatory. All music used in MUGEN, belongs in the”Sound” folder”. It would look something like this:
bgmusic = sound\Planet_Wisp.mp3
you MUST start it with the directory name. You do NOT need the full directory. The name MUST be accurate, otherwise no music will play.
bgvolume = 255
Allows you to adjust the volume of the stage in question internally. Leaving it at 0 is the default. the max is 255 and -255 respectively. Adjust accordingly to suit your needs.
This is telling MUGEN, the filename of your stage’s sprite file, or .sff file. Without it, MUGEN cannot tell what it is, and will NOT run the stage. Make sure you are inputting the location. both .def & .sff files MUST be located in the “stages” directory of MUGEN, for it to work. The below line is an example.
spr = stages/rivervalley.sff
Background Layer Parameters: The following will tell you about specific lines of code, that control whatever layers you input for your stage. They are as follows:
; type = ? “Normal”/”Parallax” (def: “normal”)
; spriteno = ?, ? Sprite group and number: groupno, imgno (req’d)
; start = ?, ? Starting location (integer) (def: 0, 0)
; delta = ?, ? Change in location per camera unit moved (float) (def: 1,1)
; trans = ? Transparency settings: “none”/”add”/”add1″/”sub”/”addalpha” (def: “none”)
; alpha = ?, ? (only for trans=addalpha) Source,dest alpha (def: 256,0)
; mask = ? Masking (int): 0 – off, 1 – on (def: 0)
; velocity = ?, ? Velocity: x, y (float): speed background moves (def: 0, 0)
; tile = ?, ? Tiling: xtile, ytile (int): 0 – off, 1 – infinite,
; >1 – tile that number of times (def: 0, 0) – only for Normal BG
; tilespacing = ?, ? Tiling: x, y (int) : space between tiles (def: 0, 0)
; xscale = ?, ? Top xscale, bottom xscale (float)
; width = ?, ? Top width, bottom width (int) (use either this or above, but not both)
; yscalestart = ? Starting y-scale (float, in percent) (def: 100)
; yscaledelta = ? Change in y-scale per unit (float, in percent) (def: 0)
To understand above, I’ll break it down one by one. Let’s go over the basics.
You can change this to anything you want, as it is recommended to name it. So you would know what layer is what. An example of this, is [BG Floor]. You can use and create as many as you like, for as many layers you have inserted in your stage. Layers do NOT appear, if you don’t specify a new BG layer for each additional line.
type = normal
This line of code tells MUGEN, what type of layer this is. There are 3 types of layers that are used in MUGEN: Normal, Parallax & anim. Setting it to “normal” allows the layer to behave like a normal, motionless layer. setting it to Parallax, allows the layer in question to have said effect of depth perception (more on this in a bit). and the “anim” type, is used to allow a layer to be an animated layer, if you have more than one image used (will explain this in a bit). So remember:
Normal = motionless layer
Parallax = field of depth perception layer (will be explained at the bottom of this page)
Anim = animated layer (will be explained at the bottom of this page)
spriteno = 0, 0
This line of code, works with the .sff file you created in Fighter Factory Classic. The two values are the “Group” number, and the “Sprite” number. You only have to change this line, based on what number you have your sprite layers in the .sff file. This line of code MUST NOT BE OMITTED! Doing so, will make MUGEN become unable to read the stage. And therefore, it will crash.
layerno = 0
This line of code, determines if the layer to be used, will either be a foreground or background object. The only valid values are 0 and 1 respectively. Use 0, if the object is going to be behind the characters, and 1 if the object is going to be in front. If you choose to omit this line, MUGEN will assume the layer is meant to go behind the characters. Adding it in is not necessary, unless it’s going to be a foreground item.
start = 0, 0
This is the line of coding that determines the starting position, of the layer you are using. the left number is the X position, the right number is the Y position. You can use negative numbers for either. You can adjust it in the .def with notepad, or, in the .sff area with Fighter Factory Classic.
delta = 1,1
This line of code tells MUGEN, the number of pixels the background moves, for each layer used. The left is X value, and right is Y value. For the BG layer that will be used as the Floor (will talk about this in a bit), the delta should ALWAYS remain as “delta = 1,1”. This will ensure all characters can move with the floor, as well as the vertical rise and drop evenly. Any layer you have that will not be the floor, and is further into the background, should use a lower number. It is perfectly acceptable to use 0.5,1 or 0.50,1, or any combination of numbers. A general rule of thumb, is to experiment. The lower the value (decimal points included), the slower a layer moves. This holds true if you are aiming for a true “Field of Depth Perception” effect. You do this, if you are aiming for the stage, to be as realistic in movement (and believable) as possible. Adjust based on which layer you are using.
trans = none
This is the transparency setting for the background layer you are adding in. You can use this for each layer you want to use it on, based on your needs. Mostly effective with the foreground layer in particular. The values used are as follows:
trans = none – for normal drawing
trans = add – for colour addition (like a spotlight effect)
trans = add1 – for colour addition with background dimmed to 50% brightness
trans = addalpha – for colour addition with control over alpha values (you need; an “alpha” parameter if you use this)
trans = sub – for colour subtraction (like a shadow effect)
Use any of the above values, if they apply to the layers you want to incorporate. If omitted, it will default to “trans = none”.
The Blackjack Effect is derived from using the “trans” coding layer (this will be explained at the bottom of this tutorial)
alpha = 256,0
This works hand in hand with the “trans = addalpha” line of coding. It is ONLY used for that specific line of coding, if you have a use for it. the first value is the sprite source value, the second number is alpha destination. Any number between 0 and 256 can be used.
mask = 0
This is making the choice of whether or not, you want the masking color you used for your layer image, to be drawn into the stage, as a 0 color. If you turn it off (0 by default), it will use less CPU power. A rule of thumb, is to only use this for the farthest layer (like the sky, or another object). Or, if your stage layer demands it. Otherwise, keep at 0. If you omit this line of code, it will default to 0.
tile = 0, 0
This line of code, is telling MUGEN to tile a layer you added in. the left number will tile in a horizontal motion, while the right number is vertical. You can use as many numbers as you see fit, for as many times you want the object in question tiled. If omitted, MUGEN will assume you do not want it tiled to begin with, and will not do so.
tilespacing = 0,0
This works hand in hand with the “tile” line of coding. It is self explanatory. This tells MUGEN how much space to use, between whatever you chose to tile. the higher the number, the greater the tile distance. Omitting this line has strange results & effects, if you adjust the “tile” line to anything other than 0,0. So, if unsure, remove both “Tile” and “tilespacing” lines.
window = 0,0, 319, 239
This is the drawing space” window” of the background layer in question. This is an advanced line of code, that uses “x1,y1, x2,y2” as the method of input. (x1,y1)-(x2,y2) define a rectangular box, or something similar, so you will need to adjust accordingly. You can make the window smaller than it appears, but this is often one line of code you don’t need to change. And you CAN omit this line, if you have no use for it. It will NOT harm your stage if you leave it out.
windowdelta = 0,0
This line of code is similar to the “delta” line of code. It only affects the movement of the “window” coding line. Unless you have a use for it, it can be omitted from your coding layer, alongside “window”. It usually has a default of 0,0.
velocity = -0.30,1
This line of coding that is used, is telling MUGEN to make a layer scroll in a specific direction. the left value is for the X position, right value is the Y position. Any number that you use in the left value that is negative, will move to the Left. Right value has a negative number, it will move Down. The lower the number, the slower it moves. Decimal points are encouraged to be used, and you will need to adjust as needed. Only use Velocity, if you are using “tile” and “tilespacing” code lines as well. Otherwise, the image will slide off the screen. If omitted, MUGEN will assume the image doesn’t move at all, in either direction.
sin.y = 2.6, 200
This line of coding is used for the pitch of an object (and in some instances, the floor, if you have a layer that needs it). The left value is the “force” of the pitch. The right number is how much. Adjust this to your discretion. If omitted (in which it often is, unless needed), MUGEN will assume it is not needed.
id = 1
A background controller effect. Often used when sin.y is used. Depending on it’s need, or the specific line of code invoked. The majority of the time, it is NOT needed, if your stage doesn’t demand it. Omitting this line is safe to do.
Using the above to understand, remember what you see in this particular image:
Whatever you have as the Floor, or foreground layer, will ALWAYS be at the bottom of the .def file. Everything that starts AFTER “debugbg” is the farthest layer in the background. It’s easier if you label it, exactly as shown in the image. It helps if you label your layers. So you will know what is being used. You CAN add animation controllers after this (will explain this below).
Understanding Parallax, Animation layers & The “BlackJack” Effect:
To understand how Parallax works, you must understand how the “Field of Depth Perception” works in the real world. when you are walking from left to right, objects closer to you, move at your speed. The farther away you are from something else, the slower it appears to move. The Parallax effect is along the same lines.
type = parallax
This line of code, is used when you need a floor, to assist you in the “Field of Depth Perception” effect. It usually involves the “xscale” line of coding. Example: xscale = 1, 1.980 ;1, 2.116 ;1, 1.773″ These are “float” variables, to make the floor move in this fashion. This code is used in the “Skyline” stage I released. You MUST use both type = parallax & xscale for EVERY layer that you want to have this effect in. You also MUST adjust the numbers accordingly. You will need to toy with the numbers, until you have it set at the desired effect. This is not perfect by any means. Only use parallax if you have a need. Otherwise, stick with “type = normal” as the code line of choice.
type =anim & actionno
these two lines of code are unique. Because it allows the layer in question, to animate in the stage. Given that you provided the layers to make it happen. Instead of “spriteno” it uses “actionno” as a way of telling MUGEN “I want to animate this layer group”. an example is from the “Skyline” stage:
type = Anim
actionno = 2
“actionno” replaces “spriteno” and only needs 1 number. The number that is being used, is the “controller group” number that MUGEN identifies as an animated layer. Example: If you have a sprite in the .sff file grouped as 2, and a number of other sprites are also grouped in, with the sprite order being changed to 2,1 2,2 etc…then you ONLY need to just use 2 as the actionno controller. if you use this line, it must NOT BE OMITTED!
start = 0,0
delta = 0.15,1
mask = 1
;——-Action Numbers For Animations in stage—————–;
[Begin Action 2]
The above line MUST ALWAYS start with “Begin Action x”. X representing whatever number you used in the “actionno” line of code. If you do not do this, MUGEN will crash when you select the stage & attempt to play it. This must NOT be omitted.
The 5 sets of numbers you see, work hand in hand with “actionno” and the “Begin Action” lines of code. The first value determines the Group number, the second value determines the “sprite” order. The 3rd value is the X position, the 4th value is the Y position, and the 5th value is the “speed” of the sprite used. The last number is important, because it is telling you how fast it will move. It uses a “ticks” system. The lower the number, the faster it moves. The higher the number, the slower it moves. This will allow you to tell how fast to make it move:
0 ticks = infinite FPS
15 ticks= Moves at 0.5 seconds
30 ticks = Moves at 1 second
The BlackJack effect:
It is a set copy line of code, that allows you to use a foreground object, as a means to make whatever character/projectile become visible, upon passing behind it. This works well for any pillars, rocks, or other solid objects that appear in the foreground of any stage. To do this, you will need to make 3 copies of the BG layer that you plan on using this effect on. For this example, I will use the “Raptor’s Hall” stage that I created. See the image below:
You can clearly see above, that you CAN see this character appear to be visible through a solid object. As explained before, you need to copy one BG layer, into 3. For this layer, I used the Pillar. It looks as follows:
type = normal
spriteno = 4,0
start = 0, 0
delta = 1.5, 0.90
mask = 1
layerno = 0
trans = none
tile = 10, 0
type = normal
spriteno = 4,0
start = 0, 0
delta = 1.5, 0.90
mask = 1
layerno = 0
trans = sub
tile = 10, 0
type = normal
spriteno = 4,0
start = 0, 0
delta = 1.5, 0.90
mask = 1
layerno = 1
trans = add
tile = 10, 0
In those 3 copies, if you noticed, I used “trans = none”, then “trans = sub”, then “trans = add” in that order. one for each line. This allows the object that I choose as a foreground layer, be able to allow you to see a character pass directly behind it. So you don’t miss the action. This works well if the object is larger. You can also replace “trans = add” with “trans = add1” to drop the brightness down to 50%, so it will have a more realistic “dimming” effect. Great for slightly dark stages, or less lighting.
As a final note, you can build the Group & Sprite Order numbers any way you see fit, but the optimal way is using 0 as 1. That is just me, so you can use whatever you like. As long as you follow this beginner’s guide, you will understand the code lingo, and what people in the MUGEN community mean, when they mention the coding.
This ends Part 1 of the tutorial for Understanding Coding: Beginners Guide.