AgentSkillsCN

Character Architecture

在创建新角色、理解角色文件结构、配置角色常量(生命值、攻击力、防御力、移动速度),或在处理.def与.cns文件时使用此技能。涵盖角色定义文件、常量、尺寸参数、速度与运动物理特性。

SKILL.md
--- frontmatter
description: Use this skill when creating new characters, understanding character file structure, configuring character constants (life, attack, defense, movement), or working with .def and .cns files. Covers character definition files, constants, size parameters, velocity, and movement physics.

Character Architecture

Overview

An IKEMEN Go / MUGEN character consists of several interconnected files that define everything from appearance to behavior. Understanding this architecture is essential for creating characters from scratch.

Character File Set

Every character needs these files (minimum):

FileExtensionPurpose
Definition.defMaster file linking all others
Constants.cnsStats, physics, size, states
Commands.cmdInput detection + Statedef -1
Animation.airSprite animation sequences
Sprites.sffPacked sprite images
Sounds.sndSound effects (optional but expected)

The .def File

The .def file is the entry point. The engine reads this first to find all other files.

Required Sections

[Info] -- Character metadata

  • name: Internal identifier (used in code references)
  • displayname: Shown on screen in select/versus
  • versiondate: Creation/update date
  • mugenversion: Engine version (use 1.1 for IKEMEN Go)
  • author: Creator credit
  • pal.defaults: Default palette order (comma-separated 1-12)

[Files] -- Paths to character files (relative to character folder)

  • cmd: Command file path
  • cns: Constants/states file path
  • anim: Animation file path
  • sprite: Sprite file path
  • sound: Sound file path (optional)
  • stcommon: Common states file (usually common1.cns)
  • st1 through st99: Additional state files (for splitting states across files)
  • pal1 through pal12: Palette files (.act) -- only for SFF v1

[Arcade] -- Arcade mode storyboards

  • intro.storyboard: Pre-fight storyboard path
  • ending.storyboard: Post-arcade ending path

The .cns File Structure

The .cns file contains two major parts:

Part 1: Constants (Data sections)

These define the character's base properties:

  • [Data] -- Core stats (life, attack, defense, etc.)
  • [Size] -- Physical dimensions and collision bounds
  • [Velocity] -- Movement speeds (walk, run, jump)
  • [Movement] -- Physics (gravity, friction, air jumps)

Part 2: State Definitions

After the constants, the .cns contains state definitions (Statedefs) that define the character's behavior. Each state has:

  • A [Statedef N] header defining the state's properties
  • One or more [State N, Label] blocks with state controllers

Character Constants Deep Dive

[Data] Section

ini
life = 1000          ; Total hit points (standard: 1000)
attack = 100         ; Damage multiplier percentage
defence = 100        ; Defense multiplier percentage
fall.defence_up = 50 ; Extra defense while falling (%)
liedown.time = 60    ; Ticks spent lying on ground after knockdown
airjuggle = 15       ; Maximum juggle points
sparkno = 2          ; Default hit spark animation
guard.sparkno = 40   ; Default guard spark animation
KO.echo = 0          ; Echo on KO voice (0=off)
volume = 0           ; Sound volume offset
IntPersistIndex = 60 ; First non-persistent int variable index
FloatPersistIndex = 40 ; First non-persistent float variable index

[Size] Section

ini
xscale = 1           ; Horizontal display scale
yscale = 1           ; Vertical display scale
ground.back = 15     ; Standing push box back edge
ground.front = 16    ; Standing push box front edge
air.back = 12        ; Airborne push box back edge
air.front = 12       ; Airborne push box front edge
height = 60          ; Height for opponent jump-over detection
attack.dist = 160    ; Default attack detection range
proj.attack.dist = 90 ; Projectile attack range
proj.doscale = 0     ; Scale projectiles with character (0=no)
head.pos = -5, -90   ; Head position (camera/targeting)
mid.pos = -5, -60    ; Mid body position (targeting)
shadowoffset = 0     ; Shadow Y offset
draw.offset = 0, 0   ; Display offset

[Velocity] Section

ini
walk.fwd = 2.4           ; Forward walk speed
walk.back = -2.2         ; Backward walk speed (negative)
run.fwd = 4.6, 0         ; Forward run (x, y velocity)
run.back = -4.5, -3.8    ; Back dash (x, y - hops backward)
jump.neu = 0, -8.4       ; Neutral jump (x, y)
jump.back = -2.55        ; Back jump X velocity
jump.fwd = 2.5           ; Forward jump X velocity
runjump.back = -2.55, -8.1  ; Running back jump
runjump.fwd = 4.0, -8.1     ; Running forward jump
airjump.neu = 0, -8.1       ; Air jump neutral
airjump.back = -2.55        ; Air jump backward X
airjump.fwd = 2.5           ; Air jump forward X

[Movement] Section

ini
airjump.num = 1       ; Number of air jumps allowed
airjump.height = 35   ; Minimum height for air jump
yaccel = .44          ; Gravity acceleration per tick
stand.friction = .85  ; Ground friction while standing
crouch.friction = .82 ; Ground friction while crouching

Character Archetypes

ArchetypeLifeAttackDefenseWalkRunJump
Balanced (Shoto)10001001002.44.6-8.4
Grappler1100110901.83.8-7.8
Rushdown900105952.85.2-8.8
Zoner950951002.04.2-8.0
Glass Cannon800120852.65.0-8.6
Boss1400115802.44.6-8.4

State Numbering Convention

RangePurpose
-3Intro state (before round starts)
-2First tick initialization
-1Command detection (in .cmd file)
0Standing idle
10Standing turn
11Crouching turn
12Stand-to-crouch transition
20Walking
40Jump startup
45Airborne jump (going up)
50Jump landing
51Running forward
52Running back (hop back)
100Run forward
105Run back
110Taunt
120Guard start (standing)
130Guard start (crouching)
131Guard start (airborne)
140Guard hit (standing)
150Guard hit (crouching)
152Guard hit (air)
155Guard end
170Lose by time over
175Draw by time over
180Pre-intro (before round text)
190Win pose
191Win pose (teammate KO'd in team)
200-299Standing normal attacks
300-399Standing special normals
400-499Crouching attacks
600-699Air attacks
700-799Additional attacks
800-899Throw states
1000-1999Special moves
2000-2999EX/Enhanced specials
3000-3999Super moves
4000-4999Ultra/cinematic supers
5000-5099Ground hit states (common)
5100-5199Air hit states (common)
5200-5299Knockdown states (common)
5300-5399Get-up states
5400-5499Dizzy states
5900-5999Continue/death states

Key Relationships Between Files

How Files Reference Each Other

code
.def (master)
  |-- .cmd (commands + Statedef -1)
  |-- .cns (constants + character states)
  |-- .air (animation data)
  |-- .sff (sprite images)
  |-- .snd (sound effects)
  |-- common1.cns (shared engine states)
  |-- st1.cns ... st99.cns (extra state files)
  |-- pal1.act ... pal12.act (palette files, SFF v1 only)

Cross-File Dependencies

  • States reference animations: Every ChangeAnim controller uses action numbers from the .air file
  • States reference sounds: PlaySnd controllers reference sound groups/indices from the .snd file
  • Commands trigger states: Command definitions in .cmd bind input sequences to ChangeState calls in Statedef -1
  • HitDefs reference sparks: sparkno in HitDef controllers references animation actions (from the character .air or the fight effects .air)
  • Constants affect states: Physics values in [Velocity] and [Movement] are used automatically by state types (e.g., a state with physics = S uses stand.friction)

File Loading Order

  1. Engine reads .def to discover all file paths
  2. .sff sprites are loaded into memory
  3. .air animation sequences are parsed
  4. .snd sounds are loaded
  5. .cns constants are read and applied
  6. .cmd commands are parsed
  7. Common states (common1.cns) are loaded
  8. Additional state files (st1-st99) are loaded in order
  9. Palettes are applied

Common Mistakes

  1. Forgetting stcommon: Without stcommon = common1.cns, the character has no default behavior (no walking, jumping, getting hit, etc.)
  2. Wrong file paths: All paths in .def are relative to the character folder. Use forward slashes even on Windows.
  3. Missing animations: Referencing an animation action in a state that does not exist in the .air file causes the character to become invisible or crash.
  4. Mismatched group numbers: Sound PlaySnd calls must match actual groups in the .snd file.
  5. No Statedef -1 in .cmd: Without the command processing state, no inputs work.
  6. Persist values too low: Setting IntPersistIndex or FloatPersistIndex too low means variables get reset between rounds unexpectedly.
  7. Wrong mugenversion: Using mugenversion = winmugen disables features available in 1.0 and 1.1.