# M.U.G.E.N Upgrade Notes

These notes serve to help you upgrade your content from older versions of M.U.G.E.N to M.U.G.E.N 1.0.

Contents

- Character Changes in 1.0
  - DEF File
  - CNS File
- Stage Changes in 1.0
- Motif Changes in 1.0
  - system.def
  - fight.def
- Sprite File Changes in 1.0
- Music and Sound Changes in 1.0
  - Quick Audio FAQ
  - Detailed change list
    - mugen.cfg changes
    - CNS changes
    - New stage parameters
    - New system parameters
    - New storyboard parameters

# Character Changes in 1.0

M.U.G.E.N 1.0 is backwards compatible with the majority of content from version 2002.04.14. However, there are some new features that will be available only if a character's mugenversion is updated to 1.0. You can update your content by the following steps:

## DEF File

- In the `[Info]` section, set `mugenversion = 1.0`.
- In the `[Info]` section, add a `localcoord = 320, 240` line. Optionally, this value can be adjusted to resize the player's coordinate space. Refer to the documentation on coordinate spaces for more info.

## CNS File

- Locate all `HitDef` state controllers and add 1 to the `pausetime` of each (this change of behavior is due to a bug fix in 1.0).
- If the player CNS has overridden state 5900, you will need to add a RemapPal controller to your state 5900. You may copy the controller from state 5900 in common1.cns.
- Locate all PlaySnd state controllers with a `volume` parameter and change it to use `volumescale` instead. The behavior of volumescale is different from volume in that it interprets its parameter as a percentage instead of an offset, e.g. instead of `volume = 0`, use `volumescale = 100`. This information is in the "Music and Sound changes" section of this document.
- Add win quotes to your character by adding a `[Quotes]` section to the CNS file. Refer to example in kfm.cns.
- Use the `StageVar` trigger to detect which stage a player is on, instead of previous methods.
- Use the `AILevel` trigger to detect the activation of player AI, instead of previous methods.
- Use the `GameWidth` and `GameHeight` triggers instead of constants like 320 and 240 where referring to the width and height of the play area.
- Find all instances of `gethitvar(zoff)` and replace with `0`, or otherwise change the logic to omit the check.
- Search for all AssertSpecial controllers and add a line `ignorehitpause=1` if the flag is one of: `nostandguard`, `nocrouchguard`, `noairguard`, `noautoturn`, `noshadow`, `nojugglecheck`, `nowalk`, `unguardable`, `invisible`
- Search for `snap`, `mindist` and `maxdist` in all HitDefs and remove the third (z) parameter if it exists, e.g. `snap = 40, -10, 0, -1` becomes `snap = 40, -10, -1`.
- Search for all `vel z` and `pos z` triggers and replace with `0`, or otherwise change the logic to omit the check.
- Search for all velset instances in the [Statedef ...] sections and remove the third (z) parameter if it exists, e.g. `velset = 0, 0, 0` becomes `velset = 0, 0`.
- Fix any HitDefAttr triggers that are malformed. The correct syntax is `HitDefAttr <oper> <value1>, <value2>` where `<oper>` is `=` or `!=`, `<value1>` has at least one letter of "`SCA`", and `<value2>` is a set of 2-character strings. e.g. `HitDefAttr = SC` should be `HitDefAttr = SC, NA, SA, HA`.

# Stage Changes in 1.0

M.U.G.E.N 1.0 is backwards compatible with stages from version 2002.04.14.

- Add the following parameters to the `[Info]` section:

    displayname = "..."         ;Name to display in select screen (replace ... with actual name)
    versiondate = 01,30,2010    ;Version date of stage (MM,DD,YYYY or X.XX) (replace with actual date)
    mugenversion = 1.0          ;Version of M.U.G.E.N this stage works on (1.0)
    author = "..."              ;Stage author name

- Add the following parameters to the `[Camera]` section and tune values accordingly (see Backgrounds documentation).

    overdrawhigh = 0
    overdrawlow = 0
    cuthigh = 35
    cutlow = 25

- In the `[StageInfo]` section, add the following:

    localcoord = 320, 240
    xscale = 1
    yscale = 1

- In the `[Music]` section, use `bgmvolume` instead of `bgvolume`. `bgmvolume` takes a parameter of `100` for 100%, `50` for 50% and so on. Details are in the "Music and Sound changes" section of this document.
- If the stage contains a `hires = 1` parameter, use `xscale = .5` and `yscale = .5` and remove the `hires = 1` line. Some other parameters may need to be tweaked.

# Motif Changes in 1.0

## system.def

- Add the following lines to the `[Info]` section of system.def.

    versiondate = 01,30,2010  ;Version date of motif (MM,DD,YYYY or X.XX) (replace with actual date)
    mugenversion = 1.0        ;Version of M.U.G.E.N this motif works on (1.0)
    localcoord = 320,240      ;Local coordinate space width and height

- Optionally, add `[Infobox]` and `[Infobox Text]` sections to customize the contents of the mode select screen F1 info box. See data/mugen1/system.def for an example.
- There are some "D4" (hi-res) motifs made for the 2002 version of MUGEN that require the `Doubleres = 4` parameter in mugen.cfg. Since 1.0 deprecated the Doubleres functionality in favor of coordinate spaces, you will need to update these motifs. A common issue is that the fonts are drawn too large. In fight.def and system.def, edit or add a scale parameter to all elements that are drawn too large. e.g. add `p1.name.scale = .5, .5` if there is no scale line; otherwise something like `p1.name.scale = .5, .5` becomes `p1.name.scale = .25, .25`.

## fight.def

- Add a `[FightFx]` section to fight.def. The size of fightfx.sff graphics can be adjusted with the `scale` parameter.

    [FightFx]
    scale = 1

# Sprite File Changes in 1.0

1.0 introduces SFF v2, which has a host of palette features as well as more compression options. Consider converting your sprite files to SFF v2 to take advantage of the new functionality.

# Music and Sound Changes in 1.0

Some changes to the music and sound system were made during the course of development of 1.0. The changes you will see, in a nutshell:

- Better MP3 and OGG support
- Extensible architecture (read: "M.U.G.E.N plugins")
- Loopstart and loopend support, for compatible plugins
- More intuitive volume settings: Master, wave/sfx, BGM
- Volume "offsets" replaced by volume scaling factors
- Various BGM bugfixes
- Improved sound quality

You MUST use the updated mugen.cfg included in order for BGM to work!

## Quick Audio FAQ

17. What kind of plugins does this support?

1. M.U.G.E.N only recognizes plugins specifically designed for it. So, for instance, Winamp plugins will not work. You can see the initial blog post for an idea of the kinds of problems involved with non-native plugins.

17. How do I make a plugin for my favorite file type?

1. Consult the plugin SDK.

17. How do I find loop points for my MP3s or OGGs?

1. To get a good result, you will need to open your file in an audio editor and identify the precise points where the music repeats itself. For further details, you may wish to consult loopguide.html in the docs/ directory. This is especially recommended if you are using MP3 files, as there are several tricky issues involved for MP3 in particular.

17. How do I set loop points for my other file types?

1. You can't, yet. Looppoint-compatible plugins haven't yet been made for the other file types.

17. The audio stutters/skips!

1. Try turning up the audio buffer size and/or turning down the mixer sample rate in mugen.cfg ([Sound] section). Also, turn off high-quality resampling if you have it enabled. If you still can't get it to work right, then please report the issue to us, along with your system specs. In your report, try to distinguish between dropouts (a short period of silence), skips (the music jumps ahead by a small amount), and stutters (the music repeats itself briefly).

   The new BGM system tries to keep track of its status. You can find some summary timing statistics for the mixer callback written to the end of mugen.log. You can also see if the system detected a decoder underrun by searching for lines saying "possible read starvation detected!" This information helps us troubleshoot the possible causes of sound corruption.

17. Why are there three Microsoft.VC90.CRT folders? Is this some kind of joke?

1. Those folders are an unfortunate consequence of the way Visual C runtimes are loaded, and are usually required for correct operation. However, there is a way to get rid of them. You need to download and install the Visual C++ 2008 SP1 redistributable package (x86). Once you have done this, the Microsoft.VC90.CRT folders can be safely deleted.

## Detailed change list

The following plugins are in the package. See the comments in mugen.cfg for optional parameters and usage.

- mpg123

  Supports MP3 playback using the libmpg123 decoder, which features several optimized decoding engines written in assembly. Supports looppoints, ReplayGain volume adjustment, and sample-accurate seeking. (Note: seeking will lose an unnoticeable amount of accuracy if the MP3 is at a sample rate different from the mixer sample rate.) mpg123 also fixes the "my MP3 plays slow/fast" problems.

- vorbisplug

  Provides Ogg Vorbis playback using libogg and libvorbisfile. Supports loop points, ReplayGain volume adjustment, and sample-accurate seeking. Uses M.U.G.E.N's built-in resampling service for rate conversion, where necessary. This should provide noticeably better output than the default SDL mixer playback.

- sdlmix

  Wrapper plugin for selected BGM services provided by SDL mixer. This means MIDI, MODs, and other tracker files.

  sdlmix performs seamless looping from the end to the beginning of BGM files (except for MOD/tracker files that naturally loop). However, arbitrary loopstart and loopend points cannot be specified.

The volume system has also been revamped. There is now a master volume setting, a voice/sfx volume setting, and a BGM volume setting. That's it. Volume settings are floating-point numbers between 0% and 100%, and multiply together to give the final output volume. Plugins may also have individual volume multipliers.

For sound effects, the product of all volume scales (master volume, wave volume, and any additional scaling factors in the case of CNS) cannot exceed 100%. If the product is too large, it is reduced to 100%. For plugins, the meaning of a volume scale exceeding 100% (after including plugin-specific volume scaling) is dependent on the particular plugin.

### mugen.cfg changes

- [Options] WavVolume and MidiVolume removed (they were redundant).
- [Sound] SampleRate and BufferSize parameters added. These control the mixer parameters. See the comments in mugen.cfg for more details.
- [Sound] ModVoices, MasterWavVolume, MidiVolume, MP3Volume, ModVolume, CDAVolume parameters removed.
- [Sound] SFXResampleMethod parameter added. This specifies how to perform rate conversion of sound effects. SDL method uses SDL's built-in conversion, which performs no interpolation. This is relatively fast, but gives poor quality results. The libresample method performs bandlimited interpolation, which is higher quality, but may slow down loading by a small amount, and requires more working memory. If using libresample, you can set SFXResampleQuality to 1 for even higher quality, at the cost of more resource usage.
- [Sound] BGMResampleQuality parameter added. This functions the same as SFXResampleQuality, but for music. Note that libresample is always used for rate conversion of music; SDL conversion is not supported.
- [Sound] MasterVolume, WavVolume, BGMVolume parameters used to control volumes. These can also be set in the Options screen.
- [Music] Music group added for plugin specification.
- [Misc] SFXBackgroundMode configures how sounds should be played in the background. Choose from Mute or Play.
- [Misc] BGMBackgroundMode configures how music should be played in the background. Choose from Mute, Pause, or Play.

### CNS changes

- [Data] "volume" parameter is now ignored. Use "volumescale" to specify a volume scaling factor in percent (100, i.e. no change, is the default).
- (PlaySnd) "volume" parameter is now ignored. Use "volumescale" to specify a volume scaling factor in percent.

### New stage parameters

- [Music] bgmvolume (replaces bgvolume)

  bgmvolume is a floating-point multiplier for this stage's volume. 100% is no change. The old parameter, "bgvolume", is deprecated and is ignored.

- [Music] bgmloopstart, bgmloopend

  Specifies the start and end points of the music to loop. If these are set and looping is on, then the music will play from beginning to loopend, then continue looping from loopstart to loopend indefinitely. The exact specification of these parameters is plugin-dependent. For mpg123, the loop points are specified in terms of samples. No other plugins support loop points at present. bgmloopstart defaults to 0 (beginning) and bgmloopend defaults to -1 (end of file).

### New system parameters

- [Music] {title, select, vs, victory}.bgm.loopstart (also loopend and volume)

- [Demo Mode] fight.stopbgm

  If fight.playbgm = 0, then setting fight.stopbgm = 0 allows the title BGM to continue playing during Demo mode.

### New storyboard parameters

- bgm.loopstart, bgm.loopend