Character Creation Tutorial

From Infinitywiki

Jump to: navigation, search

This tutorial for creating M.U.G.E.N Characters is made for use with the software Fighter Factory Classic. It is suggested that you read this entire tutorial before beginning. It is also important to note that Mugen itself contains some very complete documentation to assist in character creation.

Contents

Step 1 - Sprites

To begin with, you should have all of the character sprites that you want to use before continuing to the next section. Mugen compatible sprites need to be 256 colors, contain the desired transparent color as index 0, and saved as a pcx graphic format. A typical M.U.G.E.N character will have the following sets of sprites:

Description Sprite Group
Stance 0
Turn 5-6
Crouch 10-12
Walk 20-21
Jump 40-47
Dash 100-110
Guard 120-155
Lose 175
Win 180
Intro 190
Taunt 195
Punches 200-229
Kicks 230-259
Crouch Punches 400-429
Crouch Kicks 430-459
Jump Punches 600-629
Jump Kicks 630-659
Throw 800
Special Attacks 1000-1999
Hyper Attacks 3000-3999
Get Hit 5000-5299
Portraits 9000

The sprite group numbers listed above next to the descriptions are suggested groups to assign your sprites to as you add them to your SFF file. Although this numbering pattern is standard, it is not required with a few exceptions (those being Turn and Get Hit sprite groups).

In addition to the required character sprites you may also wish to add a variety of special effect sprites to your character. These can include hit sparks, guard sparks, projectiles, smoke, hyper backgrounds or just about anything you can imagine that would be useful.

Sprite Suggestions

Suggestions on how to procure your sprites for your character are as listed:

  • Rip Sprites - You can capture sprites from previously made video games or simple use a pack of sprites that was previously ripped. Many pre-ripped sprite packs can be found on the Infinity Mugen Team website. Click here to browse the Sprite Packs.
  • Create Sprites - A creator may have the ability to draw their own sprites using a graphics program such as Photo Shop, Paint Shop Pro or Gimp.
  • Edit Sprites - Another option is to take a set of ripped sprites and edit them as desired. Click here for Sprite Editing tutorials.
  • Use a premade SFF file - To use an .sff file complied by another author you will need to first ask that author's permission.

Converting your Sprites

Once you have your sprites it is necessary to convert them into a strict 256 color palette with correct indexing and format.

Step 2 - Create the initial SFF file and default palette

03a.png

Thanks to Fighter Factory the process of combining sprites into a single SFF file has been greatly simplified since the time Mugen was first introducted. Certain Mugen conventions are also important to note

1) Portrait - Mugen has two standard portraits. Breif details are given as follows while more details can be found as necessary throughout the tutorial.

  • Large Select Screen Portrait (9000,1) - In a standard Mugen Screen pack this portrait's dimensions are 120 x 140. It is not necessary for this graphic to use a "shared palette" but often if this sprite is preceding a series of "shared palette" sprites the colors for the rest of the character will be corrupted.
  • Small Select Screen Portrait (9000,0) - In a standard Mugen Screen pack this portrait's dimensions are 25 x 25. This sprite should have the "shared palette" option selected. This portrait is also used in the fight screen's lifebars in a standard mugen screen pack.

Using a mugen template

Various character templates are available for mugen. After downloading a template and extracting the file into a single folder you may want to rename the folder as the name of the character you are creating. After doing so, open the folder and find the def file (e.g. kfm.def). Rename this file with the same name as the folder. List of character templates

1) Load your first sprite into the template and set the palette.

  • Open the character template in Fighter factory
  • In Fighter Factory, in the Sprites menu scroll to sprite 9000,0 it should be the first one. (Hint: There is a search button to help you find sprites.)
  • On the left select the "change" button to load one of the character's sprites. (Any one will do, eventually you will need to change this sprite to be the small portrait for the select screen but right now we're just setting the palette.)
  • Once the sprite is changed you should be able to see it right there in front of you and it should look just normal, with the correct colors and everything.
  • On the right hand side you can see the palette box and buttons. Click the "open the current image" button to load this images palette into fighter factory.
  • Notice all the colors on the palette just changed to match your sprite, cool!
  • On the right hand side again, click "save" to save your palette. (Hint: Fighter factory has a "save all" option in the file menu. Even when you click save all, the palette changes will not be saved, you have to always save those on the palette menu.)
  • At this point you may want to close then reopen your character in order to make sure the palette is functioning correctly. In such a case, make sure to select "Save All" form the File menu before closing.

Creating a SFF file from scratch

Although using a template is prefered for creating a Mugen SFF file, Fighter Factory is equiped to allow a user to make a SFF file from scratch.

1) Load your first sprite into the template and set the palette.

  • Open Fighter Factory and select the Sprite menu icon from the top of the screen to access the sprite menu
  • On the left select the "Add" button to load one of the character's sprites. (Any one will do. Since this is the first sprite in the file eventually you will need to change this sprite to be the small portrait for the select screen but right now we're just setting the palette.) Set the Group to 9000, the Image number to 0 and select shared palette.
  • Once the sprite is added you should be able to see it right there in front of you and it should look just normal, with the correct colors and everything.
  • On the right hand side you can see the palette box and buttons. Click the "open the current image" button to load this images palette into fighter factory.
  • Notice all the colors on the palette just changed to match your sprite, cool!
  • On the right hand side again, click "save" to save your palette. (Hint: Fighter factory has a "save all" option in the file menu. Even when you click save all, the palette changes will not be saved, you have to always save those on the palette menu.)
  • At this point you may want to close then reopen your character in order to make sure the palette is functioning correctly. In such a case, make sure to select "Save All" form the File menu before closing.

Step 3 - Compile SFF file

03a.png

Once you have a saved SFF file that is compatible with your sprites and palette then you can add/change all the sprites you wish.

1) Add sprites - When you add sprites to your SFF file using the Add button on the left there are many things you need to know.

  • You can add multiple sprites at one time.
  • You will select the group number for the sprites you are adding. The group number will be the same for all the sprites you add while on this menu so make sure to only select sprite frames that belong in the same group (for example, stance is a group, walking is a group, light punch is a group.)
  • The image number will start at what ever number you type in and continue to number all the images you've selected to add. For example if you leave the image number as 0 then the sprites will be numbered 0,1,2,3 and so on.
  • You can set the sprite position in this screen but if you're not sure what it should be you can always realign the sprite once you leave this menu.
  • On the right you have an option for "shared palette", every sprite with this option selected will use the palette you created for your character. You won't want to select this option for special FX, hyper backgrounds or any item that won't be using this same palette.
  • Also on the right is the "auto crop" option, this will cut out any unnecessary portions from the sprites.
  • It is always best to keep all of your "shared palette" sprites next to each other in the SFF file and your not "shared sprites" palettes separate.

2) Change sprites - Templates come in many different varieties with various levels of complexity. Sometimes, rather than "adding" a new sprite you may just need to "change" the current sprites. In such situations you will not need to select any of the options above, rather after selecting the "change" button all you need to do is select the sprite you wish to swap into the SFF file.

3) About the Crosshairs - Once you leave the "add" or "change" menu you'll see your sprite on the screen as well as a little crosshair. This represents the ground in mugen where your character will stand so make sure to put the feet so they are touching the crosshairs. Look at other mugen characters for examples of how this works. Your character should also be centered horizontally over the crosshairs.

(Hint: If you chose the EoH character template, there are place holder for each sprite that is necessary in Mugen, this includes the stance (0,0) and the get hit sprites (5000,0 - 5072,20) Just "change" each sprite with the correct sprite in your character.

Step 4 – Animations

03b.png

The AIR file contains all of the animation for the character in a text format. Each of these animations are called an "action". Although you could type out the AIr file by hand, Fighter Factory has a module to create this file for you based on the imput you provide. Start by clicking on the animations icon at the top of Fighter Factory, and you will see the following window:

05.png

The window breaks down into the top section and the bottom section:


1) The top section deals with general animations:

  • Each animation has an option name in order to help you organize the information. You can use the top scroll bar to rotate through each animation that is contained in the character. The green plus button will add a new (blank) animation. The green minus button will delete the current animation.
  • The Begin Action Number is the number you assign to each animation for future reference as you program the character. The mugen standards for these animations numbers are similar to the sprite groups listed above. (e.g. Begin Action Number 0 is the stance, Begin Action Number 200 is Light Punch.) Much like the sprite groups, the most important animations here that depend on the mugen standards are the stance (0), Turns (5-6) and the Get Hits (5000 - 5072)


(Hint: If you are using a template take notice notice that all of the top section's basic animations have been set up for you. All you need to do is adjust the bottom section.)


2) The bottom section deals with frames in each animation:

  • The Scroll bar here lets you scoll between frames in the animation. The green plus botton will add a frame after the current frame. The green minus button willdelete the current frame.
  • When you type in a Group Number and Image number, the same image in the SFF file with those specifications will apear and the current frame. Each frame of the animation can be added this way.
  • Once you have entered a few frames into your animation you can set the "Time" for each frame. The time is how long each frame will be show on the screen. (pressing the ,8 button will copy the current frame's time to all the frames in the animation)
  • The "Flip" option allows you to flip your fram horizontally or vertically if necessary (pressing the ,H button will bopy the current frame's flip to all the frames in the animation.
  • The Trans option give you the ability to select a level of transparency for a frame. The most common option in this screen is "A1" which will make the fram partially invisible, somewhat transparent. This is often used for many special effects like Hit Sparks.
  • The "LoopStart" option lets you select a frame where the animation will repeat back to once the animation has reached its end. This option is only used when you don't wan't the animation to repeat back to the first frame. In general, many animations do not loop at all but will apear to be looping when you press the play button on this menu. An example of this would typically be Begining Action 200, which is usually a punch attack. The code discussed in Section 4 deals with when an animtion repeats itself or not.


(Hint: As you get used to layout of an animation you can select the "Edit Action in TXT" button to add frames manually as a textr file. This can be much faster in setting up your animation.)


3) Collision Boxes (CLSN):

  • The blue (and green) boxes are for getting hit CLSN boxes. These boxes tell MUGEN where your character exists and thus can be hit. These should be in most all of your characters animations (typically not necessary for intro, win or lose animations.)
  • The red (and yellow) boxes are for the hitting CLSN boxes. These boxes tell MUGEN where your character is going to attack, and these are only needed for the frames of animations where an attack should connect with an opponent.
  • Fighter Factory has a button to automaticaly add collision boxes to an animation titled "auto". In general this function is frowned upon because it may add too many collision boxes to your character. The only problem with more collision boxes is that it tends to slow down much older computers. In general this is no longer an issue with the improved quality of processors but many authors will still try to find optimal CLSN boxes in order to increase processor performance.


Examples:

Optimal Not Prefered
char02a.png char02b.png

Step 5 – Constants Files & Programming

03c.png

The main code of a Mugen character is found in the CNS (Constants) files. Perhaps thebest way to become aquanted with this file is to open a CNS file for a premade character and review it's contents. Elecbyte develope the character Kung Fu Man in order to be a template with explanations for each major line in the CNS file. Each character can have multiple constant files although only one is required:

  • CNS File - is where the main portion of your character code below. Sometimes you may see a character with multiple CNS files, perhaps one for regular moves, one for special moves and another for hypers. This is not necessarialy needed although it helps some authors to keep track of their information and programming.
  • ST File - is simply another title for a CNS file. This is most likey to be used for any additional codeing rather than the main programing. ST files are not necessary and may even be renamed as CNS.
  • Common1.cns - is typically located in the Mugen/data/ folder and contains programming that is shares amongst all the characters (such as the "stance" or "walking forward"). Any of the information listed here can be overwritten by one of two ways. First if you copy the common1.cns file into your character's folder, nay changes you make to the version in your folder will have priority over the version contained in the Mugen/data/ folder. Second, if any of the statedef numbers (see below) found in the common1.cns file are used again in your CNS file, the version in your CNS file will take presidence.


A CNS file contains the following sections:

  • Top portion - on the top of the main CNS file you will find code for [Data], [Size], [Velocity] and [Movement] for your character. These sections are fairly self explanitory but it is important to know that if your character has multiple CNS files this data only exist on the main CNS file.
  • [Statedef] - each CNS file contain multiple [statedef]s which taken animations/actions from the AIR file and assigns them properties such as movement and attack power. The [statedef]s tend to follow the same numbering system as the sprite groups in the SFF file and the begin action numbers in the AIR file. (e.g. [statedef 0] is the stance. [statedef 200] is a punch attack.)
  • [statedef -2] - typically found at the bottom of the CNS file, or on a separate CNS/ST file, any code added to [statedef -2] will be active at all time, regardless of what other [statedef] a character happen to be using at any given moment.
  • [statedef -3] - typically found at the bottom of the CNS file, or on a separate CNS/ST file, code added to [statedef -3] will be active only while the character in in a selfstate. (When a character is thrown the opponent takes control of your character. during this time your character is not in a "selfstate" until the throw is over. During this time the opponents programming controls your character. After the attack is over your character is returned to a "selfstate" where the character's on programming takes over again.)

(Hint: When ever you see the character ; in a CNS file, it simply means that any text following that symbol will not be read by the computer. Thus this symbol is used to add any notes to your code that you may feel necessary)

Creating a [Statedef]

A [statedef] within a CNS file may start out something like this:

  [Statedef 200]
  type = S                         ;State-type: S-stand, C-crouch, A-air, L-liedown
  movetype = A                     ;Move-type: A-attack, I-idle, H-gethit
  physics = S                      ;Physics: S-stand, C-crouch, A-air
  juggle = 1                       ;Number of air juggle points move takes
  velset = 0,0                     ;Set velocity (x,y) (Def: no change)
  ctrl = 0                         ;Set ctrl (Def: no change)
  anim = 200                       ;animation/Begin Action Number
  poweradd = 20                    ;Power to add to hyper bar(Default: 0)
  sprpriority = 2

This code alone won't actually do anything. In fact, the character won't even load if nothing else follows this set of code. This is simply the heading to your set of code which will then be follow by one or more sctrls (state controls). Remember, each character will have dozens of [statedef]s which each contain various sctrls.

See also List of sctrls

A great feature on the CNS screen of Fighter Factory is that all of the sctrls are located on a menu to your right, and when you double click one of these the necessary code will be provided, all you have to do is fill in the parameters.

Step 6 – Command File and Coding

03d.png

The CMD(Command) file contains all the code necessary to connect controller(or keyboard) input commands with statedefs (mentioned above). The CMD file (list most other files) has a top and a bottom section:

CMD Top Section

The top section contants multiple [command] codes that assigns names to a series of button pushes. Each command code will look something like this.

  [Command]
  name = "x"              ;The name of the command is given in the parenthesis
  command = x             ;The button (or series of buttons) are listed here
  time = 1                ;The amount of gameclick (time) that this command must be performed within.

An example of a more complex [command] is as follows.

  [Command]
  name = "upper_x"           ;The name of the command is given in the parenthesis
  command = ~F, D, DF, x     ;The button (or series of buttons) are listed here
  time = 20                  ;The amount of gameclick (time) that this command must be performed within.

It is important to note that the more complex (the more buttons) a [command] uses the earlier in the CMD file it needs to be placed. For the two examples above, the second [command] should always precede the first [command] in the top portion of the CMD file. The following order is generally used from top to bottom - Hyper attacks, Super Attacks, then normal attacks.

See also List of Command Perameters

CMD Bottom Section

If you were paying attention earlier you probably asked yourself "what happened to statedef -1?" Well here is it as the bottom half of the CMD file. Much like all of your statedefs above, the [statedef -1] in the CMD file contains tons of sctrls, all of which are "ChangeState"s that connects your [command] names from the top of the CMD file with [statedef]s from the CNS file. Let's breifly annalize one of the sctrls:

  [State -1, Stand Light Punch]
  type = ChangeState
  value = 200
  triggerall = command = "x"
  triggerall = command != "holddown"
  trigger1 = statetype = S
  trigger1 = ctrl
  trigger2 = stateno = 200
  trigger2 = time > 6

Each of the sctrls found in the CMD file will be 'type = ChangeState' because the purpose of the controls is to move from one state to the next. The 'value = 200' see above is saying that this set of code controls [statedef 200] in the CNS file (which happens to be Light Punch.) The triggers then start, allow or prevent the code from activating.

  • triggerall = in every situation these parameters must be met. Here we see 'command = "x"' which means you must be pressing "x" and we also see 'command != "holddown"' which means this move can only be activated when the player is standing, or not crouching (! = not).
  • trigger# = each additional trigger is what additional conditions must be met for the move to be actived. In the code above we see that the code can be activated in either one of two situations (trigger1 and trigger2.) First the move above can be activated when the player is in 'statetype = s' (which means standing) and then the player has 'ctrl'. The second situation is when the character is already doing a Light Punch (stateno = 200) and when the game time is greater than 6 game clicks. (Hint: 'Triggerall' is optional, only a 'trigger1' is absolutely required.)

See also List of Triggers

Although all the sctrls listed under [statedef -1] tend to follow the same order that the commands are listed in the top [command] portion of the CMD file, it is not necessary and is simply the standard used to help find code within your character's CMD file.

Optional CMD Parameters

You also have to option to add code to the very top of your CMD file that would allow you to remap your buttons or change CMD deafults. The code would look like the following

  [Remap]
  x = x
  y = y
  z = z
  a = a
  b = b
  c = c
  s = s
  [Defaults]
  command.time = 15
  command.buffer.time = 1

Step 7 – Sounds

03e.png

The SND file contains all the Wav files necessary for your character. The Sound module in Fighter Factory looks like the following:

06.png

As you add Wav files to youe SFF file you will need to assign a group number and sound number to each sprite. These are use to reference the sounds in the CNS file.

The Sound module also has a resampling option at the bottom.

Step 8 – Making Palettes

03f.png

If you followed all the steps up to this point then your character already has one pal file. Even if you're editing a premade character there is at least one palette. If you find yourself in a rare circumstance where you have a character but the palette isn't functioning then you may need to follow the steps in the Indexing Sprites tutorial.

Creating Additional Palletes

In the sprites menu scroll to find a character sprite that has the colors you'd like to create a new palette for. Typically one of the sprites in group 0 are sufficent. Once you're looking at the sprite of your choice on screen the open the Palette Menu. 02.png

Simply enough, you select the color you want to change on the palette, then you replace it with which ever color you want. Once you replace all the colors save the palette. Remember though, for every palette your create, you need to add it to the character's def file for it to work in the game.

Personal tools
Infinity Network