Newagemugen
Newagemugen
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Newagemugen

We're The Best At What We Do - Runnin' The Mugen Underground Since 2010. Underground M.U.G.E.N community specializing in advanced Quality Mugen content, Fanart, Graphics, Fighting Games & more.

You are not connected. Please login or register

AI Programming Tutorial by Flowagirl

Go down  Message [Page 1 of 1]

1AI Programming Tutorial by Flowagirl Empty AI Programming Tutorial by Flowagirl Sun Feb 23, 2014 4:07 pm

Demitri

Demitri

AI Programming Tutorial by Flowagirl RjBqV68
★★Thousand Dragon★★
Posted over 1000 Messages
Talk Of The Town (Wood)
Recieved 5 or more likes from other Members
Published To Perfection (Gold)
Created 30 or more Unique Topics
卍♆★Divine Overseer★♆卍
Verified Senior Forum support/assistant/curator
★★Dark Master Of Fists★★
Newagemugen Member for over 10 Years
Lord Of War (Gold)
Obtained The Highest Tier 3 Warlord Class Rank

Spoiler:
========================
AI Programming Tutorial
========================
Author: FlowaGirl
flowergirl@cutey.com
http://blargh.i-xcell.com

---------------------------------------------------------------------------
Programming a character's custom AI is something extra; It's not needed in any
character, but most people seem to want to do it anyway, whether it is to kick
another character's arse, increase the gameplay of the character, or just for
watch mode.
---------------------------------------------------------------------------

When programming an AI, it is recommended that you have completed most of
the character. It will makes things easier, so you won't have to go back and change
anything in the script if you decide to add in more stuff.

Think about the moves for your character; How you want it to use a projectile,
when to guard, and when to attempt to throw the opponent? It's up to you. A well
planned AI is important, as poorly made AI's can end up extremely glitchy.

This example shows how your character will attempt to throw the opponent, only
when it is close to the opponent, and when the opponent is on the floor. I choose
to do the AI programming under StateDef -3, but this can be done under StateDef -2, or
even StateDef -1 of the CMD file.

[State -3: ChangeState]
type = ChangeState
trigger1 = (Var(0) > 0)
trigger1 = (Random <= 499)
trigger1 = (StateType != A) && (Ctrl)
trigger1 = (P2BodyDist X <= 40) && (P2StateType = S)
value = ****

The 1st trigger, "(Var(0) > 0)" means that the move can only be read by the AI.
Remember, the AI Activation sets the value of Var(0) to 1.

2nd trigger, "(Random <= 499)" means that the AI will make an attempt to throw the
opponent, but only half the time. This should be used, so your character
is not too predictable.

3rd trigger, is simply used, so that the character can only make the throw attempt
when he is on the ground, (StateType != A) and is able to do so. (Ctrl)

Finally, the 4th trigger, "(P2BodyDist X <= 40) && (P2StateType = S)" means that
the character will throw the opponent, only when the opponent is close, (P2BodyDist X <= 40)
and when the opponent is on the ground as well. (P2StateType = S)

Given this idea as how it is done, you can come up with your own character AI's.


________________________________________________________________________________________________________________________________________________________________________
AI Programming Tutorial by Flowagirl QnnT425

2AI Programming Tutorial by Flowagirl Empty Re: AI Programming Tutorial by Flowagirl Sun Feb 23, 2014 5:25 pm

Demitri

Demitri

AI Programming Tutorial by Flowagirl RjBqV68
★★Thousand Dragon★★
Posted over 1000 Messages
Talk Of The Town (Wood)
Recieved 5 or more likes from other Members
Published To Perfection (Gold)
Created 30 or more Unique Topics
卍♆★Divine Overseer★♆卍
Verified Senior Forum support/assistant/curator
★★Dark Master Of Fists★★
Newagemugen Member for over 10 Years
Lord Of War (Gold)
Obtained The Highest Tier 3 Warlord Class Rank

===============================
AI Activation: Pallette method
===============================
Author: FlowaGirl
flowergirl@cutey.com
http://blargh.i-xcell.com

---------------------------------------------------------------------------
Until Elecbyte decides to add in a trigger that detects
whether the character is controlled by a player or by the
CPU, this code will be used as a workaround.

After implementing this little piece, you are free to program
your character's AI, providing that you know how it's done. ;)
---------------------------------------------------------------------------

There's not much needed to put to achieve the effect. All you
have to remember is that you, the player must -never- use pallettes
7-12; They are reserved for the AI.

Add this piece under StateDef -2.

[State -2: VarSet]
type = VarSet
trigger1 = (Var(0) != 0) && (PalNo = [7,12])
var(0) = 1

These next few states are used to turn the AI on and off at the
appropriate times. We wouldn't want the character to battle during
his winpose. ;)

[State -2: VarSet]
type = VarSet
trigger1 = (Var(0) = 1)
var(0) = 2

[State -2: VarSet]
type = VarSet
trigger1 = (Var(0) != 0) && (RoundState != 2)
var(0) = 0

[State -2: ChangeState]
type = ChangeState
trigger1 = (RoundState = 3) && (StateType != A) && (Ctrl)
value = 0

The advantage to this method is that you can choose different levels
of AI for watch mode. When selecting the character, you hold the start
button, and simply choose a pallette. However, you must create a
different level of AI for every one of the pallettes, 7 to 12.

[State -2: VarSet]
type = VarSet
trigger1 = (Var(0) != 0) && (PalNo = [7,12])
var(0) = (PalNo - 6)

When programming your AI's they can be organized in this way:

Var(0) = 1: Level 1, Pal 7
Var(0) = 2: Level 2, Pal 8
Var(0) = 3: Level 3, Pal 9

etc...


________________________________________________________________________________________________________________________________________________________________________
AI Programming Tutorial by Flowagirl QnnT425

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum