RUGENDOCS
Creating content

Commands (.cmd)

How a .cmd file defines input commands - directions, buttons, the ~ / $ > + modifiers, time and buffer.time, [Defaults] - how the [Statedef -1] uses them, and how the CPU plays.

The .cmd file has two parts: a list of commands (named input sequences) and a [Statedef -1] that starts moves when a command is entered. The Command trigger connects them.

[Defaults]
command.time = 15
command.buffer.time = 1

[Command]
name = "QCF_x"
command = ~D, DF, F, x
time = 15

[Command]
name = "x"
command = x
time = 1

[Statedef -1]

[State -1, Fireball]
type = ChangeState
value = 1000
triggerall = Command = "QCF_x"
trigger1 = StateType != A && Ctrl

The [Command] block

KeyDefaultMeaning
namerequiredName used by Command = "name". Several blocks may share a name: any of them triggers it.
commandrequiredThe input sequence (see below).
timecommand.time (15)Ticks allowed from the first element to the last.
buffer.timecommand.buffer.time (1)Ticks the command stays “entered” after completion. Raise it (3 to 5) to make moves easier to buffer.

[Defaults] sets command.time and command.buffer.time for every command that does not set its own.

Command syntax

Elements are separated by commas and must happen in order.

SymbolMeaning
U D F BUp, down, forward, back (relative to facing)
UF UB DF DBDiagonals
a b c x y z sButtons (s is MUGEN’s start button; in rugen it is the s key, not START, see Controls)
~Release: ~x means “let go of x”. ~30x means “release x after holding it at least 30 ticks” (charge moves).
/Hold: /F means F must be held (not just pressed)
$Any direction that contains it: $D matches D, DF or DB
>Nothing else may be pressed between the previous element and this one
+Simultaneous: x+y both at once

Examples:

command = ~D, DF, F, x          ; quarter circle forward + x
command = ~F, D, DF, x          ; dragon punch motion
command = ~40$B, F, y           ; charge back 40 ticks, then forward + y
command = F, F                  ; dash (rugen requires two separate presses)
command = /F, x                 ; hold forward and press x
command = x+y                   ; two buttons at once
command = ~D, DB, B, >~D, DF, F, x+y  ; strict super motion

Directions are exclusive. A plain D is not matched while F is also held (that is DF). Use $D when you mean “down-ish”.

Repeated taps. For F, F, rugen requires the direction to be released between the presses, so holding forward does not count as a dash.

Using commands in [Statedef -1]

[Statedef -1] runs every tick while the player is in their own states. Each block usually is a ChangeState gated by a command and by Ctrl:

[State -1, Super]
type = ChangeState
value = 3000
triggerall = Command = "QCFx2_xy" && Power >= 1000
trigger1 = StateType = S && Ctrl
trigger2 = StateNo = [200, 299] && MoveContact   ; cancel a normal into the super
  • Order matters. The first ChangeState that fires wins, so list long motions (supers) before short ones (single buttons).
  • Cancels. Add trigger groups that allow the move from specific states after MoveContact / MoveHit.
  • Helpers read commands only when spawned with keyctrl = 1.

[Remap]

Old .cmd files may contain a [Remap] section mapping buttons to other buttons. rugen parses and ignores it; button mapping is done in OPTIONS / rugen.toml.

The CPU (AI)

M.U.G.E.N and rugen give computer players the same input stream as humans, so the AI is whatever your .cmd makes of random-ish inputs:

  • AILevel returns 0 for a human and 1 to 8 for the CPU (the difficulty).
  • rugen’s built-in CPU presses random directions and buttons, more often at higher levels. It does not pick moves for you.
  • For a real AI, add [State -1] blocks gated by AILevel > 0 that choose moves from the situation (distance, the opponent’s state), placed before the human blocks:
[State -1, AI anti-air]
type = ChangeState
value = 1100
triggerall = AILevel > 0 && Ctrl && StateType != A
trigger1 = P2StateType = A && P2BodyDist X < 60 && Random < 40 * AILevel

Keep AI blocks out of state -2 / -3 and away from engine-wide effects: the online fairness analysis looks at those states for every player.

Original reference: elecbyte.com/mugendocs-11b1.

Something wrong on this page? Edit it on GitHub.

SEARCH !!

    ↑↓ to move, Enter to open