YesNoOk
avatar

Gombie AI problem (Read 1102 times)

Started by Carmell, January 14, 2020, 03:04:42 AM
Share this topic:
Gombie AI problem
#1  January 14, 2020, 03:04:42 AM
  • **
    • USA
Okay, so now that I've released the new version of Gombie, I've noticed a new problem the remake has but the old version didnt have.

Remake Gombie's AI never seems to use the Heat or Hardy strikers. At least Ive never seen him do so during plenty of tests. The only thing I can think of that's definitely different isI changed the resolution and I suspect that undid some of the AI conditions required for the comp to call out those 2 strikers. I really have no idea where to look for the AI variables though. the only AI thing I see in the code seems to be completely unrelated.

All I really want is for them to be turned back on without gutting the existing AI code. Any help is appreciated.
Re: Gombie AI problem
#2  January 14, 2020, 07:35:44 AM
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
We'd need to see the code that brings them out in the first place. Right now you have done the equivalent of pointing at an invisible object and asked what colour it is.


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.
Re: Gombie AI problem
#3  January 16, 2020, 08:09:25 AM
  • **
    • USA
Sorry about that. Part of the problem was that I didnt know where the relevant code in the .cns was to begin with.

Okay I'll try my best here.

;--------------------------------------------------------------------
;Hardy Summon
;--------------------------------------------------------------------
[statedef 17100]
anim = 9001
type = S
movetype = A
physics = S
ctrl = 0

[State 17100, 1]
type = PlaySnd
trigger1 = Time = 1
value = S910, 1

[State 0, SuperPause]
type = SuperPause
trigger1 = time = 0
time = 30
anim = -1
darken = 1
p2defmul = 0
poweradd = -3000
unhittable = 1
;endcmdbuftime = (winmugen only)
;pausebg =  (winmugen only)
;ignorehitpause =
;persistent =


[State 17100]
type = Helper
trigger1 = animelem = 2
name = "hardy"
ID = 17101
stateno = 17101
helpertype = normal
keyctrl = 0
ignorehitpause = 1
postype = back
pos = -100,-250

[state 17100]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

;-------------------------------------------------------------
;Heat Summon
;---------------------------------------------------------------
[statedef 18100]
anim = 9002
type = S
movetype = A
physics = S
ctrl = 0

[State 18100, 1]
type = PlaySnd
trigger1 = Time = 1
value = S910, 2

[State 0, SuperPause]
type = SuperPause
trigger1 = time = 0
time = 30
anim = -1
darken = 1
p2defmul = 0
poweradd = -3000
unhittable = 1
;endcmdbuftime = (winmugen only)
;pausebg =  (winmugen only)
;ignorehitpause =
;persistent =


[State 18100]
type = Helper
trigger1 = animelem = 2
name = "heat"
ID = 18101
stateno = 18101
helpertype = normal
keyctrl = 0
ignorehitpause = 1
postype = back
pos = -100,-300

[state 17100]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1





Okay, so those are the 2 Striker Summons. I dont see any AI coding on them but maybe I just dont know what to look for. Im pretty sure POTS coded AI that made it so they only were summoned under certain conditions, but I cant find it.

Re: Gombie AI problem
#4  January 18, 2020, 10:57:55 AM
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Most of the time ai is in state -1 or state -2. Check the command file first. Thats the more usual place.


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.
Re: Gombie AI problem
#5  January 18, 2020, 03:18:17 PM
  • **
    • USA
Okay you were right. It was in the cmd file. It didnt even occur to me to look there. I've identified the problematic code.

[State -1, Hardy]
type = ChangeState
value = 17100
triggerall = numhelper(17101) = 0
triggerall = var(59)>=1 && numenemy
triggerall = statetype!=A
triggerall = power>=3000
trigger1= ctrl
trigger1= (p2dist x=[-25,100]) && random<25


this line in particular

trigger1= (p2dist x=[-25,100]) && random<25

And I did some tinkering and research and now Im not sure it was ever right to begin with.
What I really wanted was this move to only go off when p2 was around the the back edge to middle of the screen, but it looks like it was always based on distance from Gombie himself and not the back wall.

I looked up "p2bodydist" and "p2dist" trigger reference and both seem to rely on P1's position. "Pos" doesnt seem to be what I want either but I could be wrong about that.

also that random < 25, can you tell me the particulars of that? Like is that random input every 25 ticks? 25% chance of going off? does it matter that it's a "<25" and not ">25"?
Re: Gombie AI problem
#6  January 19, 2020, 11:02:06 AM
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Random takes a value between 0 and 999 every time its called. If you do something like

Trigger1 = random && random && random

Each of those will return a different value between 0 and 999. So random < 25 will trigger when that value is less then 25. In a wrong but close enough this means a 2.5 chance each tick to occur which is pretty low.

Enemy, backedgedist is probably what you want for checking how close p2 is to the back of the screen. Enemy redirects to the first opponent and then checks their backedgedist.


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.
Re: Gombie AI problem
#7  January 19, 2020, 11:22:16 AM
  • ****
To answer your question a bit more in depth, yes, it makes difference if it's < or >.

As Cyanide said, "random" will generate a number between 0 and 999, and this is a different number every tick. Usually authors use random when coding the AI so the character don't spam the move too much, but 25 is a very low number, so it almost never will trigger.

Think about it from 0 to 1000 instead (to make things easier):
random < 500 = random is less than 500 = 50% chance of trigger
random < 250 = random is less than 250 = 25% chance of trigger
And so on. Random < 25 would be less than 2% chance. You might want to increase that value.

About < or >, is just the opposite, instead of less, it's more. Random > 750 (more than 750) is basically the same as random < 250, for example.

I hope my explanation makes sense. :lol:
Re: Gombie AI problem
#8  January 19, 2020, 11:52:59 PM
  • ****
  • CPU Purple Heart
    • USA
    • www.dailymotion.com/2a8130871d2742d2f4da3b069

  • Online
 AI Changestate order in statedef -1 also plays a surprisingly big factor on how likely an AI will commit to any action since MUGEN is parsed from top to bottom. So, placing changestates higher is something you'd do if you want AIs to increase their chances, too, since higher random values alone aren't enough. This is why it is recommended to separate AI changestates completely from human changestates since you have more control over how an AI decides its actions. An example is if an AI blocks too much, the guard changestate is being placed too high... inversely, if the AI rare guards, it's probably because the guard changestate is placed too low.

 As for me, when it comes to AI, I usually like to balance between random levels and changestate priority so as to make the AI have a more desirable behavior. Of course, this requires a fair bit of trial and error like anything else and it varies greatly between what balance is ideal for each character. Although, a rule of thumb is if something has a "100%" chance of occurring (either by having random at value < 1000 or skipping random altogether), always put it towards the bottom so all the other changestates still have a reasonable chance to occur.
Re: Gombie AI problem
#9  January 20, 2020, 04:08:30 AM
  • **
    • USA
Okay I pretty much get it now, One last question

so backedgedist means the left side of the screen and frontedgedist means the opposite side right?

So when I write something like

trigger1= (enemy,backedgedist =[30,100]) && random<50

that does mean p1(left side) will activate move when p2 crosses the threshold into the left side of the screen?

or does writing "enemy," before backedgedist means that backedgedist now becomes flipped to the enemy's behind wall and what I should be writing is frontedgedist?

Because right now it seems like it's consistently triggering when the opponent is on the right edge of the screen, but maybe Im just underestimating how big a window  (enemy,backedgedist =[30,100]) is
Re: Gombie AI problem
#10  January 20, 2020, 04:42:02 AM
  • ****
Pretty much it.

BackEdgeDist is the distance between the character and the edge behind him (the side he is NOT facing), it can be either left or right depending on which direction the character is facing. In this case is a redirect for the enemy, so whenever the distance between the enemy char and the edge behind him is between 30 and 100 pixels (I think it's pixels, but not sure), it will activate.

FrontEdgeDist is the opposite, is the distance between the char and the edge in front, the one that the char is facing.
Re: Gombie AI problem
#11  January 21, 2020, 02:16:21 PM
  • **
    • USA
So writing enemy,frontedgedist is what I want if I want it to go off when p2 approaches left side of the screen when p1 is facing right?

and lastly does the "enemy" treat helpers and projectiles like as if they were the enemy cause that could be what's throwing me.

changing it to enemy,frontedgedist seems to be getting the same result as enemy,backedgedist but there is almost always a helper in play during my tests so...
Re: Gombie AI problem
#12  January 21, 2020, 02:32:26 PM
  • ****
  • CPU Purple Heart
    • USA
    • www.dailymotion.com/2a8130871d2742d2f4da3b069

  • Online
Re: Gombie AI problem
#13  January 21, 2020, 02:39:37 PM
  • **
    • USA
No that's okay, I just wanted to know if that was interfering. Im still not clear if writing enemy before backedgedist changes the context of backedgedist or does it mean the player character's facing regardless.
Re: Gombie AI problem
#14  January 21, 2020, 03:04:25 PM
  • *****
  • Shame on you!
    • USA
vVv Wheat Stage Released vVv