YesNoOk
avatar

AI Activation Code (Read 35814 times)

Started by Winane, April 24, 2004, 03:20:04 am
Share this topic:
Re: AI Activation Code
#21  August 29, 2004, 06:41:24 am
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Guess I should mention here that I tweaked the code on my site just a tad.
No real functional changes, though.  Just added a note about optionally using this code to permanently disable the helper method in Training mode so that you can use the button jam feature without turning on the AI, and shifted the high variable indices down a notch to allow for more convenient implementation of the Training mode detection code.
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Re: AI Activation Code
#22  October 02, 2004, 08:04:01 am
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Finally remembered to test a few more things, and updated the text stuff accordingly (no change to the code though).  In particular, tried to clarify some language about command redefining, and added these bits in the CMD:

Quote
;[Remap]
;
;  Note that if you modify the button remapping scheme, this character will
; still be able to correctly detect the basic commands of other characters
; complying with the basic command order specified below, as long as their
; buttons haven't been remapped.  But no character (not even one with the same
; remapping scheme, not even another instance of this character) will be able to
; correctly detect this character's commands.  This shouldn't ever result in any
; false positives, but it could delay correct positives, and could erroneously
; make the helper AI activation method trigger a false negative in team simul
; modes, in which case the XOR-ed commands method would be needed to provide
; backup.  But of course, this isn't an issue in any version of Mugen prior to
; version 2002.04.14.

And as another restriction on command redefining:
Quote
; - The first definition of each of these commands must be in the order
;   specified below.  Any additional definitions can be placed anywhere after
;   the first one.
since it's the first instance of any given command name that determines its place in the character's command array.



Also, didn't feel like adding this to kfm-ai.rar, but here's another little optional tidbit:
If you want to make the code a little more resistant to crappy characters that overwrite your variables in their custom states, you could add some thing like this:
Code:
[State -3, FailSafer]
type = VarSet
trigger1 = var(58)!=[-2,1]
var(58) = 0
It won't detect if the AI variable gets overwritten with a valid value, but it'll resurrect the AI helper if the variable gets set to anything else, thus allowing the helper method to quickly correctly set the variable.
It'll also need modification if you're using a multi-level AI system where var(58) can indicate different difficulty levels, but I'd recommend using the simplifier variable (var(0) in the example code) for that purpose instead anyway.
(Personally, I wouldn't bother using this little addition myself, as I figure it's best to just avoid any character that's rude enough to overwrite others' variables, but here it is in case anyone disagrees.)
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Re: AI Activation Code
#23  January 18, 2005, 10:39:12 am
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
I've just now updated the code to deal with screenpacks that set start.waittime to less than 2 (thereby skipping RoundState 0) in fight.def.  The old version included a couple !RoundState triggers simply for the sake of slightly improving efficiency, but that rendered the IsHomeTeam and ID methods useless if start.waittime=0.

I also changed my mind and decided to remove most of the unnecessary parentheses, so the code isn't quite as bloated now.

Made a few other minor tweaks as well, but nothing significant.

I was in a bit of a hurry when making the changes, so please let me know if I screwed anything up.
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Re: AI Activation Code
#24  January 25, 2005, 04:59:29 pm
  • *****
  • can see your halo
    • Germany
    • Skype - panchasell
    • www.mugenguild.com/
Mugen creates an array of 128 command names for each character. If you try to detect a partner's or enemy's command (e.g. partner,trigger# = "x") without putting them in a custom state, then, Mugen doesn't try to find the command with the name you specified in their command list. Rather, it checks the array index of the command name you've specified in your CMD, and then checks whether the command with the same index in your partner's/enemy's command array is activated. So, in order to detect partner or enemy commands, you need to make sure that matching commands are in the same place in each character's command array.

I dunno... but tested against KFM, who has "recovery" (modified to /x)  far down his .cmd and Gouki with a single "recovery" (y+z) command at the top of his .cmd. KFM is not in one of Gouki's states (but in common1.cns states). Aaand this under StateDef -3

Code:
[State -3, P2 Breakfall]
Type = TargetState
TriggerAll = Var(27) && P2Life && NumTarget && RoundState = 2 && Alive
Trigger1 = Target, Command = "recovery"
Value = 5220

can be triggered by KFM's recovery command, i.e. /x. And not by Gouki's y+z. I think I'm saying that "If you try to detect a partner's or enemy's command (e.g. partner,trigger# = "x") without putting them in a custom state, then, Mugen" does "try to find the command with the name you specified in their command list."

If it's there, fine, P2's it is, and if not, P1's.


Or was it something else you think I am wrong about with that list??

    No matter whether you're having P2 in a state of yours and do command = "blah" or just do trigger_redirection, command = "blah":
  • If "blah" exists only in P1's .cmd file, whatever P1 has defined for "blah" will evaluate true.
  • BUT
  • If "blah" exists also in P2's .cmd file, only whatever P2 has defined for "blah" will evaluate true!
"Several times now, Achamian thought he had glimpsed golden haloes about Kellhus's hands. He found himself envying those, such as Proyas, who claimed to see them all the time."
--R. Scott Bakker
The Thousandfold Thought (2006)
Re: AI Activation Code
#25  January 25, 2005, 05:17:16 pm
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Could you upload+post the modified code files you used for testing that?  And mention which of Gouki's moves you used to make KFM a target.
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Last Edit: January 25, 2005, 05:28:27 pm by Dante Alighieri
Re: AI Activation Code
#26  January 25, 2005, 08:17:34 pm
  • *****
  • can see your halo
    • Germany
    • Skype - panchasell
    • www.mugenguild.com/
http://mugenguild.com/mcspace/Thrawn/kfm.cmd

Changed:
Code:
[Command]
name = "recovery";Required (do not remove)
command = /x;x+y
time = 1

http://mugenguild.com/mcspace/Thrawn/commands.cmd

Changed:
Code:
[Command]
Name = "recovery"
Command = y+z
Time = 1
.
.
.
;[Command]
;Name = "recovery"
;Command = x+y
;Time = 1

;[Command]
;Name = "recovery"
;Command = x+z
;Time = 1

Test relevant (Gouki's states.cns):
Code:
[State -3, P2 Allow Flipping]
Type = VarSet
TriggerAll = !Var(27) && P2Life && NumTarget && RoundState = 2 && Alive && (Ctrl || MoveType = H)
Trigger1 = (Target, StateNo = 5030 || Target, StateNo = 5035 || Target, StateNo = 5050)
var(27) = 1

[State -3, P2 Disallow Flipping]
Type = VarSet
TriggerAll = Var(27) && P2Life && NumTarget && RoundState = 2 && Alive
Trigger1 = Target, MoveType != H || Target, StateType != A || Target, StateNo = 5200 || Target, StateNo = 5201 || Target, StateNo = 5210 || Target, StateNo = 5210
var(27) = 0

[State -3, P2 Breakfall]
Type = TargetState
TriggerAll = Var(27) && P2Life && NumTarget && RoundState = 2 && Alive
Trigger1 = Target, Command = "recovery"
Value = 5220

How? Quick versus, KFM vs. Gouki, KFM Stage. Gouki's hard punches/kicks for example make KFM fall when they are Counter Hits (no custom states, just an alternate hitdef). From there, KFM can use "recovery" as soon as Gouki has control back. Also from Hurricane Kick and so on, whenever the trigger conditions above are met.



Edit: Okay, I was wrong after all. "recovery" must be a special case, maybe because it is in the common1.cns and all that... because I tested the same thing with a new command:

[Command]
Name = "sex"
Command = /x
Time = 1

And no matter where I placed it in Gouki's .cmd, KFM could never be recover holding /x unless the command was placed inside KFM's cmd as well, and at the same friggin' place.
"Several times now, Achamian thought he had glimpsed golden haloes about Kellhus's hands. He found himself envying those, such as Proyas, who claimed to see them all the time."
--R. Scott Bakker
The Thousandfold Thought (2006)
Last Edit: January 25, 2005, 08:41:42 pm by Sepp
Re: AI Activation Code
#27  January 25, 2005, 09:03:38 pm
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Gouki's hard punch/kick counters put KFM in State 5030, then 5035, then 5050.  I couldn't recover before reaching 5050.  So, what made you think it wasn't this:
Code:
[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER
in common1.cns instead of the TargetState in your Gouki that was allowing KFM to recover?
So, no, "recovery" isn't really a special case.

Anyway, I find DisplayToClipboard/AppendToClipboard controllers much more useful for testing this kind of stuff, rather than just testing whether some code appears to work.



By the way, in case anyone else comes along with the misinterpretation that I was incorrectly kinda expecting was going to be the explanation here:
Wherever I'm referring to a player being in a "custom state", I'm actually referring to the player being in another player's states, regardless of whether those states are defined in common1.cns or in the other player's own code files; that is, regardless of whether the state is truly "custom" or not.  In other words, what I'm referring to is the time between when the player gets hit by a HitDef with a P2StateNo parameter (and without P2GetP1State set to 0) and when a SelfState controller then reverts the player back to its own states.  I've just been using the term "custom state" as a not-entirely-accurate shorthand way of referring to that.


Edit:  :-[
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Last Edit: January 26, 2005, 03:15:13 pm by Alighieri
Re: AI Activation Code
#28  January 25, 2005, 09:21:46 pm
  • *****
  • can see your halo
    • Germany
    • Skype - panchasell
    • www.mugenguild.com/
Anyway, Gouki's hard punch/kick counters put KFM in State 5030, then 5035, then 5050.  I couldn't recover before reaching 5050.
 
That, sir, is because - when using hard punches/kicks - Gouki doesn't end the move and get control back before KFM has reached state 5050. ;)

Quote
So, what made you think it wasn't this:
Code:
[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER
in common1.cns instead of the TargetState in your Gouki that was allowing KFM to recover?

Why,
Code:
Fall.Recover = 0
in Gouki's HitDefs of course.

Quote
So, no, "recovery" isn't really a special case.

Anyway, I find DisplayToClipboard/AppendToClipboard controllers much more useful for testing this kind of stuff, rather than just testing whether some code appears to work.

Like so?  ???
"Several times now, Achamian thought he had glimpsed golden haloes about Kellhus's hands. He found himself envying those, such as Proyas, who claimed to see them all the time."
--R. Scott Bakker
The Thousandfold Thought (2006)
Re: AI Activation Code
#29  January 25, 2005, 11:37:49 pm
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Holy crap, you're right.  o_0

To summarize:
"recovery" does count towards the 128-command name maximum total: removing it allows the addition of another.
Its position in the command array is determined the same as any other command, and affects the positions of subsequently defined commands just like normal.
BUT:  Redirecting command="recovery" triggers is completely different than redirecting other command triggers.
It always detects the redirected-to player's own "recovery" command rather than the detector's.  And custom states have no effect on this.
And if the redirected-to player doesn't have a "recovery" command defined, "recovery" redirects will never return true.
Furthermore, detecting one's own "recovery" command uses one's own "recovery" command definition even when one is in another player's custom state.
Weird.  I wonder how the internal representation and functioning of all this works.

Regardless, I think it's safe to conclude that Elecbyte was enjoying da shrooms or something while writing their command-related code.  :P

Anyway, thanks for noticing that, Sepp!  You rock.*

Hm, wonder if there's any interesting ways to take advantage of this...



That, sir, is because - when using hard punches/kicks - Gouki doesn't end the move and get control back before KFM has reached state 5050. ;)

Why,
Code:
Fall.Recover = 0
in Gouki's HitDefs of course.

How dare you expose my laziness!  >:(  >:(


Quote
Anyway, I find DisplayToClipboard/AppendToClipboard controllers much more useful for testing this kind of stuff, rather than just testing whether some code appears to work.

Like so?  ???

Huh?  ???




[size=5pt]*(But your Gouki doesn't.  =P  I found it amusingly pathetic watching him flop himself on his back repeatedly while testing this stuff...)[/size]
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Re: AI Activation Code
#30  January 27, 2005, 10:20:36 am
  • *****
  • can see your halo
    • Germany
    • Skype - panchasell
    • www.mugenguild.com/
"Several times now, Achamian thought he had glimpsed golden haloes about Kellhus's hands. He found himself envying those, such as Proyas, who claimed to see them all the time."
--R. Scott Bakker
The Thousandfold Thought (2006)
Re: AI Activation Code
#31  March 12, 2005, 01:20:23 pm
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Minor update uploaded, in light of this.

No code changes, just tweaked the text.
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )

crr

Re: AI Activation Code
#32  October 23, 2005, 11:47:51 am
  • avatar
hi,
i'm trying to upgrade my char AI using Winane AI activation code. The links don't work anymore so I found a char, athena2002, that has it. It works but it seems to me that the AI is not "very fast" and my char is going on jumping even if I remove any jump and jump-attack from its AI (it has this problem also before but now it's worse).
Do you have any suggestion or can you provide me with a working link with Winane AI tutorials?
thanks
Last Edit: October 23, 2005, 02:19:04 pm by crr
Re: AI Activation Code
#33  October 23, 2005, 02:03:25 pm
  • ******
  • YOMI
    • www.justnopoint.com/lbends
hi,
i'm trying to upgrade my char AI using Winane AI activation code. The links don't work anymore so I found a char, athena2002, that has it. It works but it seems to me that the AI is not "very fast" and my char is going on jumping even if I remove any jump and jump-attack from its AI (it has this problem also before but not it's worse).
Do you have any suggestion or can you provide me with a working link with Winane AI tutorials?
thanks
I suppose I could upload them to my site, but I'd need the ok from everyone else.  Everyone?

It is in the mugen section of my site.
Last Edit: October 23, 2005, 02:25:14 pm by Jazzy

crr

Re: AI Activation Code
#34  October 23, 2005, 06:10:04 pm
  • avatar
thank you very much, I downloaded it  :P  ;D

crr

Re: AI Activation Code
#35  October 23, 2005, 06:59:38 pm
  • avatar
Hi, I read the tutorial added the "activation" code in the cns, fix the commands in the cmd for the Xor method .. and then I'm just using the var(0) for my AI.
Is it correct? It seems to me still "slow" and is going on jumping even if there is no AI-jump "defined".
Thanks you very much for your help
Re: AI Activation Code
#36  January 09, 2006, 12:56:04 pm
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Hm, well, you haven't provided enough information for me to know what the problem is, but since it's been more than two months, I'll assume you've figured it out by now.  :shrug:


Anyway, just thought I'd mention that I've updated the files, but I don't think I changed anything since the last version other than the URL to my site.  However, to anyone who's downloaded the code from Jazzy's (aokmaniac13's) site, please note that the version of the code he uploaded was outdated, ugly, and somewhat flawed, so please be sure to use the latest version from my site instead.
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Re: AI Activation Code
#37  January 12, 2006, 04:42:02 pm
  • ****
  • ~ Esprit guerrier ~
    • madahine.net/bdi/
However, to anyone who's downloaded the code from Jazzy's (aokmaniac13's) site, please note that the version of the code he uploaded was outdated, ugly, and somewhat flawed, so please be sure to use the latest version from my site instead.
Huuu, shit.
I'll have a look on that tomorrow and post here what parts must be updated.

EDIT :
* DEF file : nothing
* AIR file : nothing
* CMD file :
   - [button remapping] : code and comments
   - [Default values] : comments
   - comment line above the -| CPU |-  (may be already in Jazzy's version, not sure).
   - comments modified above the -| Super Motions |-
* CNS file :
   - States 9741/9742 : at least parenthesis removed, better copy/paste for safety.
   - States -2 : idem but please note that an ATC sctrl has been added at the end
   - States -3 : same again (ie state unfair, trigger1,1 changed)
* TXT file :
   - Didn't check, anyway just copy/paste all files (unless you added your own comments in... in that case... good luck ! ;D)

It's pretty faster to update than I thought at first.
Last Edit: January 13, 2006, 12:42:32 pm by ~ 7th Heaven ~
Re: AI Activation Code
#38  January 12, 2006, 10:56:03 pm
  • ******
  • YOMI
    • www.justnopoint.com/lbends
Updating soon  :P
I had not realized your site was still functional.
Re: AI Activation Code
#39  January 31, 2006, 04:26:18 am
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
For a while, it wasn't.  :P

Thanks BDI!


Winane said:
[State -3, Unfair]; Is this reliable?
Answer:  No, it is not.  ><

Sorry, I hadn't realized it was possible for the human players to start on the right side in team co-op mode.  :embarrassed:  Thanks to Chosen_01 for pointing that out!
So, I've removed the ID method.  No big loss, as it only contributed in one specific situation anyway.  To anyone who's been using it, please be sure to update your characters.

Furthermore, it turned out I'd forgotten to include this bit, now added:
Winane said:
Also, if your character overrides StateDef 5900, do make sure you clear
at least var(58) there when !RoundsExisted.


And do note that there may yet be a flaw in the helper method, as indicated by false positive reports from Cybaster and Dracoroot7.  I'll try to investigate further, as time allows.  If anyone wants to try figuring it out themselves first, my current best suspicion is that it might have something to do with having Game Speed set to faster than normal.  Might be completely wrong, though.
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Last Edit: January 31, 2006, 04:29:18 am by :nink:
Re: AI Activation Code
#40  January 31, 2006, 04:36:50 am
  • ******
  • In after lock
    • mugenguild.com/~messatsu/index.html
Quote
If anyone wants to try figuring it out themselves first, my current best suspicion is that it might have something to do with having Game Speed set to faster than normal.
I'd say that's not it. :P  All code needs to be executed while drawing can be skipped.  I might have a look see, but don't expect fast results.


Many people risk their lives everyday by having Mugen.