• Advertisement
Sign in to follow this  

Examples of interesting AI in games

This topic is 423 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want my game to come alive and the monsters should behave in manners not necessarily aimed at fighting the players in the most efficient and "intelligent" way, so I'm trying to find ideas for interesting behaviour/AI. I find this really does something for immersion.

A couple of examples worth mentioning, that are quite simple to implement but still managed to impress me:
Diablo II:
Zombies are not very aggressive - they will hit you if you step really close but not hunt you if you run away. If you hit them they will "hate" you though and will hunt you over pretty long distances.
"Fallen" like to attack in packs and are easily spooked: If any monster is killed close to them they will run away, but soon gain enough courage to attack you again.
Fallen shamans will raise dead fallen, and sometimes throw a fireball at the player. This makes for a nice little challenge for new players with only a few simple elements.
I especially like the fallen because they almost have personality, and it was a great idea to put them early in the game to catch the player's attention immediately.

Quake:
Ogres hurl grenades at you, and if you step too close they will pull out a chainsaw. This gives the player 2 options for fighting them:
1. Keep a distance and avoid the grenades.
2. Most effective but harder to execute is to get in close but back away when he pulls out the chainsaw - then step close again before he throws a grenade in your face.

Any other good examples?

Share this post


Link to post
Share on other sites
Advertisement
http://www.gdcvault.com/play/1021848/Building-a-Better-Centaur-AI


(inb4DaveMark)




In all seriousness: Watch some of the GDC Vault stuff that's been released for free, there's a TON of inspirational stuff in there.


I think this is a common situation where design overlaps AI creation quite a lot. Watch talks on how to design interesting encounters. Read articles/books/etc. on the same.

99% of your challenge is designing a cool mechanic and making it robust. The rest is just writing a bit of code (or building a bit of data, c.f. the Centaur lecture) that makes it work.

Share this post


Link to post
Share on other sites
Wow I think this was actually exactly the opposite of what I'm trying to do - are you trolling me :)
Anyway thanks for the link - there were some good points towards the end. And yes what I'm interested in here is in fact well _designed_ AI. I enjoy seeing interesting behaviour, where you can really observe that a lot of imagination and creativity has been put into the project. Whether this has been achieved through a grand behaviour driven framework or hand(hard) coded in a Think() method.
I think I'm still at the point where it's most effective for me to code specific behaviour types and expand them with parameters.
Perhaps I should give GW a try.

http://www.gdcvault.com/play/1021848/Building-a-Better-Centaur-AI


(inb4DaveMark)




In all seriousness: Watch some of the GDC Vault stuff that's been released for free, there's a TON of inspirational stuff in there.


I think this is a common situation where design overlaps AI creation quite a lot. Watch talks on how to design interesting encounters. Read articles/books/etc. on the same.

99% of your challenge is designing a cool mechanic and making it robust. The rest is just writing a bit of code (or building a bit of data, c.f. the Centaur lecture) that makes it work.

Edited by Polydone

Share this post


Link to post
Share on other sites
I didn't mean to use the link as a suggestion to use the architecture, sorry for the confusion. It just happens to have some good ideas on how to design things that I thought might be useful.

Plenty more stuff is on the vault and worth looking for - dig around, spend a lazy afternoon getting some inspiration :-)

Share this post


Link to post
Share on other sites
Yeah I know:) And there definitely are some good points - I especially like the idea of being able to define subtle variants of the same basic behaviour - something that might be hard to do without either more parameters than lines of code - or duplicate near identical code - in a hard-coded system.


I didn't mean to use the link as a suggestion to use the architecture, sorry for the confusion. It just happens to have some good ideas on how to design things that I thought might be useful.

Plenty more stuff is on the vault and worth looking for - dig around, spend a lazy afternoon getting some inspiration :-)

Share this post


Link to post
Share on other sites
I've always enjoyed the AI in F.E.A.R. The AIs tactics felt dynamic and exciting...haven't played it in a while but I assume it still holds up. There is a great paper on how they achieved it which I really enjoyed reading. 3 states and a plan

Share this post


Link to post
Share on other sites
Half Life 1 had some amazing AI features for its time, most of which didn't manage to be showcased appropriately.

There were multiple factions - civilians, military, aliens and assassins - who would all attack each other.
Inside the alien faction, there was a whole food chain / hierarchy of hunters and prey. You could watch an alien carnivore track and hunt alien herbivores, who would flee from it.
There would be aliens brave enough to take on a human, but would flee from a larger alien.
Some creatures had strong vison, while others had weak vision but a strong sense of smell. Game characters would leave smell markers around the place, corpses would especially smell, and level designers could leave scene trails for the AI to pick up on.
You could watch an assassin vs military firelight and then watch the smell of the blood attract scavenger aliens.
The military also had a squad system, which allowed members of a squad to share information, such as the last known location of the player. There were also some clever hacks, such as 75% of the time looking for the player where they were last seen, and 25% of the time just cheating and searching for them where they are (so they seem smarter).

Unfortunately, despite the complexity in the faction /category/hierarchy system, the squad system and the multi-sensory system, you didn't see its emergent behaviours too much in the game... And when you did, it just felt like a scripted sequence. The opposite was true too - and a lot of what you thought was cool AI were scripted sequences.


Another example I really liked were the wild dogs in STALKER. If there's only one or two around, they will keep their distance from you and act scared... But once there's enough in the one area, they will all attack you. Usually after killing one or two, the rest will run away with their tails between their legs. IMHO if you also occasionally saw two dogs fighting each other it would reinforce the feeling that these are feral, wild, desperate creatures.

Share this post


Link to post
Share on other sites

I've always enjoyed the AI in F.E.A.R. The AIs tactics felt dynamic and exciting...haven't played it in a while but I assume it still holds up. There is a great paper on how they achieved it which I really enjoyed reading. 3 states and a plan

 

However, a lot of what they achieved isn't because of the GOAP architecture. In fact, the consensus is that GOAP isn't all that great. Jeff Orkin himself doesn't recommend it anymore.

Share this post


Link to post
Share on other sites

a few examples of AI behavior in Caveman 3.0:

 

avians have their own AI, mainly due to the complexity of realistically modeling diving attacks from the air.

 

the game features a number of basic ai types:

defend location

suicide attack

tame-able animal

pack predators

non-pack predators

followers

pets

thieves

bands of thieves

neutral NPCs

hostile NPCs

combo AI - defend if stronger, flee if weaker.

 

the game also has spontaneous NPC behaviors such as:

* NPCs trying to become your follower

* NPCs engaging you in dialog

* followers wanting to join your band

* hostile messengers delivering threats

 

common AI behaviors include:

reacting to being cornered when attempting to flee.

collision avoidance and recovery, as well as A star pathfinding.

fleeing when wounded.

animals flee from fires, and will not approach targets near a fire.

the "fight or flight" response to nearby threats

responding to incoming missile fire

resting when fatigued

 

predators eat kills when hungry, or hunt if there are no kills nearby. different species of predators will fight over a kill.

 

when idle, animals follow the "graze" behavior, which transitions at random between stand,wander, flock, and migrate. 

 

wild dogs will come up and eat food you drop for them. but won't let you get close at first.  over time they will start to hangout nearby.  eventually they let you approach and feed them.  and finally you can tame them and get a pet.

 

pack predators will only attack a target if there is enough meat for the whole pack to make it worthwhile. they will attack larger targets if the combined strength of the pack is greater than that of the target. 

 

Avians conduct realistic diving attacks, adjusting the dive angle to result in intercept of the target, and timing the attack so the blow falls when they are directly overhead. that was a bit tricky - norton bomb sight type stuff.

 

Avians also have special AI for dealing with flying up and over cliffs. 

 

nearby followers and pets can be issued orders at any time. orders include:

none - do normal AI

wait here

goto

follow

attack

maintain distance

flee

set target

use stealth

stop using stealth

 

Cavemen under AI control automatically use missile weapons first if available, and try to maintain distance.

 

Pets will hunt nearby weaker animals, so your pet dog occasionally takes off after a rabbit, or chasing birds - making them scatter like startled pigeons in the park.

 

In general, the combo of "fight or flight" behavior, and "takeoff" and "land" behaviors for avians makes for some very realistic "emergent" AI behavior.  Run up to a flock of birds and watch as an explosion of birds all take off at once - just like the real thing.

 

pets and followers automatically enter and exit caves and caverns, and board and disembark from rafts as needed to follow you around - a small but important detail.

 

The game lets the human player control an entire band of cavemen, similar to a household in The SIMs. At all times, one band member is controlled by the player, and the rest by AI. TAB lets the player toggle between band members.

 

Band member AI does all the appropriate stuff mentioned above - such as reacting to being cornered, and responding to incoming missile fire. 

In addition it does other things like:

raise the alarm if hostiles are detected.

automatically exit a shelter if following some orders or hostiles approach.

spontaneously engage nearby NPCs and other band members in dialog

stop what they were doing (making an arrow, etc) if hostiles approach.

 

other AI behaviors in the game:

animals and NPCs entangled in nets will try to escape.

NPCs may raid your storepits

captured animals will try to escape.

hired warriors will demand pay.

nearby hostile bands will occasionally raid your camp.

nearby friendly bands will occasionally bring you gifts.

allied bands may call for aid in attacking a nearby hostile band.

friendly bands may invite your band to join their village.

nearby NPC bands that you shakedown for tribute may occasionally attack your band as payback.

if you do not maintain good relations with a follower, they will leave.

if you do not maintain good relations with a pet, they will run away.

Predators that can climb trees will follow you up a tree if you climb a tree to get away - forcing you to jump to the ground.  come to think of it - i should make NPCs climb trees to get away when appropriate.

Nearby hostile bands may return to attack you if you do not leave the area after having been warned to do so.

 
I started to add freewill to the game as seen in The SIMs - making them automatically eat, drink, explore, gather resources, craft, hunt, etc. but i decided it was basically playing the game for the human player. so i never finished implementing it.
Edited by Norman Barrows

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement