Advertisement

Best method for AI?

Started by June 27, 2002 03:11 PM
3 comments, last by hpotter2 22 years, 5 months ago
What is the best method to implement AI? Is it fuzzy logic? Neural Networks? Anything else i don''t know about? I tried to code, but the compiler kept giving me an error: stupid coder alert. hpotter2
I tried to code, but the compiler kept giving me an error: stupid coder alert.hpotter2
It depends on the game you''re making! Get on Gamasutra.com and read some articles... in particular, read "Game AI: The State of the Industry" by Steve Woodcock. I believe he writes one of those every year and you can get it on Gamasutra.com

Other than that, here''s a quick rundown of AI as I understand it..

FSMs: Finite state machines are incredibly widespread. For most games, all you need is an FSM. They can be as simple or as complex as you want them to be.. The more detail you put into it, the more convincing your AI will be. If I remember right, Doom was an example of a game that used FSMs- it had 7 states or something for enemies, like "Run", "Dodge", "Shoot", etc.

FuSMs: These are "fuzzy" state machines, somewhat similar to finite state machines but they''re based on fuzzy logic. This allows you to make everything more "natural" since real life isn''t always so clear cut. For example, instead of someone being angry at you, they might be "slightly annoyed" to "downright pissed". It''s not terribly difficult but in a lot of cases, you can get by with an FSM.

Neural Nets and Genetic Algorithms: I think they are definitely cool topics, but in most cases it''s really overkill. The one big advantage that these have over other algorithms however, is that they can learn and adapt.

Patterns: These are very useful in many cases. Even though living creatures have very complicated behaviors, there are many things which can be broken down into repeated actions. I guess one example I''ve heard is going to work. It''s almost always the same thing. You get up, brush your teeth, take a shower, etc, get in your car, blah.. Fighting games make use of patterns a lot.. For example, if the enemies detect you in a vulnerable spot, they launch into some pattern like "double flying dragon punch" or whatever... But of course, it would be stupid to execute patterns blindly- like what if, while they were doing their pattern, the player simply jumped onto the other side of them? It would look dumb if they kept punching in the wrong direction. So sometimes you need a feedback loop, so that if a pattern becomes invalid, it can launch into something else.

Pathfinding: This is a common thing developers need to accomplish. Most of the time the answer is "use A* algorithm", although there are lots of variations to it.

Sensory simulation: You can simulate the enemies having senses. For example, in Soldier of Fortune, if you shoot a huge gun, it makes a lot of noise, so enemies will hear you and come after you. Or, for example, you might have some sort of line-of-sight calculation.

Flocking: You can simulate group movement or behavior by defining rules for a "flock". For example, you might have a rule that says that each person has to keep some separation from everyone else. Or you might have some sort of "formations" like they have in Age of Empires where you can order people to form in a line, or rows or whatever shape.

Random behavior: In some cases, there really *isn''t* any logical action to take. Or maybe you *Want* to give the impression of something being really random- such as the movement of a fly.

Artificial Life: Think of The Sims. This is some pretty cool stuff, but so far it''s only been applied to pretty narrow cases. Basically you try to simulate real, live creatures with their own personalities, emotions, goals, needs, and desires.

I wrote this kind of quickly so I''m sure I missed some topics but anyway hope that gives you some idea.

Rajan
Advertisement
Thanks! Anyone else?

BTW: basically i need to stimulate the growth of a human from baby to adult, but i need it to be able to turn into an adult instantly if a new player signs up(in an MMOG)
I tried to code, but the compiler kept giving me an error: stupid coder alert.hpotter2
quote: basically i need to stimulate the growth of a human from baby to adult


define that better, please. for instance i know you don't mean grow a simulated human that acts exactly like a human b/c that isn't possible yet (maybe never, but that is a long long debate). no one has even come close. so what exactly do you mean here?

-me

[edited by - Palidine on June 27, 2002 7:12:59 PM]
There are so many sub-fields of AI that it would be impossible to list them all in one post... if you want to get a basic overview of AI there''s an encyclopaedia of AI... you should be able to find it in most college libraries or your city library.

Just to clarify some things that RajanSky wrote...

A Finite state machine (FSM) is, in one form or another, a stimulus-response model of an agent. The simplest form of this model would be a list of rules of the form
if   condition   then   action   


A FSM can be made more complex by permitting multiple condition and action terms for each rule.

A Fuzzy state machine (FuSM) provides a level of abstraction between the values of state variables in the agents domain and the vague interpretation of those values in the agents FSM. So, for instance, a FuSM agent driving a car might obtain the continuous-valued distance between it and the car in front and convert that distance into a discrete, vague notion of separation between the cars, perhaps with the categories ''far away'', ''just ahead'', ''real close'' and ''I''m sitting in his back seat''!

More than this though, Fuzzy Logic can be applied to work out logical operations on sets, where the sets are the ''vague'' representations of the state variables. So our driving agent might have a fuzzy variable for distance to the car in front and another fuzzy variable for current speed and wishes to determine a classification of this situation so that it can choose an action. You could implement a FSM testing for all possible values of these two variables, or alternatively, you could work out the Fuzzy set resulting from (''separation'' AND ''lead footedness'') and then map that output to an action.

quote: Original post by RajanSky
Neural Nets and Genetic Algorithms: I think they are definitely cool topics, but in most cases it''s really overkill. The one big advantage that these have over other algorithms however, is that they can learn and adapt.


That''s a misrepresentation of the facts. Learning can be applied to train an Artificial Neural Networks (ANN), either in batch mode (offline) or iterative mode (online), however a trained network is not adaptive. It is only through online learning that an ANN could said to be adaptive. As to GAs, they''re a search algorithm, nothing more, nothing less.

They also shouldn''t be grouped together like that. ANNs should be mentioned when discussing other classification/ function approximation methods... and GAs should be discussed when talking about search algorithms.

As I said above, there is heaps to learn about AI. You wont learn it all in 10 years of study... but you will learn a few techniques well in a year of study (and application). The best way to learn is to do some reading and then try and implement what you''ve read.

Good luck,

Timkin

This topic is closed to new replies.

Advertisement