Character Definitions
The Definitions (.def
) file declares simple information about the character, including the name, version info, author, source files, and palette configuration. M.U.G.E.N only reads four sections: Info, Files, Palette Keymap (1.0+), and Arcade.
Info
The [Info]
section contains basic information about the character.
Keys
[Info]
declares the following keys:
name
The name of the character. This is not displayed in-game and is therefore used to uniquely identify a character. A common convention is to use "systemchar"
e.g. "cvsryu"
, "sf3ryu"
, "kofryu"
, "sf2stryu"
.
displayname
The display name of the character. This is displayed in-game, so it is recommended to keep it short, unlike [[#name
]], which can be arbitrarily long. Therefore, it is completely OK to use "Ultra Instinct Goku"
for the name
parameter, but the displayname
should be "Goku"
.
versiondate
The version date of the character. This is used nowhere in-game, cannot be read in CNS, and seems to allow for any date or version format so M.U.G.E.N most likely does not read this value at all and exists merely for user convenience. Some authors update it with their characters, and others use it to keep track of when they started working on the character.
mugenversion
DOS and beta versions of Windows M.U.G.E.N used a date for this field, but as of 1.0, was changed to a decimal number. M.U.G.E.N will read and work with both, though M.U.G.E.N 1.0's backwards compatibility only goes back a few versions.Template:Citation needed
author
The author name. This can be read in-game and is used to more uniquely identify characters.
pal.defaults
Default palettes, in order of preference. When a player chooses a character and palette on the select screen, if that palette has already been selected by the player or their opponent, then it will fall back on the next value in the pal.defaults.
localcoord
Local coordinate space width and height for the character. Please see M.U.G.E.N Documentation:Coordinate Space Notes for more information. In official M.U.G.E.N versions, the y parameter is ignored and just scales by the same value as x. Clone engines, on the other hand, such as IKEMEN Go, have fixed this.
Files
The [Files]
contains a list of source files for the character, including sprites, sound, animations, constants, and states.
Keys
The following keys are declared:
cmd
Character command set. See M.U.G.E.N Documentation:Commands for more information.
cns
- Constants. See M.U.G.E.N Documentation:Character Constants for more information.
st_
Character states. _
may be either blank or any number from 0 to 9, which means a character can have at most 11 st
files listed in their .def
. These files contain the source code for the character, written in the CNS language. Common file extensions are .st
and .cns
, though M.U.G.E.N does not care about the file extension. For more information about coding states, please read M.U.G.E.N Documentation:CNS Format.
stcommon
A special state file that is loaded last in order to provide any missing states for the character from the character from the specified file, looking in the data/
or motif folder.
sprite
The character SFF file.
anim
The character animations, written in the AIR Format.
sound
The character sounds, in the M.U.G.E.N SND Format.
ai
The AI hints data. When this tag is added, MUGEN writes data to the file, though according to line 24 of kfm.def
from M.U.G.E.N 1.0, it never seems to read the contents back as it says it is unused in the engine.
Character ST File Loading Order
When MUGEN is loading a character's states ([Statedef XXX], [State YYY]), the following file types designated in the char's definition file's [Files] section are loaded in the following order:
- st
- st0
- st1
- st2
- st3
- st4
- st5
- st6
- st7
- st8
- st9
- cmd*
- stcommon
*The [Command], [Remap], and [Defaults] sections of the cmd file are loaded prior to the state data/code loading process, probably so that MUGEN can tell which uses of the command trigger are valid or not:
[Command] name = "ValidCommand" command = ~D, DF, F, x [Statedef -1] [State Trigger Example] trigger1 = !AILevel trigger1 = ctrl trigger1 = command = "ValidCommand" ; Checks if the "ValidCommand" command has been inputted trigger2 = command = "CommandThatIsInvalid" ; Causes an error since "CommandThatIsInvalid" is not a specified command
MUGEN ignores duplicated states, which is why the notion of 'overwriting' the common states usually found in the file designated as stcommon exists. The notion that MUGEN 'overwrites' states is incorrect though.
Specifying [Statedef 0] in say the file designated as st9 would make MUGEN ignore the one in stcommon, and a [Statedef -1] designated in stcommon would be ignored unless you remove the one in cmd.
Every one of the above files, if put in the [Files] section of a character's definition file, must contain at least one state, including cmd. Which is why [Statedef -1] is put in cmd to fill that hole and make MUGEN happy.
MUGEN doesn't load state code in the cns file in [Files], as in it ignores the [Statedef XXX] and [State YYY] sections entirely. However you can do what Kung Fu Man does and use the same file path for multiple file types:
st = kfm.cns ; Parses the '[Statedef XXX]' and '[State YYY]' sections of "kfm.cns" to load state code for the character cns = kfm.cns ; Parses the '[Data]', '[Quotes]', '[Movement]', '[Size]', and '[Velocity]' sections of "kfm.cns" to load constants for the character anim = kfm.cns ; Parses the '[Begin Action XXX]' sections to load animations for the character and their corresponding hitboxes
It is currently unknown where and when in the loading process MUGEN loads the anim, sprite, and sound files specified in the [Files] section.
Palette Keymap
The palette keymap maps character selection buttons to palette numbers. In official M.U.G.E.N builds, only the palette index is mappable; the group is always fixed at 1. So for instance, in the following example, when the player selects kfm with the a button, palette 1,4
is mapped to the character.
Arcade
This section contains links to the character storyboard files. There are only two parameters, intro.storyboard
and ending.storyboard
, both of which may be linked to a storyboard .def file.
x = 1 ;Press button X to select palette 1, etc. y = 2 z = 3 a = 4 b = 5 c = 6 ;x2 = 7 ;Hold Start and press button X for palette 7, etc. ;y2 = 8 ;z2 = 9 ;a2 = 10 ;b2 = 11 ;c2 = 12