Creating a Sensory Input-Based Monster AI, Part I

As a thought experiment I am putting together a generic artificial intelligence which I can use for bad guys/NPCs in a variety of different games. There are myriad paths I could follow in creating AI, so for right now I am going to concentrate on two inter-related tasks: awareness and morale. In other words, when does X become aware of another entity, and what does X do in response to that awareness?

For the purposes of this essay there will be two entities: a deer and a wolf. I will discuss the reactions of the deer.

The first step is to create a triggering event. In this case, proximity. Using whatever senses are available to it, somehow, at some point as the wolf approaches, the deer becomes aware of it. This could be something like a twig snapping, or movement in shadows, or wolf-smell on the wind. In any case, the first level of this system is Awareness.

Once the deer is aware that Something is out there, the next step is to determine what that thing is. It could be another deer, or a faun, or a human, or the wolf. Without making that determination the deer cannot react appropriately. It might run in terror from the faun, or stand still while the wolf attacks. So the second level of the system is Recognition.

Once the approaching entity is recognized, the deer can take the appropriate action; in this case, run in terror from the wolf. Or if the deer is protecting a faun, move to attack/distract the wolf while the faun flees. This level of the system is Reaction.

So: Awareness to Recognition to Reaction. Think of them as concentric rings centered on the deer. As the wolf enters these rings its proximity triggers different responses. These distances can be displayed as a sequence of numbers; for instance [20/10/5]. [Awareness/Recognition/Reaction].

Awareness will always be the largest number. Without being aware of something, the deer cannot either recognize or react to it.

Either recognition or reaction may be the next largest number, or they may be equal. In any case, neither of them may be larger than the Awareness number, although they may be equal to it.

So: [10/5/10] would be a “legal” description, but [5/10/5] would not.

Using this system a wide variety of behaviors may be put into place with little effort. The following are some examples:

[10/5/2] — Long-range awareness, medium-range recognition, short-range reaction. A semi-tame, slow-moving, not-too-bright animal. A farm cow, for instance. Knows you are there, knows who you are, doesn’t much care.

[10/5/10] — Long-range awareness and reaction, medium-range recognition. Guards at a gate. Something is out there, so immediately set out after it. Once they are close, it may be recognized and perhaps another action performed.

[10/5/1] — Long-range awareness, medium-range recognition, extremely short-range reaction. A bored, disaffected clerk at a store. Knows you are there, knows who/what you are, doesn’t do anything until you actually poke him in the shoulder.

[10/1/10] — Long-range awareness and reaction threshold, contact-range recognition. A rhinoceros during mating season, which charges anything it detects, and only stops when it recognizes “Ooh! That’s a train!”, or something of the like at extremely short range. Basically this is an unthinking reaction to the presence of another entity.

It occurs to me that this could be made less “broad” and more “deep” by changing to a two-level “awareness/reaction” and “recognition/reaction” system. For the purpose of simple- to medium-complexity games I like the three-level approach. In particular playing around with the distance between “recognition” and “reaction”, allowing for simulating different levels of intelligence or bravery, and startle-reactions, such as an enemy suddenly appearing well within the “reaction” threshold, causing a panic reaction; or a particularly slow-witted (think “drunk”) critter standing around gob-smacked while being charged by a bull.

Note that this AI system is for an “initial contact” situation, where another entity is first entering into awareness range, or has been outside of awareness range long enough that the “deer” has forgotten the entity was there. Reactions when actually interacting with another entity will be discussed in an upcoming essay.

Tumbling Down the Walls

This afternoon I took a trip back to the farm to enjoy a picnic and watch our barn get knocked down. After many years of entropy the thing had finally decayed past the point of usefulness, and into the realm of being a danger to those around it.

barn_1
Many years ago adjustments had been made to its structure to allow more storage space, and these adjustments had ultimately weakened the frame.

barn_2
Notice that the whole end of the barn is hanging in space, with nothing but the roof beams preventing it from tumbling down.

barn_3
This is the view from inside, showing how cock-eyed and beat-up the structure is.

barn_4
This beam, and the one it butts into on the left, are the only things holding the barn up at this point.

barn_5
Local demolisher-of-large-buildings Herbie Van Aiken provided the bulldozer and told us it wouldn’t take more than fifteen minutes to bring the thing down.

barn_6
Herbie lined up on the beam he said was the keystone of the structure and, after digging up some sod, gave it a push.

barn_7
I was looking for a position to take some good shots when I heard CRACK and got my camera up just in time to see the barn come down in a huge cloud of dust.

barn_8
The demolition took about five minutes.

barn_9
Another push on the main beam brought down the stubborn remnants.

barn_10
And all this without touching the silo or pump-house which share a foundation with the barn.

barn_11
My brother Kurt exploring the wreckage.

barn_12
And my mother finally has the view to the south she has always wanted.

Educational Spam

I receive about 35 pieces of spam a day, most of which are successfully filtered by the email client at my host provider, Modwest. Occasionally something gets through, usually Russian advertisements for discount electronics.

Got one today, however, which was a little different. The content of the message was as follows:

In a trice without warning the face of nature
grew sullen Black angry mouths, the clouds
swallowed up the sun The air was dense with
suppressed excitement The wind howled through
the long corridors and sobbed and whispered in
the secret recesses

Hmm. Not your average spam message.

A Google of the first line resulted in many many hits, most of which led toward spammed blogs and message boards, or people complaining about getting over-wrought, semi-literate poetry in their in-boxes. Again, nothing unusual there.

I was still intrigued, so I did a Google book search, which was a little more fruitful. Turns out this line is from page 12 of a book called My First Two Thousand Years, by George Sylvester Viereck and Paul Eldridge. It is a fictional autobiography of the Wandering Jew which was originally published in 1928, and is apparently still in print.

So now — although I am sure it was not the original intent of the spammer — I have another book on my reading list.

And I will leave the question of why this particular passage from that particular book found it way into an un-solicited email for another time.

Upcoming Martial Arts Stuff

This year Master Lee’s School of Tai Chi Praying Mantis and Tai Chi Jeung will be performing at the Grand Rapids Festival of the Arts on Saturday, June 3 from 7:00pm to 8:30pm. Pictures of last year’s performance (and others) can be found here on Master Lee’s site.

We have just received word that Midland Open Martial Arts Tournament will not be held this year. This is disappointing but not surprising; the tournament has been growing steadily smaller for the past few years. I imagine that the economy and rising gas prices played a significant role in this decision, considering several schools travel from as far away as Texas and Massachusetts to attend.

Oh, well… maybe next year. On the plus side, this means that I have a free Memorial Day weekend for the first time in about five years. That hasn’t happened in so long that I have no idea what I will do. Maybe spend the whole weekend sleeping on the beach out at Grand Haven.

More details about our Festival performance as the day approaches.