Mugen DEV Forum


Pages: (2) [1] 2  ( Go to first unread post ) Reply to this topicStart new topicStart Poll

> AI
Chaos Ghost
Posted: Mar 9 2003, 05:49 PM
Report PostQuote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 2484
Joined: 9-March 03



does any know how to make an AI for a char need help
Mini ProfilePM
Top
Posted: Mar 9 2003, 06:02 PM
Report PostQuote Post





Group:
Posts:
Member No.:
Joined: --



I do! I'll help you out bud.

The first thing you gotta do is make the ai activators. There is no clean way to activate ais with characters yet, but the best way is to make commands in the cmd file that are impossible for normal people to do. Here is an example.

[Command]
name = "cpu"
command = ~D,UB, F, a, s, U,x+y+z+a+b+c+s
time = 1

You should make several of these, remembering to keep the time at 1 so the moves are impossible.

Then, go down to the second have of the command file, and make it so that when that move is done, a variable is changed.

[State -1, AI]
type = VarSet
trigger1 = command = "cpu"
v = 30
value = 1

Now that you have that set up, you have to make the ai moves. This is the trickiest part, since every characters is different. If you have proper knowledge of Mugen characters, all you have to do is make moves activate under certain conditions. Like when you want the move to be done...plus you have to include the trigger var(30) = 1(just in the example), and a random trigger so that the move doesn't happen every single time in that situation.

I hope that helps, but ai's is a rather tricky process.
Mini ProfilePMEmail Poster
Top
Loona
Posted: Mar 9 2003, 11:47 PM
Report PostQuote Post


Sorcerologist
****

Group: Members
Posts: 387
Member No.: 1176
Joined: 26-October 02



If I recall correctly, there's an example of this method at Necromancer's Code Archive, currently hosted at XGargoyle's site: http://xgargoyle.mgbr.net

One question, while we're at it: there's a sort of command that allows motions involving holding a buttons or a direction for a certan amount of time (like holding back for 1 or 2 seconds for a Sonic Boom in SF2, for example) - for its depiction in the [command] format you have to type the amount of ticks during which the button in question must be held, but you still have the "time parameter"...
Considering that, is it possible to use a command like "holding Down for 30 ticks" with "time" set to 1 as an AI activator, or would Mugen reject it?
If it worked, it might make it possible to create shorter impossible command strings to activate AI with...


--------------------
user posted imageSorcerology 101 - Lesson 2 - Experimentation: Trial and Error
Mini ProfilePMUsers Website
Top
XGargoyle
Posted: Mar 10 2003, 12:52 AM
Report PostQuote Post


Super Saiyajin Ninja
*****

Group: Admin
Posts: 826
Member No.: 6
Joined: 13-September 02



[quote author=Loona link=board=6;threadid=1016;start=0#msg10970 date=1047253658]
One question, while we're at it: there's a sort of command that allows motions involving holding a buttons or a direction for a certan amount of time (like holding back for 1 or 2 seconds for a Sonic Boom in SF2, for example) - for its depiction in the [command] format you have to type the amount of ticks during which the button in question must be held, but you still have the "time parameter"...
Considering that, is it possible to use a command like "holding Down for 30 ticks" with "time" set to 1 as an AI activator, or would Mugen reject it?
It it worked, it might make it possible to create shorter impossible command strings to activate AI with...
[/quote]

In well-made AIs, this won't happen. During AI, the fighter can access directly to the states (no need to hold buttons and so). If you made a state in which you can't follow a certain movement by another one, then AI won't activate that combo.

AI work in the folowing way:

-Computer controlled fighter starts executing random commands (the normal ones a human can do and the "AI activators")

-After an "AI activator" is executed, a variable is set ON, for example var(30)=1. Now, AI Mode is activated.

-Now computer has direct access to combos and movements under CPU mode. It's not necessary to input any other command for the CPU to execute more commands. As long as he gain control, and under certain conditions, he will execute another "CPU only" movement/combo.


--------------------
user posted image
XGargoyle: Hoarding mugen creations since 1979
http://xgargoyle.mgbr.net
Mini ProfilePMUsers Website
Top
Baby Bonnie Hood
Posted: Mar 10 2003, 12:57 AM
Report PostQuote Post


Junior Member
***

Group: Members
Posts: 245
Member No.: 2245
Joined: 8-February 03



[quote author=XGargoyle link=board=6;threadid=1016;start=0#msg10973 date=1047257525]During AI, the fighter can access directly to the states (no need to hold buttons and so).[/quote]

No-charge Smile & Missiles and instant Happy Daggers ahoy! ;D


--------------------
user posted image
The Silent Storm palette is mandatory for all MUGEN characters >:D
Mini ProfilePMEmail Poster
Top
Loona
Posted: Mar 10 2003, 01:16 AM
Report PostQuote Post


Sorcerologist
****

Group: Members
Posts: 387
Member No.: 1176
Joined: 26-October 02



I read Necro's and SMI's tutorial (in portuguese, at his Geocities site) and well as some other sources on the subject, but the exact topic of a charging time being greater than the "time" parameter - which just occured to me as I read this topic, as a more elegant way to define an impossible command that only the computer mght use - is what's keeping me wondering... It's not impossible that somewhere in Mugen's code is something that rejects or ignores a charge-time greater than the whole command's input time, but I really don't know if Elecbyte bothered, so I was wondering if anyone had already tried that...

*considerings trying that on Shiva along with the AI blocking tips on Necro's tutorial, since the character only has about 3 attacks implemented so far*


--------------------
user posted imageSorcerology 101 - Lesson 2 - Experimentation: Trial and Error
Mini ProfilePMUsers Website
Top
SMI
Posted: Mar 10 2003, 02:08 AM
Report PostQuote Post


Member
**

Group: Members
Posts: 62
Member No.: 111
Joined: 14-September 02



I've been using commands such as

[Command]
name = "ai1"
command = y,y,y,y,y,y,y,y,y,y,a+b+c+z+x+y+U+D+F+B
time = 1

for AI activation commands for quite a time. The buttons sum implies that keyboard users won't be able to access it (keyboard buffer overflow) and the directions sum will avoid joypad users to access it as well. Works quite nice.


--------------------
[murray voice]
I'm a powerful demonic force!
I'm the harbinger of your doom!
And the forces of darkness will applaud me as I stride through the gates of hell carrying your head on a pike!
[/murray voice]
Mini ProfilePMEmail PosterUsers Website
Top
Baby Bonnie Hood
Posted: Mar 10 2003, 02:29 AM
Report PostQuote Post


Junior Member
***

Group: Members
Posts: 245
Member No.: 2245
Joined: 8-February 03



I don't really recommend using Necro's AI Guard code, because look at this:

[State -3, StandGuard]
type = ChangeState
triggerall = (Var(0) = 1) && (StateType = S) && (Pos Y >= 0) && (P2BodyDist Y <= 0)
triggerall = (P2BodyDist Y >= -120) && (P2StateType != C) && (P2MoveType = A)
trigger1 = (P2BodyDist X <= 120) && (Random <= 799) && (Ctr1)
trigger2 = (StateNo = [140, 155]) || (StateNo = [100, 105])
value = 130

See the bolded part? That means that the AI, while already blocking attacks, must go back to the guarding state. This results in skipping the "getting knocked away while blocking" states entirely; as a result, a character using this AI code will not be pushed away while blocking (and will also float away in the air) and also will not receive any block damage. This code probably worked perfectly back in an older MUGEN version, but not anymore.

Instead, use these AI Guard codes of mine:
;AI Guard
[State -1, Stand guard]
type = ChangeState
triggerall = var(*) > 0
triggerall = StateType != A
triggerall = P2statetype != C
triggerall = (P2Movetype = A) || (enemy, NumProj > 0)
trigger1 = ctrl = 1
value = 130

[State -1, S-to-C guard]
type = ChangeState
triggerall = var(*) > 0
triggerall = StateType != A
triggerall = P2statetype = C
triggerall = (P2Movetype = A) || (enemy, NumProj > 0)
trigger1 = stateno = 150
value = 152

[State -1, Crouch guard]
type = ChangeState
triggerall = var(*) > 0
triggerall = StateType != A
triggerall = P2statetype = C
triggerall = (P2Movetype = A) || (enemy, NumProj > 0)
trigger1 = ctrl = 1
value = 131

[State -1, C-to-S guard]
type = ChangeState
triggerall = var(*) > 0
triggerall = StateType != A
triggerall = P2statetype != C
triggerall = (P2Movetype = A) || (enemy, NumProj > 0)
trigger1 = stateno = 152
value = 150

[State -1, Air guard]
type = ChangeState
triggerall = var(*) > 0
triggerall = StateType = A
triggerall = (P2Movetype = A) || (enemy, NumProj > 0)
trigger1 = ctrl = 1
value = 132

I've been using these ever since I added an AI to BBH, and they've always been working flawlessly smile.gif


--------------------
user posted image
The Silent Storm palette is mandatory for all MUGEN characters >:D
Mini ProfilePMEmail Poster
Top
Man M
Posted: Mar 10 2003, 02:37 AM
Report PostQuote Post


Junior Member
***

Group: Members
Posts: 177
Member No.: 55
Joined: 14-September 02



[quote]Considering that, is it possible to use a command like "holding Down for 30 ticks" with "time" set to 1 as an AI activator, or would Mugen reject it?[/quote] It wouldn't work because apparently the time parameter doesn't matter for those commands, so the AI var would be set if a human player pressed down for at least 30 ticks. I tried the command "~30$B" as a trigger for a VarSet, and it set the variable right after I released the button.
Mini ProfilePMEmail PosterUsers Website
Top
tales_of_x
Posted: Mar 10 2003, 04:32 PM
Report PostQuote Post


Junior Member
***

Group: Members
Posts: 184
Member No.: 643
Joined: 24-September 02



[quote author=Loona link=board=6;threadid=1016;start=0#msg10980 date=1047263856]
Considering that, is it possible to use a command like "holding Down for 30 ticks" with "time" set to 1 as an AI activator, or would Mugen reject it?[/quote]

I also thought that a long time ago, but I think that the commands time begins when you actually finish the first part..... To explain it well: If you have command = ~30$D, U, b as the command line after that you fulfilled the "release down after pressing it for 30 ticks or more" part then the command time starts to count.........

Edit: I put two [ quote ] instead of the beginning and the end........



--------------------
Boys and girls, make love
Mini ProfilePMEmail PosterUsers WebsiteMSN
Top
Posted: Mar 10 2003, 06:53 PM
Report PostQuote Post





Group:
Posts:
Member No.:
Joined: --



BBH, that's exactly why I hate Necro's AI routines. Cheap. ;_;
Mini ProfilePMEmail Poster
Top
Baby Bonnie Hood
Posted: Mar 10 2003, 11:14 PM
Report PostQuote Post


Junior Member
***

Group: Members
Posts: 245
Member No.: 2245
Joined: 8-February 03



No, they're not cheap. They're just badly done tongue.gif


--------------------
user posted image
The Silent Storm palette is mandatory for all MUGEN characters >:D
Mini ProfilePMEmail Poster
Top
Loona
Posted: Mar 11 2003, 01:55 AM
Report PostQuote Post


Sorcerologist
****

Group: Members
Posts: 387
Member No.: 1176
Joined: 26-October 02



BBH: thanks for the tip! smile.gif
I assume this means I have permission to use and modify (maybe in some cases replace the blocking with dodging, for variety's sake...) the code as long as you're credited, right?...

[quote author=Star Ocean link=board=6;threadid=1016;start=0#msg10991 date=1047313975]
[quote author=Loona link=board=6;threadid=1016;start=0#msg10980 date=1047263856]
Considering that, is it possible to use a command like "holding Down for 30 ticks" with "time" set to 1 as an AI activator, or would Mugen reject it?[/quote]

I also thought that a long time ago, but I think that the commands time begins when you actually finish the first part..... To explain it well: If you have command = ~30$D, U, b as the command line after that you fulfilled the "release down after pressing it for 30 ticks or more" part then the command time starts to count.........[/quote]

What if the charging command isn't the first one? Something like:
command = a, ~70$U
time = 1

The weekend will probably be a good time to try and put this to practice...


--------------------
user posted imageSorcerology 101 - Lesson 2 - Experimentation: Trial and Error
Mini ProfilePMUsers Website
Top
Man M
Posted: Mar 11 2003, 02:31 AM
Report PostQuote Post


Junior Member
***

Group: Members
Posts: 177
Member No.: 55
Joined: 14-September 02



[quote]What if the charging command isn't the first one? Something like:
command = a, ~70$U
time = 1[/quote] That would work smile.gif At least I wasn't able to do the command, and the AI was tongue.gif
Mini ProfilePMEmail PosterUsers Website
Top
Baby Bonnie Hood
Posted: Mar 11 2003, 07:50 AM
Report PostQuote Post


Junior Member
***

Group: Members
Posts: 245
Member No.: 2245
Joined: 8-February 03



[quote author=Loona link=board=6;threadid=1016;start=0#msg11007 date=1047347727]I assume this means I have permission to use and modify (maybe in some cases replace the blocking with dodging, for variety's sake...) the code as long as you're credited, right?...[/quote]

Yep smile.gif


--------------------
user posted image
The Silent Storm palette is mandatory for all MUGEN characters >:D
Mini ProfilePMEmail Poster
Top

Topic OptionsPages: (2) [1] 2  Reply to this topicStart new topicStart Poll

 


- M.U.G.E.N Development Forum - Contact an admin - ELECBYTE - Shin Mugen -