Minun
Posts : 142 Join date : 2015-03-08
| Subject: An AI method I recently discovered - More responsive AI July 28th 2015, 4:41 pm | |
| The usual Winane CPU method is pretty bad and weak alone. But it's really great when you combine Combo Condition checker, Kamek's HomeTeam AI, Latroy6's method, and my own made up which is basically Latroy6's only simpler. The first thing to do is add this (Credit to L6) - Code:
-
;-| AI |-------------------------------------------------------------------- [Command] name = "cpu1" command = U,D,U,F time = 1
[Command] name = "cpu2" command = D,U,D,F time = 1
[Command] name = "cpu3" command = U,D,D,F time = 1
[Command] name = "cpu4" command = U,D,U,F time = 1
[Command] name = "cpu0a" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,x,x,x,x,x time = 1
[Command] name = "cpu05" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,y,y,y,x,x time = 1
[Command] name = "cpu06" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,z,z,z,x,x time = 1
[Command] name = "cpu07" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,a,a,a,x,x time = 1
[Command] name = "cpu08" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,b,b,b,x,x time = 1
[Command] name = "cpu01" command = U,D,U,F,a+s time = 1
[Command] name = "cpu02" command = D,U,D,F,a+s time = 1
[Command] name = "cpu03" command = U,D,D,F,a+s time = 1
[Command] name = "cpu04" command = U,D,U,F,a+s time = 1
[Command] name = "cpu5" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,y,y,y,x,x,a+s time = 1
[Command] name = "cpu6" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,z,z,z,x,x,a+s time = 1
[Command] name = "cpu7" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,a,a,a,x,x,a+s time = 1
[Command] name = "cpu8" command = ~U+a+b+c+x+y+z+s,DF, F, D,DF, F,b,b,b,x,x,a+s time = 1 And then the AI activation trigger - Code:
-
[State -1, AI Activation] type = varset triggerall = RoundState != 9 trigger1 = command = "cpu1" trigger2 = command = "cpu2" trigger3 = command = "cpu3" trigger4 = command = "cpu4" trigger5 = command = "cpu05" trigger6 = command = "cpu06" trigger7 = command = "cpu07" trigger8 = command = "cpu08" trigger9 = command = "cpu01" trigger10 = command = "cpu02" trigger11 = command = "cpu03" trigger12 = command = "cpu04" trigger13 = command = "cpu5" trigger14 = command = "cpu6" trigger15 = command = "cpu7" trigger16 = command = "cpu8" trigger17 = command = "cpu0a" v = 59 value = 1
value = 0 [State -1, Combo condition Reset] type = VarSet value = 100 trigger1 = 1 var(1) = 0 ;Combo condition Check [State -1, Combo condition Check] type = VarSet value = 100 trigger1 = statetype != A trigger1 = ctrl trigger2 = (stateno = [200,299]) || (stateno = [400,499]) trigger2 = stateno != 420 ;Insert sweep attack here. The edit I am currently doing has Stateno 420 as it's sweep attack. trigger2 = movecontact var(1) = 1 This helps the AI to notice the special or super moves. This is how the common Winane AI method comes along. I see people randomly input triggers or repeat single buttons over and over again. It does make them recognize special moves, but slightly. It also makes the AI sometimes randomly dance in the middle of the stage. Kamek's Hometeam AI method and the Combo Condition method also makes the AI a little more responsive. Add if you want. Now that the Engine will tell the AI to listen to EXACTLY what you command it to do instead of doing it's own thing, it's time to make an AI changestate version of the Player commands. Make a triggerall for !win and !lose and as usual, var (59) = 1 or just var (59). For example (Credit to Latroy6) - Code:
-
[State -1, ThunderAI] type = ChangeState value = 901 triggerall = var (59) triggerall = !lose triggerall = !win triggerall = P2BodyDist X >= 100 trigger1 = statetype = s trigger1 = ctrl trigger1 = random <= 10 trigger1 = life >= 750 This is telling the AI to trigger when you didn't win or lose (Basically means AT ALL COSTS... But the AI doesn't ALWAYS remember to do it at all costs. It slowly reverts to it's usual "I'm not doing what you want me to do" state and then all of the sudden back to it's listening state once it comes back to 100 distance between P2.) In order to prevent them from doing it all the time is to add a random trigger (Trigger# or Triggerall depending on how you want them to activate moves.) so they won't spam it too much for less cheap AI But that doesn't make them responsive enough to the point where they're gonna be the champion of your roster of a thousand Mario, Ronald Mcdonald and KFM edits, POTS wannabes, and your MLP characters that think they're from Megaman. That is where CNS chimes in. In your CNS, go to any of your moves, add a changestate for the AI (Var(59) = 1) that tells it, "Hey, I want you to do another punch or a special attack once you do this attack" which is simply movehit or Movecontact (I see no difference in these two. Help yourself) Remember to add a !movehit && var(59) = 1 changestate that reverts it to 0 for it to not repeat the attack over and over again and change ctrl from 0 to 1 while you are at it. Also make sure to make the player's changestate to have && var(59) != 1 or else you probably won't have any control over your attacks anymore. Example: - Code:
-
;--------------------------------------------------------------------------- ; Standing Light Punch ; CNS difficulty: easy [Statedef 200] type = S ;State-type: S-stand, C-crouch, A-air, L-liedown movetype= A ;Move-type: A-attack, I-idle, H-gethit physics = S ;Physics: S-stand, C-crouch, A-air juggle = 1 ;Number of air juggle points move takes ;Commonly-used controllers: velset = 0,0 ;Set velocity (x,y) (Def: no change) ctrl = 0 ;Set ctrl (Def: no change) anim = 200 ;Change animation (Def: no change) poweradd = 40 ;Power to add (Def: 0) sprpriority = 2 ;Set layering priority to 2 (in front) [State 0, VelAdd] type = VelAdd trigger1 = animelem = 1 x = 2 y = 0 ;ignorehitpause = ;persistent =
[State 200, 1] type = HitDef trigger1 = Time = 0 attr = S, NA ;Attribute: Standing, Normal Attack damage = 23, 10 ;Damage that move inflicts, guard damage animtype = Light ;Animation type: Light, Medium, Heavy, Back (def: Light) guardflag = MA ;Flags on how move is to be guarded against hitflag = MAF ;Flags of conditions that move can hit priority = 3, Hit ;Attack priority: 0 (least) to 7 (most), 4 default ;Hit/Miss/Dodge type (Def: Hit) pausetime = 5, 5 ;Time attacker pauses, time opponent shakes sparkno = 0 ;Spark anim no (Def: set above) sparkxy = -10, -76 ;X-offset for the "hit spark" rel. to p2, ;Y-offset for the spark rel. to p1 hitsound = S5000, 0 ;Sound to play on hit guardsound = 6, 0 ;Sound to play on guard ground.type = High ;Type: High, Low, Trip (def: Normal) ground.slidetime = 5 ;Time that the opponent slides back ground.hittime = 12 ;Time opponent is in hit state ground.velocity = -2 ;Velocity at which opponent is pushed airguard.velocity = -1.9,-.8 ;Guard velocity in air (def: (air.xvel*1.5, air.yvel/2)) air.type = High ;Type: High, Low, Trip (def: same as ground.type) air.velocity = 0,-1 ;X-velocity at which opponent is pushed, ;Y-velocity at which opponent is pushed air.hittime = 12 ;Time before opponent regains control in air
[State 0, PlaySnd] type = PlaySnd trigger1 = animelem = 1 value = S0,4 volume = 10000
[State 200, 5] type = ChangeState trigger1 = AnimTime = 0 value = 0 ctrl = 1
[State 200, 5] type = ChangeState trigger1 = movehit && var(59) = 1 value = The next move that the AI will do ctrl = 0
[State 200, 5] type = ChangeState trigger1 = !movehit && var(59) = 1 trigger1 =animtime = 0 value = 0 ctrl = 1
Go to your next state and add a changestate that tells the AI to combo into another attack, rinse, repeat until you have like 3 or 4 collections of combos (Recommended amount). You can also copy an attack, change it's ID and write an AI only changestate if you think of adding a combo that already has another move associated with the previous AI combo commands so there won't be any conflicts. Take this with a grain of salt. I only did this to an edit of a character and I haven't changed my own character, Littlepip to have this AI method though it would be pretty good because she was built as a camper. However, the edit who originally was unplayable and was IMPOSSIBLE to play with and even have battles with went from a beast defeating Mario, Pikachu (Lore wise, it's Ironic.), and most Ryus while stile maintaining the ability to play the character. Though... *sigh* DJHANNIBALROYCE's characters can still beat the crap out of it. His AIs are hard af. R.I.P Fightermaker 2K lol ffffffffffffffffffff44444444. | |
|
Minun
Posts : 142 Join date : 2015-03-08
| Subject: Re: An AI method I recently discovered - More responsive AI August 2nd 2015, 1:42 pm | |
| - borewood2013 wrote:
- Since I moved to MUGEN1.0 totally, I don't need to do that unofficial A.I. detection/activation in MUGEN any more:
- Code:
-
trigger999 = command = "cpu999" The MUGEN1.0 AILevel Trigger is 100000x more reliable!
Yes, some times you can add A.I. only ChangeState in any active states like StateDef 200. And it is good to add some Triggers to ensure the A.I. does its work during the right time: - Code:
-
[State 200, ChangeState] type = ChangeState triggerall = AIlevel != 0 triggerall = RoundState = 2 triggerall = NumEnemy != 0 triggerall = Alive = 1 ........ I say this because, before times, my MUGEN A.I. was acting weird when it was put in some state that gave A.I. the control when I didn't use those Triggers.........................
Also, I find it not a bad MUGEN idea (yet it might cause you more work...) to make A.I. only states. For example, make a [Statedef 20059] in contrast to [Statedef 200] just for A.I. only. Some state ending states like the landing state [Statedef 52] can be duplicated as [Statedef 52059] just for A.I. only and you can freely give your control decision to it.
There should be a lot more ways to do A.I. in MUGEN. I think it only benefits you more by trying to study other MUGEN creators'/authors' MUGEN A.I. code for some interesting MUGEN inspiration. I think this AI method can be really bad if you're trying to not make it spam so much... My edit on Weegeeisgoingtokillm's Pichu has this tendicy to spam different types of projectiles of and over again, and giving it a run state for the AI would only make it "slide" endlessly and NEVER, EVER stop and his characters tend to spam a whole lot. However, unlike his AI "methods", you can still play Pichu without the AI butting in to fight. | |
|