News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Adding pushback with normals/specials

Started by swagdeez, November 21, 2016, 12:11:24 AM

Previous topic - Next topic

swagdeez

Hey I'm a absolute noob at Mugen and was wondering if someone could help on how to add pushback to normals/specials.
I'm not too concerned about creating new content but rather modifying existing characters because I'm interested in game balance.
At the moment I'm just trying to alter this character Frank from Super Fighter.
His Normals and specials have no push back which means he can just spam normals.

Here is an example of the code below

;=========================================================================
; Standing Punch
;=========================================================================
[Statedef 200]
type = S
movetype = A
physics = S
ctrl = 0
facep2 = 1
velset = 0, 0
poweradd = 24 * 0
sprpriority = 1

[state 200, Set Position]
type = posset
trigger1 = !time
y = 0

[state 200, Change Animation]
type = changeanim
trigger1 = !time
value = 200

[state 200, Sound]
type = playsnd
trigger1 = !animelemtime(1)
value = 100, 0
volumescale = 100
channel = 1

[state 200, Attack Scope]
type = null
trigger1 = movetype = A
trigger1 = var(12) := 2 || var(13) := 56

[state 200, Hit]
type = hitdef
trigger1 = !var(3) && !var(4) && numenemy
trigger1 = !animelemtime(2)
ID = 1
attr = S, NA
damage = 8
fall.envshake.phase = 8 ; dizzy points
guardflag = M
hitflag = MAF
priority = 4, Hit
pausetime = 12, 12
guard.pausetime = 12, 12
hitsound = -1 + 0 * (var(1) := 0)
guardsound = -1 + 0 * (var(2) := 120)
sparkno = S10000 + 195 + 5 * teamside
guard.sparkno = S10000 + 195 + 5 * teamside
sparkxy = -enemy,const(size.ground.front), -64
animtype = hard
ground.type = high
air.animtype = back
air.type = high
ground.slidetime = 12
ground.hittime = 12
guard.slidetime = 12
guard.hittime = 12
air.hittime = 12
ground.velocity = const(size.xscale) * -7.8125
guard.velocity = const(size.xscale) * -7.8125
air.velocity = const(size.xscale) * -2.34375, -8.59375

ground.cornerpush.veloff = 0.0
guard.cornerpush.veloff = 0.0
yaccel = 0.5859375
getpower = 192, 192
givepower = 96, 96
fall = 0
air.fall = 0
fall.recover = 0
fall.animtype = back

[state 200, Idle]
type = statetypeset
trigger1 = animelemtime(3) >= 0
movetype = I
persistent = 0

[state 200, End State]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1

This is the default values on Franks CNS file. Whenever I try to alter the bolded values I notice that there is no change in terms of  how far the opponent gets pushed back.  In fact the opponent just stays in the exact same spot when hit.

Please let me know where I'm going wrong.

swagdeez

Here is Jaan another character from the game who has push back on all of his normals.

Which weird because the code looks identical.

I'm guessing I'm looking in the wrong place?

;=========================================================================
; Standing Punch
;=========================================================================
[Statedef 200]
type = S
movetype = A
physics = S
ctrl = 0
facep2 = 1
velset = 0, 0
poweradd = 24 * 0
sprpriority = 1

[state 200, Set Position]
type = posset
trigger1 = !time
y = 0

[state 200, Change Animation]
type = changeanim
trigger1 = !time
value = 200

[state 200, Shadow]
type = varset
trigger1 = 1
var(16) = -8 * (animelemtime(1) >= 0) + 4 * (animelemtime(3) >= 0)

[state 200, Sound]
type = playsnd
trigger1 = !animelemtime(1)
value = 100, 0
volumescale = 100
channel = 1

[state 200, Attack Scope]
type = null
trigger1 = movetype = A
trigger1 = var(12) := 6 || var(13) := 40

[state 200, Hit]
type = hitdef
trigger1 = !var(3) && !var(4) && numenemy
trigger1 = !animelemtime(2)
ID = 1
attr = S, NA
damage = 10
fall.envshake.phase = 10 ; dizzy points
guardflag = M
hitflag = MAF
priority = 4, Hit
pausetime = 12, 12
guard.pausetime = 12, 12
hitsound = -1 + 0 * (var(1) := 0)
guardsound = -1 + 0 * (var(2) := 120)
sparkno = S10000 + 195 + 5 * teamside
guard.sparkno = S10000 + 195 + 5 * teamside
sparkxy = -enemy,const(size.ground.front), -68
animtype = hard
ground.type = high
air.animtype = back
air.type = high
ground.slidetime = 12
ground.hittime = 12
guard.slidetime = 12
guard.hittime = 12
air.hittime = 12
ground.velocity = const(size.xscale) * -7.8125
guard.velocity = const(size.xscale) * -7.8125
air.velocity = const(size.xscale) * -2.34375, -8.59375
ground.cornerpush.veloff = 0.0
guard.cornerpush.veloff = 0.0
yaccel = 0.5859375
getpower = 192, 192
givepower = 96, 96
fall = 0
air.fall = 0
fall.recover = 0
fall.animtype = back

[state 200, Idle]
type = statetypeset
trigger1 = animelemtime(3) >= 0
movetype = I
persistent = 0

[state 200, End State]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1

Zzyzzyxx

You're setting the ground.cornerpush and guard.cornerpush of your attacks to 0.0 .

Either change them to a value similar to the ground.velocity of the respective attack, or give a read at this thread, at the start of the second post:

http://mugenguild.com/forum/topics/the-greatest-hits-character-feedback-99092.0.html

Most chars that have 0.0 cornerpush have special codes that ignore MUGEN's default cornerpush system and adopt a custom-made cornerpush code.

swagdeez

Forgive me if this is a noob question but:

Does the 0.0 cornerpush value have anything to do with normals/specials not having pushback mid screen?
I understand that by default the corner pushback might be different but in this case Frank (unlike Jaan) has no pushback on any of his normals or specials not just in the corner but ALSO midscreen.

Modifying anything of the following hasn't worked for me:

ground.slidetime
ground.hittime
guard.slidetime
guard.hittime
air.hittime
ground.velocity
guard.velocity
air.velocity

I did modify the ground.cornerpush and guard.cornerpush to same value as ground.velocity but it did not change anything - please let me know If I interpreted you incorrectly.
Jaan also has the 0.0 cornerpush values and his normals still have pushback mid-screen.
Sorry if this response is convoluted but I figured I'd give you as much detail as I could.
Also Thank you for that link it has some really useful tips that will help me out with what I'm doing!
Any tips are appreciated!




mr_bourrepalestick

#4
I'll presume you already checked the sctrl reference file in docs folder first.

ground.hittime --> equivalent to hitstun, won't effect the pushback distance. Forget about this one for the moment, it's out of pushback topic (but you'll have to define it precisely if your goal is game balance! good luck ;)  )

Now, before even we go further, some physics' theory. The pushback of a hit on a character is affected by a combination of

  • some hitdef attributes of the hitting move
  • some character's (the one that is being hit) constant values

Your intuition is good about ground & air & guard slidetime and velocity values. Those will be the ones you'll be playing with to make the move behave as you want (on hit --> ground. , on an aerial opponent --> air. , on guard --> guard. ).
And the cornerpush.veloff are indeed the values that will take precendence on a cornered opponent.

So in general :
.velocity = how many pixels per tick the character moves
.slidetime = how many ticks the movement lasts (n-ticks)
-->  pushback = velocity * slidetime

Keep in mind that those values can have a different impact due to characters' constant movement values (.cns file, [movement] section) : friction coeffs & thresholds.
If you play with those values, you can get a "sliding" character, or a very "heavy" one (that hard to push / that stops quicly from moving).
For instance, a "sliding" character will have (try playing with those :D but keep a record of your intial values)

  • "high" friction value (let's say 0.98)
  • "low" threshold value (let's say 0.01)

--> for each (i-tick) of slidetime, the engine generates a velocity value :   (i)velocity = velocity*friction**(i-1)
If (i-tick)velocity reaches the threshold or when slidetime expires--> velocity is considered to be (0)


My intuition says that if your character isn't pushed back away, there's something with friction and threshold values that can be tweaked. Keeping all parameters the same, but just changing [movement] stand.friction to a high value (let's say 0.98) and the threshold to 1, you should get a "sliding" character on the pushback.
BUT BEWARE , this constant will have impact on all movement stuff (walking, run, guard pushback etc.). So tweak it wisely.

Additionnaly, in your case, I noticed this :
ground.velocity = const(size.xscale) * -7.8125
The velocity here depends on the xscale factor (which is defined in the constants). I don't know if your character is too small / too big (aka localcoord values in characters [info] in .def file) and his constants need to be rescaled additionnally to automatical Mugen's engine scaling. Check the docs about localcoord in your doc folder for more info.
I would personnally get rid of this one , but let it be until you've experimented the hitdef and constant movement values .

- samurais, swords & stuff ? → Another Blade

swagdeez

Quote from: mr_bourrepalestick on November 21, 2016, 08:45:55 AM

  • "high" friction value (let's say 0.98)
  • "low" threshold value (let's say 0.01)

--> for each (i-tick) of slidetime, the engine generates a velocity value :   (i)velocity = velocity*friction**(i-1)
If (i-tick)velocity reaches the threshold or when slidetime expires--> velocity is considered to be (0)

My intuition says that if your character isn't pushed back away, there's something with friction and threshold values that can be tweaked. Keeping all parameters the same, but just changing [movement] stand.friction to a high value (let's say 0.98) and the threshold to 1, you should get a "sliding" character on the pushback.
BUT BEWARE , this constant will have impact on all movement stuff (walking, run, guard pushback etc.). So tweak it wisely.


I Tried entering those values but it didn't change anything in terms of pushback. Even went to the extreme of friction .98 and threshold 0.01 but didn't affect Frank sliding anyway.
I have to make the point that other characters dont get recieve or give pushback unless Jaan (the only one that works) attacks them. For some reason he is the only one who can pushback others with his normals.

Quote from: mr_bourrepalestick on November 21, 2016, 08:45:55 AM
Additionnaly, in your case, I noticed this :
ground.velocity = const(size.xscale) * -7.8125
The velocity here depends on the xscale factor (which is defined in the constants). I don't know if your character is too small / too big (aka localcoord values in characters [info] in .def file) and his constants need to be rescaled additionnally to automatical Mugen's engine scaling. Check the docs about localcoord in your doc folder for more info.
I would personnally get rid of this one , but let it be until you've experimented the hitdef and constant movement values .



Now when you say get rid of it do you mean just delete it or comment it out?
You've made me realise how much I really have to learn.
Must be kinda frustrating to help me troubleshoot this but I really appreciate your input.




mr_bourrepalestick

#6
Quote from: swagdeez on November 21, 2016, 10:59:33 AM
Now when you say get rid of it do you mean just delete it or comment it out?
You've made me realise how much I really have to learn.
Must be kinda frustrating to help me troubleshoot this but I really appreciate your input.

In this kind of cases, when you don't know and try troobleshooting, always comment it out first. In the best case, keep an "original" backup of your character, and just experiment things ! Have fun. Don't be afraid of the engine or something. Try things out ;)

Quote from: swagdeez on November 21, 2016, 10:59:33 AM
I Tried entering those values but it didn't change anything in terms of pushback. Even went to the extreme of friction .98 and threshold 0.01 but didn't affect Frank sliding anyway.
I have to make the point that other characters dont get recieve or give pushback unless Jaan (the only one that works) attacks them. For some reason he is the only one who can pushback others with his normals.

Now I understand things differently I must admit.
So Jaan's attacks are the only ones that pushback enemies ? Try with KFM attacking those characters.
If KFM does push'em back, than the issue comes from their attack hitdefs needing tweaks...

-------
EDIT :
Could you check and tell me , for Jaan and Frank respectively , what are the values for xscale and yscale, in their respective .CNS file under [size] section please.
[size]
xscale = ???
yscake = ???
- samurais, swords & stuff ? → Another Blade

swagdeez

When I play the Super Fighter full game. I added KFM to roster so I could fight him with Jaan.
I have realised the error of my ways.
Jaan and Frank pushback is fine when using the full game.
It is when I use characters from a different source (downloaded seperately) - Im sure theyre identical though they both even have same pallettes, frame data, custom command list etc. Sorry about that.
I cant test the characters from the full game in my custom mugen it keeps erroring.

However in my custom game with Frank or Jaan I get the same issue.

Frank/Jaan attacks KFM gets pushback.
If KFM attacks Frak/Jaan theres no pushback.
If Frank and Jaan attack eachother there is no pushback.

Pushback works fine even even against KFM (when I added him) in the full game.

I guess my reasoning behind having it in my own custom mugen was for to reasons.
1. Theres no training mode in the full game
2. I wanted to test things before applying them to the full game.

Here are the values I checked both from the full game and the seperate source where I downloaded the chars the values for Both Frank and Jaan are as below:

[Size]
xscale = 1.0
yscale = 1.0

mr_bourrepalestick

#8
Allright, it's starting to make some sense.
Everything is right with Frank and Jaan. It's not their hitdefs, nor friction values (though you can add those things in the "what did I learn today" list  :D

My next guess will be : common state files ! :)

You are meeting the troubles of trying to customize an already customized thing.
Here's the point.
All character behaviours (his state definitions) can be defined in separate .cns files.
Sometimes, if you have some state definitions which you want to be exactly the same for many characters, you can use a single .cns file where all those COMMON states are coded : a common state file. Obvious isn't it ? :)
So most of the time, when working on a fullgame, creators use this strategy for common state definitions, which simplifies many things in the process.

What I guess happens in your case, is that the characters you're tweaking have different (or rather customized) common state definitions.

How to know if that's the case ?
For each character (Frank and Jaan), check the [Files] section in character's .def file.
Make sure every file listed there is present in each character folder. 
Concerning the stcommon .cns file, make a copy of the one you've got from the source game in each character's folder.
It is possible that the different sources you have your characters from, have all named this common .cns file the same way (like common1.cns ... ) , but have actually different coding inside. Which is why you'll get the common.cns file from each different source to the respective characters.
By making a copy in each character folder, it takes precedence over the common.cns file in data/ or motif/ folders.

Does the pushback work now ?
- samurais, swords & stuff ? → Another Blade

Odb718

Like mr_bourrepalestick says you'll want to copy your common cns file into each character.
Then you should be able to add them into your custom mugen without them erroring out. If you can, post what error pops up in your custom mugen.
Make sure you look inside your character's def file and see what it's actually using. You may need to list the newly copied common.cns in the def also.

My guess is you have a rotten 5000ish state that's looking for a value that gets changed too fast. it could also be a velset something like
[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6
vVv Gouken718 vVv SabreTooth718 vVv


swagdeez

Hi Guys thank you for  the responses!
So instead of copying just the Cns files I pasted the entire character in the directory.
Initially it didn't work I got the following error:

Error detected.

Can't find file superfighter.stError loading chars/Frank/Frank.def
Error loading p1

So I found the superfighter.st added it in and it works now.
I get the feeling that the code in this superfighter.st file is determining the pushback values.
I can't say for sure as I'm not fluent in Mugen programming language :).
Although I don't know the exact reason why this is working guess it's on me to figure out why.
Once again thank you for the help!



Odb718

Make a backup of your file that has your 5000->5999 states. Those are probably causing you some problems. Try to find the set up that allows pushback all the time and copy those 5000 to 5999 states into your file. See if the other setups that dont work, will work.
vVv Gouken718 vVv SabreTooth718 vVv


mr_bourrepalestick

Quote from: swagdeez on November 22, 2016, 05:19:24 AM
[...]
So I found the superfighter.st added it in and it works now.
I get the feeling that the code in this superfighter.st file is determining the pushback values.
I can't say for sure as I'm not fluent in Mugen programming language :).
Although I don't know the exact reason why this is working guess it's on me to figure out why.
[...]

Just don't think too much about "not knowing stuff". It's mostly common sense in Mugen. Don't be afraid of digging into it, and always keep a "safe initial version". :)

That being said, what you're doing now is helping you to get a big picture of a characters' architecture / behaviour :
Where (in which file, in which folder) are defined each states ? Why did the author organize it this way ? Are there hints which could help you figure out those things in future ? The answers are rarely hidden, it's just common sense.

Glad to hear pushback is working !
Quote from: Odb718 on November 22, 2016, 08:37:57 AM
Make a backup of your file that has your 5000->5999 states. Those are probably causing you some problems. Try to find the set up that allows pushback all the time and copy those 5000 to 5999 states into your file. See if the other setups that dont work, will work.
+1 . I'll just back this up :)
- samurais, swords & stuff ? → Another Blade

swagdeez

Hey guys just wanted to thanks again for your help! I'll l into all of this now that I have some spare time lifes been keeping me busy lately. I might keep this thread unresolved in the meantime until actually solve the issue. I might have some questions in the future about this :)