YesNoOk
avatar

"mugen code" parser (Read 1548 times)

Started by Bastard Mami, March 06, 2010, 05:56:42 am
Share this topic:
"mugen code" parser
#1  March 06, 2010, 05:56:42 am
  • ******
  • [E]
    • Mexico

  • Online
as a few guys here might know, I have been working on a mugen full game the past year(s), as less know I have been working on a small little app to make the game programming easier/faster. what it does is take a script very similar to mugen code, then takes self defined sctrls and blocks of code from user created files and substitutes them in a new script file. in the spoiler is the explanation as it is on the readme.

Spoiler, click to toggle visibilty
Re: "mugen code" parser
#2  March 10, 2010, 01:00:20 am
  • ******
  • [E]
    • Mexico

  • Online
Sorry, I konw my last post was horrible at explaining what the program does, itwas late at night for me and I was sleepy.

here is a statedef
Quote
;_________________________________________________ __

[Statedef #close_a]
parent   = vgm_statedef_normal

#vgm_initVelSet
#vgm_initChangeAnim

[State Idle ]
parent   = vgm_backToIdle
Trigger1    = !AnimelemTime(5)

[State esp]
parent   = vgm_soundNormal

[State Counter Hit Damage]
parent      = vgm_counterHitDamage
Value          = -1*(Floor(fvar(0)*(9.8*(random%1))+(random*.001)))
[State hit ]
parent       = vgm_hitdef_normal_weak
Trigger1    = !AnimelemTime(4)
Damage             = Floor((29+((random%1)*9.8))*fvar(0)), 0
SparkXY          = 0, -75
GuardFlag          = L

#vgm_endState

those are excerpt from the parents file
Quote
[Statedef 210]
identity   = vgm_statedef_normal
Type          = S
MoveType      = A
Physics       = S
Ctrl          = 0
PowerAdd       = 0
Juggle        = 10
FaceP2          = 1
HitDefPersist       = 0
MoveHitPersist       = 0
HitCountPersist    = 0
SprPriority       = 2


[State Counter Hit Damage]
identity   = vgm_counterHitDamage
Type       = TargetLifeAdd
Trigger1    = NumTarget
Trigger1    = var(15)&1
Value          = -1*(Floor(fvar(0)*(9.8*(random%1))+(random*.001)))
Kill          = var(12)
Absolute      = 0
Persistent      = 0


in the case of parents, if both teh parent and the child have teh same parameters, the child's parameteris used, as seen in the counter hit damage sctrl.

the constants can be simple values or full pieces of code.

Quote
define #close_a
210
define #far_a
310
define #crouch_a
410
define #air_a
610


define #vgm_endState

[State Return]
Type       = ChangeState
Trigger1    = AnimTime = 0
Value          = 0
Ctrl          = 1

I ahd not planned for the constantsto be full pieces of code, but as I talked about this on irc insanius suggested that and I found it to be a enat idea (and one of the reasons I share this info is because I might get similar good ideas that I had not tought of).
Re: "mugen code" parser
#3  March 10, 2010, 11:41:07 pm
  • avatar
  • ******
  • Complicated.cns
    • Argentina
I'll be honest, I only understood like 1/2 of all this but is this supposed to be something that lets you change stuff on a helper depending of the user config loaded? because it sounds quite cool
Re: "mugen code" parser
#4  March 11, 2010, 12:36:53 am
  • ***
  • +1 to whoever added Godzilla to the main index.
[E], you need a static website to put all of your stuff; seriously.
i think we should call it an "engine" so we don't look like total idiots because otherwise we'd be arguing about a "game" and that would be somehow "dumber" than arguing about an "engine" on the "internet" for countless hours

Iced said:
I for one, do not enjoy round corners!  :bigcry:
But they hurt much less when we accidentally hit them!  :S
Re: "mugen code" parser
#5  March 11, 2010, 12:52:43 am
  • ******
  • Limited time to use Infinite power !
    • France
    • network.mugenguild.com/cybaster/
I'll be honest, I only understood like 1/2 of all this but is this supposed to be something that lets you change stuff on a helper depending of the user config loaded? because it sounds quite cool
Basically, it allows you to code for Mugen using "real" coding syntax, or at least something easier to read and correct.

You can give names to your variables and constants, and they will refer to a number, as shown in :
Quote
define #close_a
210
Then, when you write "[Statedef #close_a]", it actually means statedef 210, except that it's much easier to read for you.

However, the best is the parent system. You surely noticed that when you're writing a HitDef for example, you keep copy-pasting the same stuff over and over again between each hitdef, only changing a few values. The parent system allows you to just write something like
Quote
parent   = vgm_statedef_normal
And when the program will convert back your code to mugen code, it will change this line by what you defined as vgm_statedef_normal. In short, you just write this line of code, and during the conversion to Mugen code, it will write (taking [E]'s example :
Quote
[Statedef 210]
identity   = vgm_statedef_normal
Type          = S
MoveType      = A
Physics       = S
Ctrl          = 0
PowerAdd       = 0
Juggle        = 10
FaceP2          = 1
HitDefPersist       = 0
MoveHitPersist       = 0
HitCountPersist    = 0
SprPriority       = 2



Anyway, this all looks very cool. This pointer/parent system is really very nice and well thought.

Is it possible to initialize variables as you would do for constants ? Would this be a valid syntax ?
Quote
define #custom_combo_var
var(17)
If not, it could be something nice.

Re: "mugen code" parser
#6  March 11, 2010, 01:04:32 am
  • ***
  • +1 to whoever added Godzilla to the main index.
Instead of calling it a parent system, maybe inheritance would be better and less easy to confuse with the players in mugen (p1 thru p4)
i think we should call it an "engine" so we don't look like total idiots because otherwise we'd be arguing about a "game" and that would be somehow "dumber" than arguing about an "engine" on the "internet" for countless hours

Iced said:
I for one, do not enjoy round corners!  :bigcry:
But they hurt much less when we accidentally hit them!  :S
Re: "mugen code" parser
#7  March 11, 2010, 04:49:48 am
  • ******
  • [E]
    • Mexico

  • Online

Is it possible to initialize variables as you would do for constants ? Would this be a valid syntax ?
Quote
define #custom_combo_var
var(17)
If not, it could be something nice.

yes , it is possible:


Quote
define #cancel_buffer
var(20)
define #cancel_ground_ctrl
32

from the cmd file:

Quote
[State -1]
Type       = ChangeState
Value          = #close_y
Triggerall    = command = "y" && (helper(200000),command != "holddown")
Triggerall    = #cancel_buffer&#cancel_close
Trigger1    = #cancel_buffer&#cancel_ground_ctrl
Trigger2    =  #cancel_buffer&#cancel_running

thanks for explaining it in better detail than I did. here is a beta of the program, it is likely to have undocumented bugs as I am still testing it while porting samus.
http://www.mediafire.com/download.php?2mdiynnynmy
the currently known bugs are that the program freezes if you use  a parent/constant that has not been defined.
Re: "mugen code" parser
#8  March 14, 2010, 05:52:37 am
  • avatar
  • ******
  • Complicated.cns
    • Argentina
Thanks Cybaster I totally got it now :D