Advertisement

Goal-oriented AI

Started by October 20, 2006 10:11 AM
9 comments, last by Alrecenk 18 years, 1 month ago
I get so frustrated at all these programmers trying to make AI way too complex. Using machine learning, Classification trees, and, dare I say it... ALGORITHMS? Here's what I say: make some variables representing characteristics in your character, i.e. joy, hunger, bravery, bowel capacity, whatever floats your boat. Then... make some goals in other variables and assign them to objects, characteristics, and priorities. Whenever a characteristic is below a level, say if joy is 0-1 and it's below .25, go to the assigned object(s), like a shiny doodad, and adjust your joy accordingly, but ONLY if the priority is higher than what he's already doing. It's as simple as that. Same (if not better) results as whatever else there is but with far less work. Another thing I'd like to address: RANDOM AI IS NOT GOOD AI! Characters have to be predictable (i.e. they hole up in their barracks, they go to bed at night, etc.) just like human players would be.
But that won't work. AI is supposed to be intelligent.

Say your character will die if it doesn't eat in the next two turns. There are units of food within two turns distance away, one guarded by two weak enemies, one guarded by one super strong enemy. Which does it choose? The second one? Because there are less enemies? Or the first one because the enemies will be weaker and easier to overcome? The point of AI is to make a decision based on the inputs which may always be different.

Plus, humans are not predictable, everyone has their own mind and will do something differently. Someone might take cover over there and snipe, but someone else might rush in with grenades, guns blaring.

The point of these ALGORITHMS is so that your AI is not completly random, it gives your AI a set of rules to work from. Take Half Life 2's AI for example, the mapper lists movement points, cover points etc. in the map, and the AI decides which of these to goto depending on its health, the position of the player, position of teammates etc.

Plus, AI is able to learn for itself depending on the implementation. So do you want to sit there writing out endless code everytime you add something that the AI will deal with? Or do you just want to leave it overnight learning these things for itself?
Advertisement
AI is complex, although game AI is usually simpler than academic AI.

From my current (although limited) understanding a simple but effective approach for game AI would include the folowing:

1) Steering Behaviors: If your AI ever does any movement it will need to do so intelligently
2) States: States are the simplest way to solve most AI problems
3) Goals and a means of selecting the current Goals: I like the Fuzzy Logic approach to goal selection, it seems simple, effective, and -most importantly of all- tweakable. An AI is always going to need tweaking after testing. Also, the rules for determining the desireability of a goal can be completely modeled with Fuzzy Logic.
4) Memory: An AI that cannot remember what happened 5 seconds ago is bound to make many obvious mistakes which players will quickly learn to monopolize.
5) Strategy: Some games have a complex set of rules and for an AI to play such games effectively it must have a solid model for choosing the optimal path (which should affect goals) along these rules. How this is done is very game dependant and it can get complex.
Programming since 1995.
Quote: Original post by Smit
The point of these ALGORITHMS is so that your AI is not completly random, it gives your AI a set of rules to work from. Take Half Life 2's AI for example, the mapper lists movement points, cover points etc. in the map, and the AI decides which of these to goto depending on its health, the position of the player, position of teammates etc.


You've pretty much just described here what the OT (original troll) outlined. =)

To the OP, different tools for different tasks. As another poster pointed out it's also important to make a distinction between game AI and academic AI. The former often resembles the algorithm that you outlines, while the latter often digs deeper into domain specific problems like machine vision and the like.

The importance of academic AI to game AI is that it explores the boundaries of AI science. While I typically work with goal oriented systems as you described, there are many nuggets of wisdom in the other algorithms that can be the perfect solution to a game-specific problem.

As for randomness, yes completely random is often bad in games. But this depends on the specific game and the problem being solved. Par instance, in a sniper game if AI units do not frequently stop moving for brief amounts of time the core game mechanic of sniping is not being very well reinforced by the AI. Similarly, in a stealth game one should make non-aggro'd units behave predictably so that the player can plan their ambush.

However, consider a RTS AI. In such a system randomness is very important because you do not want to present the player with exactly the same reactionary/predictable responses. The goal of an RTS AI is to surprise the player and keep them on their toes; as such randomness plays a very big role. Similarly, in an FPS you may or may not want perfect predictability depending on the design goals.

The trick to AI is to not make outrageous one dimensional claims about "what defines AI". AI is intimately connected with game design. What defines the game AI is therefore as varied as what defines the game. Sure goal based systems are perfect solutions in some games, they are horrible solutions in others. If ever you think you've found the magic AI bullet, you're wrong.

-me
<< dare I say it... ALGORITHMS? >>

I don't think you even know what the word means.
Quote: Original post by crentgames
I get so frustrated at all these programmers trying to make AI way too complex. Using machine learning, Classification trees, and, dare I say it... ALGORITHMS?

Here's what I say: make some variables representing characteristics in your character, i.e. joy, hunger, bravery, bowel capacity, whatever floats your boat.

Then... make some goals in other variables and assign them to objects, characteristics, and priorities.

Whenever a characteristic is below a level, say if joy is 0-1 and it's below .25, go to the assigned object(s), like a shiny doodad, and adjust your joy accordingly, but ONLY if the priority is higher than what he's already doing.

It's as simple as that. Same (if not better) results as whatever else there is but with far less work.

Another thing I'd like to address: RANDOM AI IS NOT GOOD AI! Characters have to be predictable (i.e. they hole up in their barracks, they go to bed at night, etc.) just like human players would be.




Maybe you need to rethink your understanding of the term 'algorithm'.

Its all 'algorytmic' -- all those more complex tools and also what you describe. Would you discard A* because its an 'algorithm' ???

Planners and other such types of 'algorithms' are needed when game situations get more complicated (more factors influencing results) and the desired result is to be more than the simple 'sight the enemy and charge'. Many games that pretend to be 'smarter' have been more of a case of choreographing scenerios and clever preplacement. When game objects can plan better and assess situations and make longer term decisions AND do it in any present situation, then the players will get a more realistic and interesting computer opponent (and more intelligent computer run teammates that wont do such absurd things).

Sorry if you dont like complexity, but real AI isnt simple.





Advertisement
Quote: Original post by crentgames
It's as simple as that. Same (if not better) results as whatever else there is but with far less work.


I don't really think it is as simple as you think it is neither that it will work well.

You have a lot of unclear points in your description. Try to outline your system for a specific case on paper by clasiffing exactly how it will work (use peudocode if you like or diagrams) and I think you will notice that you will have to keep adding more and more rules to it to make it look good, making your system not so simple after all.

Basically, what I'm saying is that you are oversimplifying things and ingnoring a lot of aspects of AI behaviour.

[Edited by - Radan on October 21, 2006 10:11:17 AM]
-----------------Always look on the bright side of Life!
Quote: Original post by crentgames
I get so frustrated at all these programmers trying to make AI way too complex. Using machine learning, Classification trees, and, dare I say it... ALGORITHMS?

Here's what I say: make some variables representing characteristics in your character, i.e. joy, hunger, bravery, bowel capacity, whatever floats your boat.

Then... make some goals in other variables and assign them to objects, characteristics, and priorities.

Whenever a characteristic is below a level, say if joy is 0-1 and it's below .25, go to the assigned object(s), like a shiny doodad, and adjust your joy accordingly, but ONLY if the priority is higher than what he's already doing.

It's as simple as that. Same (if not better) results as whatever else there is but with far less work.

Another thing I'd like to address: RANDOM AI IS NOT GOOD AI! Characters have to be predictable (i.e. they hole up in their barracks, they go to bed at night, etc.) just like human players would be.


along with agreeing with all of the other responses, i believe that the only concept that you've got right is that 'goal-oriented' and 'ai' should be in the same sentence.
the obvious problem that occurs with ai like that (hastily made, hastily implemented) is it doesnt look good. there's no fuzzy logic, no behavior, just predictable weighted movements; like turning on and off a TV. Yeah sure it works but who cares? AI needs to be diverse, challenging, and most importantly, look NATURAL; people do not always make perfect decisions, and sometimes it works out sometimes not.

slapping a load of weights and sneering at sophisticated AI is the height of naitivity.
@crentgames

you talk about a simple human psyche simulation. It is not a problem to simulate a psyche without a logic - and there's your answer - simplicity. Try to simulate both human psyche and logic, try to make your characters more realistic - eg to be able to feed their ego with cognitions. You will see that you can't make it so simple.

[Edited by - Adrian Velcro on October 22, 2006 6:35:41 AM]

This topic is closed to new replies.

Advertisement