Tutorial: your first character
Start from Kung Fu Man, rename him into your own fighter, change his constants, add a new special move with an animation, a state and a command, then check, test and verify him in rugen.
The fastest way to learn the formats is to take a working character and change it. This tutorial starts from Kung Fu Man (KFM), Elecbyte’s sample character, and turns him into a new fighter with a new special move.
You need: rugen, a text editor, and KFM from a M.U.G.E.N 1.1 download (the
chars/kfm/ folder).
1. Copy and rename
- Copy
chars/kfm/from M.U.G.E.N into rugen’schars/aschars/Ryuji/. - Rename
kfm.deftoRyuji.def. (The other files may keep their names.) - Edit the
[Info]section ofRyuji.def:
[Info]
name = "Ryuji"
displayname = "Ryuji"
author = "You"
mugenversion = 1.0
localcoord = 320, 240
Leave [Files] pointing at kfm.cmd, kfm.cns, kfm.sff and so on. The
ai = kfm.ai line is ignored, as in M.U.G.E.N.
2. Check it loads
rugen check Ryuji
Ryuji by You — 230 states, 400 sprites, loaded in 40ms
1800 controllers, 0 unsupported kinds:
0 warnings:
(Your counts and timing will differ.)
A clean report means every controller is supported and every file parsed.
If you see warnings, they come with file:line; see
Debugging.
3. Fight with it
rugen play Ryuji kfm --stage training
Turn on the overlays while you play:
- F2 shows the collision boxes (red Clsn1 hits, blue Clsn2 can be hit).
- F3 shows state number, state time, anim / element, position, velocity, life, power and the last inputs for both players.
- Space freezes the match, . steps one frame.
For a sparring partner that does nothing, start Training from the title screen instead.
4. Change the constants
Open kfm.cns and find the constant sections at the top. Make Ryuji
tougher and faster:
[Data]
life = 1100
attack = 105
[Velocity]
walk.fwd = 2.8
run.fwd = 5.2, 0
jump.neu = 0, -9
Save the file. If the match from step 3 is still running, Ryuji reloads with
the new values within about a second; otherwise run rugen play again.
5. Add a new move
A special move needs four things: an animation (.air), a state
(.cns), a command (.cmd) and an entry in [Statedef -1] that
connects them. We will add a lunging palm: back, forward, punch.
The animation
Append to kfm.air. It reuses KFM’s light punch sprites, slides them
forward, and gives the hitting frame a longer attack box:
; Lunge palm
[Begin Action 1500]
Clsn2Default: 2
Clsn2[0] = -10, 0, 19, -80
Clsn2[1] = 0, -94, 12, -80
200,0, 0,0, 4
200,1, 6,0, 3
Clsn1: 1
Clsn1[0] = 20, -82, 72, -68
200,2, 12,0, 6
200,1, 6,0, 5
200,0, 0,0, 6
Look at it before writing any code:
rugen view chars/Ryuji/Ryuji.def 1500
Press B to toggle boxes, Space and . to step.
The state
Append to kfm.cns:
[Statedef 1500]
type = S
movetype = A
physics = S
anim = 1500
ctrl = 0
velset = 0, 0
poweradd = 40
juggle = 3
sprpriority = 2
[State 1500, lunge]
type = VelSet
trigger1 = AnimElem = 2
x = 5
[State 1500, brake]
type = VelMul
trigger1 = AnimElem = 4, >= 0
x = 0.6
[State 1500, palm]
type = HitDef
trigger1 = AnimElem = 3
attr = S, SA
damage = 70, 8
animtype = Hard
guardflag = MA
hitflag = MAF
pausetime = 12, 14
sparkxy = -10, -76
hitsound = 5, 2
guardsound = 6, 0
ground.type = High
ground.slidetime = 12
ground.hittime = 16
ground.velocity = -7
air.velocity = -3, -4
air.fall = 1
[State 1500, swing sound]
type = PlaySnd
trigger1 = AnimElem = 2
value = 0, 1
[State 1500, done]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
The command
Add to the command list at the top of kfm.cmd (before [Statedef -1]):
[Command]
name = "lunge"
command = ~B, F, x
time = 12
buffer.time = 3
The entry
In kfm.cmd, inside [Statedef -1], add this above the plain punch
entries (the first matching ChangeState wins, so longer motions go first):
[State -1, Lunge palm]
type = ChangeState
value = 1500
triggerall = Command = "lunge"
trigger1 = StateType = S && Ctrl
trigger2 = StateNo = 200 && MoveContact ; cancel from the light punch
Restart the match and try back, forward, x. If nothing happens, press F3: the input history shows what rugen read, and the state number shows whether 1500 was entered.
6. Make a screenshot
--frames and --shot capture a frame without touching the keyboard, which
is handy for checking poses or sharing progress:
rugen play Ryuji kfm --stage training --frames 240 --shot ryuji.png
7. Verify
rugen verify Ryuji
This is the same check every player’s machine runs before Ryuji can be
picked: it loads him, inspects him for unsupported controllers and missing
sprites, and plays two 3000-frame headless matches (a random-input mirror
match, and one against KFM). You want verified. A warn lists what to
fix; broken means players cannot pick him at all.
8. Ship it
- Zip the folder so the zip contains
Ryuji/Ryuji.defand the rest. Players drop the zip intochars/as is. - Add
rugen_art.png(or.webp) next to the.deffor a large render on rugen’s select screen. - Rename the files (
kfm.cns→Ryuji.cns…) and update[Files]when you are ready; it avoids confusion with the original. - Keep the credits: KFM’s art is Elecbyte’s. Replace the sprites before calling the character your own.
Next: Your first stage, or dig into the controller and trigger references.
Something wrong on this page? Edit it on GitHub.