YesNoOk
avatar

Details on StateDef & Special State Numbers & AIR format (CNS) (Read 7991 times)

Started by Just No Point, September 30, 2015, 04:03:46 pm
Share this topic:
Details on StateDef & Special State Numbers & AIR format (CNS)
#1  September 30, 2015, 04:03:46 pm
  • ******
    • www.justnopoint.com/
Every state must begin with exactly one StateDef group, also known as a Statedef section. A StateDef group must look like this (put in one or more parameters where the dots are):

[Statedef state_number]
. state_parameters
.
.
Replace state_number with the number of the state you are programming. With the exception of the special group numbers (see Appendix A) you are allowed to use any state number you choose. To avoid choosing a special group number, do not choose numbers from 0-199, and from 5000-5999.

; Example
[Statedef 718, Name Here]  ; Name Here is useful for quick searches in editing programs
;The lines that follow should include the following basic parameters:
type = S                ; SCA
movetype = U        ; AIHU
physics = S            ; SCANU
anim = 718            ;refers to the .Air file
;=====There are also additional optional parameters that may be included:=====
velset = const(velocity.walk.back.x), vel y ; checks the player's info and leaves the y velocity the same.
ctrl = 1                  ; CAN DOOOO!!!
poweradd = -40      ; reduces power
juggle = 5              ; Not used unless movetype becomes A
facep2 = 0             ; will allow your back to be turned
hitdefpersist = 0     ; drop all attacks
moveHitPersist = 1 ; Needed for MoveContact to remain true
hitcountpersist = 0 ; Start a new combo
sprpriority = -9      ; Stand behind everything

For better examples/definitions of each state parameter, click their corresponding link.
Last Edit: October 23, 2015, 05:01:36 am by Just No Point
Re: Details on StateDef (CNS)
#2  September 30, 2015, 04:06:38 pm
  • ****
  • Prince of Latis
  • Destroy the Core!
    • Canada
    • Skype - Whiplash-1
Should a list of common state numbers be posted here? I know it's impossible to enforce, and some characters don't follow them, but most characters tend to follow the same logic for their numbers.
Re: Details on StateDef (CNS)
#3  September 30, 2015, 04:08:30 pm
  • ******
    • www.justnopoint.com/
I believe anything that can be used to aid in community standards should be encouraged. It helps unify and makes more characters compatibility much more likely.
Special State Numbers (CNS)
#4  September 30, 2015, 04:36:18 pm
  • ****
  • Prince of Latis
  • Destroy the Core!
    • Canada
    • Skype - Whiplash-1
All right then. this is gonna be a long list.

These statedef numbers are used in the common file and should NOT be overwritten in the character's CNS unless you are modifying them to suit you character (but they MUST serve the same purpose).

0 - Stand
10 - Stand to crouch
11 - Crouching
12 - Crouch to stand
20 - Walk
40 - Jump start
45 - Air jump start
50 - Jump up
52 - Jump land
120 - Guard (start)
130 - Stand guard (guarding)
131 - Crouch guard (guarding)
132 - Air guard (guarding)
140 - Guard (end)
150 - Stand guard hit (shaking)
151 - Stand guard hit (knocked back)
152 - Crouch guard hit (shaking)
153 - Crouch guard hit (knocked back)
154 - Air guard hit (shaking)
155 - Air guard hit (knocked away)
5000 - Stand get-hit (shaking)
5001 - Stand get-hit (knocked back)
5010 - Crouch get-hit (shaking)
5011 - Crouch get-hit (knocked back)
5020 - Air get-hit (shaking)
5030 - Air get-hit (knocked away)
5035 - Air get-hit (transition)
5040 - Air get-hit (recovering in air, not falling)
5050 - Air get-hit (falling)
5070 - Tripped get-hit (shaking)
5071 - Tripped get-hit (knocked away)
5080 - Downed get-hit (shaking)
5081 - Downed get-hit (knocked back)
5100 - Downed get-hit (hit ground from fall)
5101 - Downed get-hit (bounce off ground)
5110 - Downed get-hit (lying down)
5120 - Downed get-hit (getting up)
5150 - Downed get-hit (lying defeated)
5200 - Air get-hit (fall recovery on ground; still falling)
5201 - Air get-hit (fall recovery on ground)
5210 - Air get-hit (fall recovery in air)
5500 - Continue screen animation
5900 - Initialize (at the start of the round)

These states are in the common file but should be overwritten as the ones in the common file will probably not suit your character. However, it should be noted that you should not change the numbers listed here:

100 - Run forward (or Dash Forwards)
105 - Hop backwards (or dash back wards)
106 - Hop backwards (land)
170 Lose (time over)
175 Draw game (time over)
180 -Win Pose Decider
190 - Intro Decider

Outside of states in the common file, there are no statedef standards, here are some common state def numbers and their use:

101 - Dash forward land
160  - Advancing guard Stand
161 - Advancing guard Crouching
162 - Advancing guard Air
181-189 - Win Poses
191-194,196-199 - Intros
195 - Taunt (s)
200 - Standing Light Punch (x)
210 - Standing Medium Punch (y)
220 - Standing Heavy Punch (z)
230 - Standing Light Kick (a)
240 - Standing medium Kick (b)
250 - Standing Heavy Kick (c)
400 - Crouching Light Punch (x)
410 - Crouching Medium Punch (y)
420 - Crouching Heavy Punch (z)
430 - Crouching Light Kick (a)
440 - Crouching medium Kick (b)
450 - Crouching Heavy Kick (c)
600 - Air Light Punch (x)
610 - Air Medium Punch (y)
620 - Air Heavy Punch (z)
630 - Air Light Kick (a)
640 - Air medium Kick (b)
650 - Air Heavy Kick (c)

800-999 are throws
Throws tend to be the 800 states, with a new basic (non-special/Command) Throw every 10 Numbers

1000-1999 are Specials.
Special moves tend to be the 1000 states, with a new special placed every 100 or 50 numbers.
example:
1000 - Hadouken (Special 1)
1100 -  SHoryuken (Special 2)
1200 - Tatsumaki Senpuu kyaku (Special 3)

3000-3999 are Hypers/ Supers
The same as specials, except with the 3000 state numbers.
example:
3000 - Shinkuu Hadouken (Hyper 1)
3100 -  Shin SHoryuken (Hyper 2)
3200 - Shinkuu Tatsumaki Senpuu kyaku (Hyper 3)

5300 - Dizzy state. this will most likely be a custom state you use. if you wish to put your character or your opponent's character into a dizzy state, this is the state number you should use.

See Also The Sprite Standard
Last Edit: April 27, 2016, 09:53:55 pm by -whiplash-
Re: Details on StateDef (CNS)
#5  September 30, 2015, 04:44:26 pm
  • ******
    • www.justnopoint.com/
For more custom animation community standards you should check out the Optional Animation Standards

Examples are
Electrocution, Midnight Bliss, etc
Last Edit: October 13, 2015, 08:04:05 pm by Odb718
Re: Details on StateDef (CNS)
#6  October 01, 2015, 10:02:28 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
The docs themselves give more of a split for the state numbers. The values you have are good, but as per normal they aren't set in stone and sometimes you need to use extras or interims.

200-399 are considered to be standing basic attack states
400-599 are considered to be crouching basic attack states
600-799 are considered to be aerial attack states
800-999 are considered throw states
1000-2999 are considered special attacks
3000-4999 are considered hypers

6000+ is helpers/FX/transformations/all sorts of stuff these are both animations AND states where you probably won't be checking on the opponent at all


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
AIR format
#7  October 22, 2015, 05:39:58 am
  • ******
    • www.justnopoint.com/

The AIR format and standard

Introduction

AIR is a format that describes a set of animations. You will see the AIR format used for animating characters, backgrounds, life bars and more.



An animation (specifically called an animation action in M.U.G.E.N) describes a single sequence of sprites to display. A character's animation file (.air) can contain as many animation actions as necessary.


 

The format

Here's a typical entry from an .air file. We will explain the format next.



; Standing Animation
[Begin Action 000]
Clsn2Default: 2
 Clsn2[0] = -10,  0, 10,-79
 Clsn2[1] =  -4,-92,  6,-79
0,1, 0,0, 7
0,2, 0,0, 7
0,3, 0,0, 7
0,4, 0,0, 50
0,5, 0,0, 7
0,6, 0,0, 7
0,7, 0,0, 7
0,8, 0,0, 60

Semicolon (;) is used for comments. They can be used anywhere and everything after the semicolon on the same line is ignored.



[Begin Action n] This defines an action. The number n is called the action number. Each action must have a unique action number in order to be distinguishable from other actions. You can have many actions, but keep in mind that there are reserved actions numbers. These numbers and their associated actions are listed below.


 

Clsn2Default: 2 This says that there are two collision boxes being defined and they will be defined for all the entries below the Clsn definition. In this case for every sprite in this action. If you don't want to have a default collision box, then change Clsn2Default to Clsn2. You must put the Clsn definition before a sprite entry. Each sprite entry can have its own collision boxes. Clsn2 refers to a plain collision box and Clsn1 refers to an "attacking" box. You use attacking boxes when making attacking actions such as punching and kicking or special moves. To define collision boxes, use AirEdit, a program included in the M.U.G.E.N development toolset.


 

0,3, 0,0, 7 An entry looking like this is called an "animation element", or just "element" for short. 1st number is the sprite's group number. 2nd number is the sprite's image number. You assign these numbers to your sprites when you make an .sff file.


 

So group #0 and image #3 were defined with sprmaker with an entry such as: work/mypic.pcx 0 (group number) 3 (image number) 40 X axis 40 Y axis



The 3rd and 4th numbers of the element are the X and Y offsets from this sprite's axis. If you want the sprite to appear 5 pixels forwards, put "5" for the 3rd number. To make the sprite 15 pixels up, put "-15" for the 4th number, and so on. In most cases, it is fine to keep the offset as 0,0.


 

5th number is the length of time to display the element before moving onto the next, measured in game-ticks. There are 60 game-ticks in one second at normal game speed. For the 5th number, you can specify "-1" if you want that element to be displayed indefinitely (or until you switch to a different action). If you choose to do this, do it only on the last element of the action.



The "looptime" of an action is the sum of all the times of each element. Basically, it is the total length of the action in game-ticks. If the last element has a time of "-1", the looptime will be considered infinite. We call that "no loop". Actions with a finite loop time will go back to the first element after it has finished displaying the last element, and keep looping until the you switch to another action.


 

In the example action above, the looptime would be: 7 + 7 + 7 + 50 + 7 + 7 + 7 + 60 = 152 ticks



; Standing Animation
[Begin Action 000]
Clsn2Default: 2
 Clsn2[0] = -10,  0, 10,-79
 Clsn2[1] =  -4,-92,  6,-79
0,1, 0,0, 7
0,2, 0,0, 7
Loopstart
0,3, 0,0, 7
0,4, 0,0, 50
0,5, 0,0, 7
0,6, 0,0, 7
0,7, 0,0, 7
0,8, 0,0, 60

Adding a line with the word "Loopstart" will make the animation begin looping from the element on the following line. In the example above, when the element with sprite 0,8 is displayed, the next element to be shown will be the one with sprite 0,3.



When testing out your animations, you may find the pause and frame-advance functions useful. To pause, hit the "Pause" button. To advance the game by one game-tick, press Scroll Lock. Frame- advance only works when the game is paused.



Optional paramters

Here's an entry: 15,1, 0,0, 5



If you want to flip the sprite horizontally and/or vertically, you will need to use the "flip" parameters: V for vertical flip, and H for horizontal flip. These parameters will be 6th on the line. For example:


 
15,1, 0,0, 5, H   ;<-- This flips it horizonally
15,2, 0,0, 5, V   ;<-- This flips it vertically
15,3, 0,0, 5, VH  ;<-- This flips it both ways, ie. rotates 180 deg

Flipping the sprite around is especially useful for making throws. The opponent who is being thrown will temporarily get the player's animation data, and enter the "being thrown" animation action. You'll might have to flip the sprites around to make the "thrown" action look correct.


 

For certain things such as hit sparks, you might like to use color addition to draw the sprite, making it look "transparent". You won't need to use this to make a character, so you don't have to worry about this if you choose not to. The parameters for color addition and subtraction are "A" and "S" respectively, and should go as the 7th on the line. For example:


 
15,4, 0,0, 5, ,A   ;<-- Color addition (flip parameter omitted)
15,4, 0,0, 5, H, S ;<-- Flips horizontally and does color subtraction

If you wish to specify alpha values for color addition, use the parameter format "AS???D???", where ??? represents the values of the source and destination alpha respectively. Values range from 0 (low) to 256 (high). For example, "AS64D192" stands for "Add Source_64 to Dest_192". Also, "AS256D256" is equivalent to just "A". A shorthand for "AS256D128" is "A1".





15,4, 0,0, 5, ,A1  ;<-- Color addition to 50% darkened dest
15,4, 0,0, 5, ,AS128D128 ;<-- Mix 50% source with 50% dest
Look to the next post below for some 1.1b+ optional parameters.

Character Reserved Action Numbers

M.U.G.E.N's common state engine (data/common1.cns) requires several animation actions to be present in your character (a warning will be logged if not all required animations are present). There are also some actions that are optional, which will be made use of if present in your character.


 

If you are unsure of how any of these actions should look, take a look at chars/kfm/kfm.air.



All action numbers in the 5000-5999 range not listed below are reserved for possible future use, so avoid using those numbers for custom actions.


 

An "opt" besides the number means the animation is optional.



Number Description Comments
0 Standing  
5 Stand turning Must have finite looptime
6 Crouch turning Must have finite looptime
10 Stand to crouch Finite looptime
11 Crouching  
12 Crouch to stand Finite looptime
20 Walking forwards  
21 Walking backwards  
40 Jump start (on ground) Shown just before player leaves ground
41 Jump neutral (upwards) Shown when player is going up
42 Jump forwards (upwards) Shown when player is going up-towards
43 Jump back (upwards) Shown when player is going up-back
44 opt Jump neutral (downwards) Activated when Y-velocity > -2
45 opt Jump fwd (downwards) Same as above
46 opt Jump back (downwards) Same as above
47 Jump landing Shown as player lands on ground
100 Run fwd/hop forward  
105 Hop back  
120 Start guarding (stand) Finite looptime
121 Start guarding (crouch) Finite looptime
122 Start guarding (air) Finite looptime
130 Guard (stand)  
131 Guard (crouch)  
132 Guard (air)  
140 Stop guarding (stand) Finite looptime
141 Stop guarding (crouch) Finite looptime
142 Stop guarding (air) Finite looptime
150 Guarding a hit (stand) Finite looptime
151 Guarding a hit (crouch) Finite looptime
152 Guarding a hit (air) No loop
170 opt Lose (See Note 1)
175 opt Time Over drawgame (See Note 1)
180 opt Win No loop (181-189 for multiple) (See Note 1)
190 opt Intro No loop (See Note 1)
195 opt Taunt Finite looptime (See Note 1)
5000 Stand/Air Hit high (light) Looptime around 10-20
5001 Stand/Air Hit high (medium) " (See Note 2)
5002 Stand/Air Hit high (hard) "
5005 Stand Recover high (light) No loop (See Note 3)
5006 Stand Recover high (medium) "
5007 Stand Recover high (hard) "
5010 Stand/Air Hit low (light) Looptime around 10-20
5011 Stand/Air Hit low (medium) "
5012 Stand/Air Hit low (hard) "
5015 Stand Recover low (light) No loop
5016 Stand Recover low (medium) "
5017 Stand Recover low (hard) "
5020 Crouch Hit (light) Looptime around 10-20
5021 Crouch Hit (medium) "
5022 Crouch Hit (hard) "
5025 Crouch Recover (light) No loop
5026 Crouch Recover (medium) "
5027 Crouch Recover (hard) "
5030 Stand/Air Hit back Looptime around 10-20
5035 opt Stand/Air Hit transition Looptime around 5-15 (See Note 3)
5040 Air Recover No loop
5050 Air Fall No loop
5060 opt Air Fall (coming down) No loop
5070 Tripped  
5080 LieDown Hit (stay down) (See Note 4)
5090 LieDown Hit (hit up into air)  
5100 Hitting ground from fall Looptime around 3
5160 Bounce into air  
5170 Hit ground from bounce Looptime around 3 or 4
5110 LieDown  
5120 Get up from LieDown  
5140 opt LieDead (first rounds)  
5150 opt LieDead (final round)  
5200 Fall-recovery near ground  
5210 Fall-recovery in mid-air  
5300 Dizzy  
5500 opt "Continue?" screen If omitted, plays dizzy anim
5510 opt "Yes" to "Continue" If omitted, plays first win anim (not yet implemented)
5520 opt "No" to "Continue" (not yet implemented)

Optional Hit Up animations (see Note 5):


 
Number Description Comments
5051 opt Air fall -- hit up  
5061 opt Coming down from hit up  
5081 opt LieDown Hit (stay down)  
5101 opt Bounce from ground into air Looptime around 3
5161 opt Bounce into air  
5171 opt Hit ground from bounce Looptime around 3 or 4
5111 opt LieDown  
5121 opt Get up from LieDown  
5151 opt LieDead (first rounds)  
5156 opt LieDead (final round)  

Optional Hit Up-Diagonal animations (see Note 6):


 
Number Description Comments
5052 opt Air fall -- hit up  
5062 opt Coming down from hit up  
5082 opt LieDown Hit (stay down)  
5102 opt Bounce from ground into air Looptime around 3
5162 opt Bounce into air  
5172 opt Hit ground from bounce Looptime around 3 or 4
5112 opt LieDown  
5122 opt Get up from LieDown  
5152 opt LieDead (first rounds)  
5157 opt LieDead (final round)  
Note 1: These do not actually have to use only the stated numbers. If is
more of a recommended number than a M.U.G.E.N one. If necessary, feel free to use any other action numbers.

Note 2: If medium and heavy hits are omitted, they default to the light hits



Note 3: "No loop" means last frame has a time of -1.
For recover animation, the first frame of each recovery should be the last frame of the corresponding hit. Eg. If action 5000 has frame 5000,0 and 5000,1, then action 5005 should start with frame 5000,1. This is because the animation will be locked in the first frame of the recovery after the hit animation is over, but before the player has recovered from the hit. If you have a Stand/Air Hit transition animation, then the first frame of Air Recover and Air Fall should be the last frame of the transition animation.
Note 4: The Stand/Air Hit transition animation is played back after each
hit animation in (or into) the air, but before the Air Recover and Air Fall animations.
Note 5: You can loop the LieDown Hit if you want the player to look like he
is "twitching" while being hit
Note 6: This set of animations is optional. It is an alternate set of
falling animations, which is used if hit by a HitDef with "Up" as the animtype.
Note 7: This set of animations is optional. It is an alternate set of
falling animations, which is used if hit by a HitDef with "DiagUp" as the animtype.
Last Edit: November 02, 2015, 04:28:44 am by Just No Point
Re: Details on StateDef & Special State Numbers & AIR format (CNS)
#8  October 23, 2015, 08:30:56 pm
  • ******
    • www.justnopoint.com/
Optional Parameters for 1.1b+ Only

To scale a sprite, use the 8th and 9th parameters for x-scale and y-scale respectively, e.g. this will scale the sprite by 1.5 and 2 respectively:

Code:
15,4, 0,0, 5, ,A, 1.5,2
To rotate a sprite about its axis, specify the angle in degrees in the 10th parameter:

Code:
15,4, 0,0, 5, ,A, 1,1, 45
Note: scale and angle parameters are not implemented in M.U.G.E.N versions prior to 1.1.

1.1b Exclusive Interpolation

Interpolation

Certain parameters can be interpolated from one element to the next. Parameters supported by interpolation are the offset, blending, scale and angle.

Interpolation is supported in M.U.G.E.N 1.1 and higher.

Currently only linear interpolation is supported.

The syntax is:

Interpolate <type>

where <type> is one of Offset, Blend, Scale or Angle.

Offset
Interpolates the offset.
Blend
Interpolates the transparency blend parameters. Both elements must have the same transparency function, i.e. A. To interpolate to or from a fully opaque element, use AS256D0.
Scale
Interpolates the scale.
Angle
Interpolates the angle.

One or more Interpolate lines can be inserted between two elements to enable interpolation between them. Interpolate lines before the first element will be used to interpolate from the last element to the first element in a looping animation.


The following example interpolates the offset between 0,0 and 100,0, and the scale between 1,1 and 1.5,1.5:
Code:
Interpolate Offset
Interpolate Scale
20,0, 0,0, 60, , , 1,1
Interpolate Offset
Interpolate Scale
20,0, 100,0, 60, , , 1.5,1.5

The following example animates a spinning object with a rotational period of 60 ticks:
Code:
20,0, 0,0, 59, , , 1,1, 0
Interpolate Angle
20,0, 0,0, 1, , , 1,1, 354

NOTE: Floating point values now accepted for offsets in 1.1b.
Last Edit: November 02, 2015, 04:58:22 am by Just No Point
Re: Details on StateDef & Special State Numbers & AIR format (CNS)
#9  November 02, 2015, 04:29:47 am
  • ******
    • www.justnopoint.com/
Had missed some 1.1b optional parameters

addaed
Re: Details on StateDef & Special State Numbers & AIR format (CNS)
#10  November 02, 2017, 11:17:27 pm
  • ******
    • www.justnopoint.com/
Note that in all versions of Fighter Factory 3 you cannot view sprites in the air editor with group numbers greater than 32767.