I need to create an AI Script of where one object runs from another! does anyone know any good tutorials of which will teach me this?
Coding_Pigeons
I need to create an AI Script of where one object runs from another! does anyone know any good tutorials of which will teach me this?
Coding_Pigeons
You have come of age for my ceremonial AI posts:
Key Points:
Finite State Machines
Feedback Loop
Before you start thinking of any AI interaction, one of the best ways to create an AI for a game situation is to consider it like another person. All people perceive things, then act on those perceptions, which alters their environment, which prompts another perception and action. This is an infinite cycle we call a Feedback Loop (see above).
Computers, even game engines, aren’t as flexible as people. A computer has only two states on any subject: on or off, really. We have ways of tricking the computer into thinking it has multiple states, which in a game we use - if you’ve used a bunch of If() statements in series, you’re familiar with that truth.
Enter the Finite State Machine. Our AI behavior has a limited number of things it can do. In your scenario of something that merely flees a player:
State 0 - Doing whatever (Patrolling waypoints?)
State 1 - Fleeing
We have two states: the default state and fleeing. Your little scenario makes a very simple FSM.
But the key point of FSMs isn’t purely that the states are finite; it’s that there’s a relationship between said states. If you have ever played “Hide and Seek” as a child, this thought process on fleeing something may be familiar:
0->1: Detect something to run from.
1->0: No longer perceive something to run from.
If that helps, you’ve just had your first lesson in game AI, albeit in a non-orthodox way.
In short, what you want to do:
-State your problem.
-Identify logical states that an AI will be in.
-Identify the relationship between the AI’s states.
Now that you know what to do, go download the FPS tutorial, it has a working waypoint system that should get you started.
All this help?
Awsome man! thanks for this, it really helped! and i have just downloaded the FPS tutorial and i will take a look, but thanks again!
Coding_Pigeons
Good to hear it. I’m thinking about either creating a topic to request a sticky for, or making a UniKnowledge entry on the basics of Artificial Intelligence.
Thats a Great idea!!! nice one and thanks again lol!