News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Scripted Fighting

Started by M.Phantom, May 23, 2015, 11:48:59 AM

Previous topic - Next topic

M.Phantom

I need some guidance with this one idea...

Well, here we go: Is there any way to create scripted fights in M.U.G.E.N? Controlling the characters and the camera?
I did some research before posting and did not find a solid answer for that. But we do have characters intros, so I think there's the possibility.
I mean something like watch mode, that make full use of the fighting engine, but without the HUD and playing a previous writed script (A CNS script, perhaps?). Something like this:

QuoteI write to P1 walk forward enough for it to reach P2, and then use a light punch. That's it for the coding. When the punch animation plays, MUGEN would automatically detect the hitboxes and if it lands, change the P2 states to the appropriate animation for a light hit.

That's a very basic example. My aim is at more complex full animations, with total character and camera control (zoom, pan, shake).
Is it possible with MUGEN or some addon?

XGargoyle

You can do that via AI.

It will be a lot of work as you will have to redo all the AI moves so that they follow a script for both P1 and P2. Also, you will need a more than average mugen coding knowledge to achieve that, which based in your message it seems you are currently lacking.

There's no addon or downloadable script to do that, because each character is different and what can work for one character will break another.


XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!

M.Phantom

Thanks for the reply, XGargoyle. Reading a little bit about AI and using it for complete animations seems really a lot of work.
Anyway, thanks for pointing me in the right direction. :)

altoiddealer

I scripted this, so you should be able to script a fight heh

Spoiler (click to show)

If you are coding it down to exact hits, I just wanted to point out that it is possible to have total control over what occurs.

If you want it to be less predictable then you would have AI vs AI with modified code.  You can easily abolish the lifebars with an always active "AssertSpecial" controller.


M.Phantom

Wow, that was awesome! Thank you! Congratulations for your marriage, man! And for the animation too, it's awesome!

Yes, I want to code it down to the hits! It has to follow everything that's in the script, so it's 100% predictable. Like you did in your video or like in those sprite animations done in Flash/AfterFX. But those are paid (and very expensive) programs and it still requires a lot of work for an avarage animation.

So a possible way to get a excellent quality animation in all aspects (parallax background, accurate hits, sounds, camera control, etc) is coding it within MUGEN itself.

With this animation, you gave me a ray of light to follow and I could actually make something that worked!
Spoiler (click to show)
Quote;---------------------------------------------------------------------------
; TEST
[Statedef 6000]
type    = S
physics = S
sprpriority = 0
anim = 20

[State 6000, 1]
type = VelSet
trigger1 = PrevStateNo = 0
x = const(velocity.walk.fwd.x)

[State 6000, 2]
type = VarSet
trigger1 = StateNo = 6000
sysvar(1) = 1

[State 6000, 2]
type = ChangeState
trigger1 = floor(Pos X) = 5
value = 40

;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, 1]
type = ChangeState
trigger1 = Anim != 0 && Anim != 5
value = 6000

It's just a very, very simple script that makes the character walk forward and jump at Pos X 5. But it's a first step!!
I'll see if I can work out something more elaborate later and post it here. I still have to learn how to work with CNS... hehe

Again, thanks & congratulations, altoiddealer!

By the way, I was actually coding something in PHP/HTML/Javascript to use MUGEN characters and backgrounds to create animations (with AIR files animation, not States), would it be a good idea to make a thread about it here on MFG if I do continue the project?

altoiddealer

Glad you enjoyed!  We still haven't picked a date yet (it's been almost a year now, too lol)

Position and Time triggers will be your friend here.  You really won't even need CLSN boxes and HitDefs if you care to just make it look like there are hits.  You could just use LifeAdd, Envshake, VelSet, etc.


M.Phantom

Well, those things do take time, there's a lot of planning after all

I think the CLSN and HitDefs will play major roles in the animations to automate spark fx, hit sounds and hit animations, but sometimes I'll need to override them...

M.Phantom

Finally got around to play with it and it's done! (Well, part of it)... Would be nice to have some feedback... Here you go (Rendered at 60fps):



I spent almost all my free time for three days working on this. Some extra time to get a software to record and render the video at good quality. One minute of video took a lot of time and effort. People that code/sprite full characters deserve all love in the world!  :thumbsup:

Little explanation: I did this using several State -1 controllers checking some conditions & custom variables so then I could control the order of what was being triggered.  I created a few custom States and edited a lot of existing ones (For button holding and such), like coding AI. I didn't implement much camera control, but I did saw that it can be done with Explods and Helpers. Maybe I'll try that later...

To hide the HUD, I used an AssertSpecial controller that kept updating every tick. But it wasn't enough, at some points the HUD would flash in the screen for one tick, probably because of some state overriding my AssertSpecial. Then I went to MUGEN's fight.def and changed the position of everything there to out of screen coordinates. That did the trick, no more HUD flashing in the screen. Not the most elegant solution, but worked for this specific case.

My conclusion is that this isn't the easiest thing to do, but it was a lot of fun coding it and helped me to learn a bit more of how things work in MUGEN. But if the character isn't well commented and not documented, it can be a nightmare to get it done. If you know the character very well, you can get the custom states numbers in MUGEN debug or even get them in the cmd file. But having it commented is a lot better. Kudos to Team Z2! These characters are just insane and very well documented! Loved that!

I'll probably clean and comment the code explaning things better later and post it here. Maybe someone can learn from it or someone more experienced can point better ways to do it. For now I need some resttt  :sleeping:

XGargoyle



XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!

Iced


Balthazar

Very impressive how fast you managed to learn all about it, and the result is spectacular :D Congrats man,
can't wait to see more!

M.Phantom

Thanks for the feedback guys... Glad you liked it!!

Quote from: Balthazar on June 13, 2015, 02:28:02 PM
Very impressive how fast you managed to learn all about it, and the result is spectacular :D Congrats man,
can't wait to see more!

Thanks man, having some background in coding (mostly for web) and MUGEN being very well documented helped me a lot to put the pieces together. I'll work in a solid storyboard and make a complete version of this one next time. :thumbsup:

altoiddealer

Very nice work!  I was wondering if one day you would post the result of what you were working on