collapse

Author Topic: Converting WinMugen AI to Mugen 1.0 AI  (Read 3448 times)

0 Members and 1 Guest are viewing this topic.

Offline Acey

  • Infinity Administrator
  • *
  • Posts: 9579
  • Country: United States us
  • Last Login:December 05, 2022, 10:43:15 PM
  • "Victory means nothing, the fight is everything."
    • Infinity Wiki - Acey
    • Email
Converting WinMugen AI to Mugen 1.0 AI
« on: September 12, 2011, 06:53:09 PM »
Since the Release of Mugen 1.0 in January 2011 the ability to set up a proper Artificial intelligence in Mugen in finally available. All of the previous "work around" methods that had been developed are no long necessary, particularly the trigger that was used to "turn on" the artificial intelligence. This by no means makes previously developed AI obsolete. Actually the past few years of AI development works to our advantage, especially since so many authors have already created their artificial intelligence to work at a fairly difficult level, since authors tend to want to show off the abilities of the character they programmed.

For any character that already has a WinMugen artificial intelligence you can use the following code to allow the difficulty of the AI to actually adjust according to the level set within the game. All you need to do is to find the code that triggers the artificial intelligence in the first place, typically located in the CMD file and replace it with a new set of code.

The old version that will need to be removed typically looks something like this:

[State -1, AI]
type = VarSet
trigger1 = command = "AI_1"
trigger2 = command = "AI_2"
trigger3 = command = "AI_3"
trigger4 = command = "AI_4"
trigger5 = command = "AI_5"
trigger6 = command = "AI_6"
trigger7 = command = "AI_7"
trigger8 = command = "AI_8"
trigger9 = command = "AI_9"
v = 59
value = 1

Although this is the most commonly used type of AI trigger, there could be a number of other variations. The main point here is that the trigger is used to activate a variable, in this case v = 59.

So what you will want to do is to delete this code and replace it with the new code below:

[State -1, AI Activation]
type = varset
triggerall = AILevel > 1
triggerall = (roundstate = 2) && (var(59) = 0)
trigger1 = Random <= (ifelse(AILevel =1,40,(AILevel-2)*100))
v = 59
value = 1

[State -1, AI Deactivation]
type = varset
triggerall = AIlevel < 8
triggerall = var(59) = 1
trigger1 = Random > ((AILevel-2)*100)
trigger2 = roundstate != 2
v = 59
value = 0


You will also want to make sure that you look at the variable of the code you're about to delete, because they might not have used v = 59. They might have used v= 3 or v= 42 or any other possible number. If so then make sure the new code that you paste in also has that same number as well. I highlighted the number in red throughout the code for convenience.

Important! if you intend to use this code you will need to change the character's def file also. you will need to change the Mugen Version as follows:

mugenversion = 1.0

Last but not Least! When you use this code the character will no longer be compatible with WinMugen. That is a sacrafice that everyone must make if they havn't already in order to properly use the newest functions of Mugen 1.0.

What does this code do?
Basically this code turns off the programmed AI in random intervals leaving nothing but the default Mugen AI. The default Mugen AI is pretty stupid since all it does it move around and pull random moves from the CMD file. So with this new code, the lower the difficulty level is, the more often the AI will be turned off. The higher the difficulty level is, the more often the AI will be turned on. At level 8 the AI will be turned on all the time, which works in our advantage since, as stated earlier, many authors tend to program their AI at ridiculously difficult levels anyways.

Go ahead and add this to any character you’d like, although, obviously it will have no effect on characters who do not already have WinMugen style artificial intelligence programmed in already.



Offline O Ilusionista

  • Since 1999 and kicking :)
  • IMT Content Architect
  • *
  • Posts: 12476
  • Country: Brazil br
  • Last Login:November 11, 2024, 12:35:15 PM
  • OpenBOR & Mugen addicted
    • BMT - Brazil Mugen Team
    • Email
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #1 on: September 12, 2011, 07:16:00 PM »
I just use :

Quote
trigger1 = AiLevel

and its done.
I know your code turns the AI off, but I think that this defeats the propouse of to have an Ai, but its me.

Side note:
Boolean triggers are faster then string triggers, So trigger1 = AiLevel will be faster than trigger1 = AiLevel >0

Offline Acey

  • Infinity Administrator
  • *
  • Posts: 9579
  • Country: United States us
  • Last Login:December 05, 2022, 10:43:15 PM
  • "Victory means nothing, the fight is everything."
    • Infinity Wiki - Acey
    • Email
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #2 on: September 12, 2011, 07:40:30 PM »
I agree, Boolean trigger faster. If only the whole process could be such. The whole point of the code is to have:

1 = Very Very Easy
2 = Very Easy
3 = Easy
4 = Nomal
5 = a Litle Harder
6 = Difficult
7 = Very Difficult
8 = Very Very Difficult

Offline DDP

  • New Member
  • *
  • Posts: 3
  • Last Login:February 23, 2012, 10:17:58 AM
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #3 on: September 15, 2011, 11:39:41 AM »
It actually works!! Thank you so much for making this code. With this code, I'll be able to change the difficulty to my liking using the options menu instead of the preset difficulty.

Offline Acey

  • Infinity Administrator
  • *
  • Posts: 9579
  • Country: United States us
  • Last Login:December 05, 2022, 10:43:15 PM
  • "Victory means nothing, the fight is everything."
    • Infinity Wiki - Acey
    • Email
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #4 on: September 15, 2011, 12:11:50 PM »
Thanks, I've been testing a large variety of AI options over the last few months and this ended up being the best option I could find, then I sat on it for a while to make sure it was well tested in a variety of situations.

Offline DEMONKAI

  • The Visionary and IMT's
  • Contributor
  • ****
  • Posts: 8335
  • Country: United States us
  • Last Login:October 11, 2022, 09:44:18 PM
  • Never limit your vision as a creator!!
    • DTHECHEMIST
    • D THE CHEMIST
    • Demonkai's Mugen
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #5 on: September 16, 2011, 05:47:32 AM »
Thanks for the tip Acey! ^^(PM)^

ill definitely save this to my notes! :thumbsup:
Lots and lots of supers so f*ckin what

HAIL CROM!!

Offline thepacifist

  • Initiate
  • **
  • Posts: 48
  • Last Login:March 24, 2021, 02:38:08 PM
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #6 on: September 17, 2011, 01:48:11 PM »
Most interesting...I just switched over to Mugen 1.0 and was thinking of reissuing new patches (not that I have much spare time at the present moment), but the amount of work involved seemed daunting (because I thought I'd have to add tons of triggers to each move of every character with different probabilities for each move depending on the level of AI). This is a nice way to avoid all that - a nice patch for my patches. :-)

Thanks! Yet another reason making the switch made sense. I initially switched because I upgraded to 64 bit Windows 7 and the sound on winmugen wasn't as good. Now, after awhile of not really touching mugen, I'm starting to get back into it (for better or worse given all my other responsibilities right now).


Offline thepacifist

  • Initiate
  • **
  • Posts: 48
  • Last Login:March 24, 2021, 02:38:08 PM
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #7 on: September 20, 2011, 08:37:54 PM »
Question: Does it matter whether the activation code is in statedef -1 vs. -2 vs. -3. Can't remember, it's been so long. As I've been switching some characters, I've noticed that the activation code is in statedef -2 or -3 in the .cns file. Not sure if there's a more ideal place for that code to be. Any thoughts?

Offline STNeish

  • Initiate
  • **
  • Posts: 16
  • Last Login:August 22, 2018, 08:38:05 PM
    • Email
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #8 on: September 25, 2011, 06:41:45 PM »
Is there a particular series of lines I have to do this to?  In the Magneto file, for example, there's hundreds of lines of code like this.  Am I supposed to do this to each set of code?  One in particular?  Which one?

Sigh.  I wish the characters were just made with sensible AI in the first place...

Offline Shadic54

  • The ultimate life form!
  • Forum Member
  • ***
  • Posts: 356
  • Last Login:May 25, 2020, 02:41:33 AM
  • Being attacked by zombies!
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #9 on: September 11, 2012, 05:43:34 PM »
Could this work on Kongs Charecters?
God bless America!

Offline YoungSamurai5

  • Young Coder
  • Forum Member
  • ***
  • Posts: 221
  • Last Login:October 11, 2018, 09:37:13 PM
  • Live by the gun, Die by the sword
    • Email
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #10 on: September 11, 2012, 05:56:26 PM »
this definitely makes things much easier thanks  :)
Mugen or Nothin


Offline Tazzer

  • Forum Member
  • ***
  • Posts: 436
  • Last Login:June 15, 2018, 06:39:36 PM
    • Email
Re: Converting WinMugen AI to Mugen 1.0 AI
« Reply #11 on: September 11, 2012, 06:54:41 PM »
Thanks a lot Acey, this will be helpful.

A quick question:  How do you do this when the character's AI is not set up that way?  For instance, in the command file:

Instead of seeing something like this:

Code: [Select]
[State -1, AI]
type = VarSet
trigger1 = command = "AI_1"
trigger2 = command = "AI_2"
trigger3 = command = "AI_3"
trigger4 = command = "AI_4"
trigger5 = command = "AI_5"
trigger6 = command = "AI_6"
trigger7 = command = "AI_7"
trigger8 = command = "AI_8"
trigger9 = command = "AI_9"
v = 59
value = 1

You see something Like this:

Code: [Select]
[State -1, AI Helper Check]
type = ChangeState
trigger1 = IsHelper(9741)
value = 9741

[State -1, AI Helper Check 2]
type = ChangeState
trigger1 = IsHelper(9742)
value = 9741

'Cause there are some characters (KOF characters I've noticed mostly..but others too).  Who don't have that first set up.   They have it like the second one.   So then I go looking for it in the CNS files, but anything I find relating to AI is nothing like the example you've given.   So I'm kind of hesitant to touch it (for fear of screwing up the charater) but it's frustrating because some people (for whatever reason) decide to make their characters with damn near unbeatable AI.    I'll never understand why they do that.  What's fun about that?  Challenging AI.. fine, can totally deal with that.  Love a challenge.   However a lot of these characters are so far beyond "challenging" that it's almost cruel lol.   Unbeatable/Near Unbeatable AI = Not a nice thing to do... at least not with out offering/coding a way to make it a little easier and not such a nightmare.   Examples of characters who handle this correctly are Sander's characters.   They came with different CNS files that allowed you to keep the crazy difficult AI or change it to medium or easy(no ai).   Once again:  Challenging AI = Good!  Unbeatable AI = a very big no no (or else it should be, without options to change it with out making the cpu a complete dummy).

Anyway, sorry 'bout that.  The question was not supposed to turn into a mini-rant lol.   I just wonder what the reasoning is for coding characters that frustrate you to the point of breaking your controller, or you know, kicking your computer out a window.

Tags:
 


* IMT Facebook

Help us by Donating!

IMT Discord

Join us at our Discord! Click the image below!

* IMT Shoutbox

Sorry, this shoutbox does not exist.

* Recent Posts

D2TD VS Showcase Thread by D2TD
[Today at 09:12:03 AM]


Marvel vs. Capcom: Eternity of Heroes REMAKE Game Update 1.3.0 - N.A.O.H. by LightFlare
[November 21, 2024, 09:44:09 PM]


Terrordrome: Rise of the Boogeymen Extended Version ( jeepers creepers) version by leonardo
[November 19, 2024, 10:22:47 PM]


Hill of the Nameless(1.1 Only) by Vegaz by LightFlare
[November 19, 2024, 10:50:39 AM]


Golden Axe Returns by gokudo99
[November 19, 2024, 03:59:31 AM]


Barkley Shut Up and Jam! Stages by Vegaz by LightFlare
[November 12, 2024, 11:26:21 AM]


[BOR] _Avengers United Battle Force_ by O Ilusionista
[November 11, 2024, 12:35:24 PM]


Eternal Lament Stage 1.1 & 1.0 by O Ilusionista
[November 11, 2024, 12:34:54 PM]


MatreroG's Stages W.I.P. Concepts by MatreroG
[November 11, 2024, 07:00:56 AM]


Spooky House(1.1 Only/AIGS) by Vegaz by LightFlare
[October 31, 2024, 11:31:36 AM]

* IMT Calendar

November 2024
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
[24] 25 26 27 28 29 30

SimplePortal 2.3.5 © 2008-2012, SimplePortal