Advertisement

The annotated cellar: an experiment

Started by January 20, 2002 07:42 PM
32 comments, last by bishop_pass 22 years, 10 months ago
With regard to the thread I started on annotated objects, I decided to start this thread for a more hands on appraoch and discussion of the concept. This would be in part to explore the advantages and disadvantages of such a system within a more concrete testbed. For that testbed, I'm envisioning a cellar in which our intrepid adventurer and his sidekick have just fallen down a collapsing set of stairs which lead from a trapdoor above into the cellar which they now find themselves. Unfortunately, the trapdoor slammed shut and mysteriously latched itself shut after they pick themselves up off the dusty floor of the cellar. Elsewhere in the cellar is a secret door and passage leading to unknown areas. Ok, the point is to get the trusty sidekick (NPC) of our adventurer/player to exhibit behavior which is entertaining, reasonably realistic, possibly helpful, and consistent by sensing the annotations of the environment. Actually, I envision different NPCs to be paired with the player, and each NPC picks up different annotations to different degrees to drive their behavior. Entering the cellar with a different NPC will yield different results. Within the context of a text game utilizing a simple text parser, what kind of gameplay and entertainment could be created? For purposes of this experiment, if anyone wishes to make suggestions and provide input, assume very inefficient data structures for an implementation. The purpose here is not to optimize and hone code, but to get the necessary content of the data structures right. Think in terms of C code and simple fixed sized text arrays which contain the data of the annotated objects. To elaborate further on the cellar as I envision it (please help out here, this is community discussion) the trapdoor cannot be reached from the floor even if jumping. There should be a closet in the cellar, hopefully containing a ladder of chair that one could stand on. There might be a broom around which one could grab and poke at the trapdoor, but this might be futile, because it is latched. Somewhere there is also a secret door. Assuming the player does little, what kind of problem solving can we get the NPC to do? What of his remarks about the situation? Is he nervous, cocky, resourceful, or stupid? His personality should play a role as he senses annotations from the environemnt, only being perceptive to those annotations which are compatible with his personality. Annotations about objects can contain not only their suggested usage, but remarks the NPC might make as the situation progresses. The idea is to embed the relevant facts, remarks, and story snippets into the objects. Keep in mind that the cellar and its elements such as the walls can also be annotated. Chunks of time can be annotated, as well as situations that are easily recongnizable by a scanning algorithm which knows what to look for. So, pitch in if you want to help or discuss. Keep the code quick and dirty for prototyping purposes. The idea is to make the concept work, not build robust code. ___________________________________
Edited by - bishop_pass on January 20, 2002 8:59:12 PM
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
bishop_pass,

I may frequent gamedev, and I may take CS classes, but I''ll not claim to be a coder. I like the annotated objects idea in theory but haven''t the first idea how to implement. Perhaps this topic is better suited to one of the code-centric boards instead...

---------------------------------------------------
-SpittingTrashcan

You can''t have "civilization" without "civil".
----------------------------------------------------SpittingTrashcanYou can't have "civilization" without "civil".
Advertisement
The simplest solution I can see would be to build a kind of 'game tree', rather like those used in chess AI. Simply put, the computer builds a tree from all the possible actions it can take at one point and picks a path that leads to a potential solution.

I would build the tree in a level order fashion - the AI will implement the first 'potential' solution that arrives, but may (or may not, depending on some initiative stat perhaps) continue to think of new solutions in case the earlier solution fails. Intelligence can be modelled by how far down the tree the AI will go.

e.g AI starts building game tree. Immediately, the character's own ability to jump is found, and so the AI tests this. However, the trapdoor is too high. The AI continues to try and jump for the trapdoor, while it explores more of its options.

It then comes across it's own ability to shout. The AI character stops jumping and shouts for help. No help comes, so the AI starts parsing more of the tree, still calling for help in the meantime in case some should arrive.

After parsing a couple of levels into the tree, the AI realises that it can push a barrel under the trapdoor, stand on it, then jump. So the AI tries this, but it is still too high. So we must progress much further into the game tree for a solution.

Eventually, after some calculation, the AI realizes that if it can light a match, it can detect the secret door by walking close to the wall.

The secret door would have to broadcast it's existence even before it is detected for this to work. However, in order to be able to use the door, you need some way of 'detecting' it - in this case, 'Detect secret doors' is a property of the match.

Each property of the items could have a value associated with it which describes how obvious that property is. The secret door has the obvious properties of 'Open' and 'Close' etc. but detection would be fairly obscure. Likewise, the matches property of 'illuminate' might be fairly obvious, but it's ability to detect secret doors requires a bit of lateral thinking. This should be built into the tree building algorithm, so the AI will build the tree for the more obvious solutions first, and if it fails to find a working solution with this method, it abandons that tree and starts again with the next most obvious solutions. How deep into the tree the AI parses, and how many obscure solutions it looks at may depend on various intelligence/personality parameters. So a stupid AI may not go as far as the Light Match->Explore Wall->Detect Secret Door->Open Door route, and may just end up shouting for help until it arrives....

Of course, this would no doubt be crushingly slow for all but the dumbest AI agents in most situations, certainly for cluttered rooms with lots of objects, but you did say you weren't too fussed about performance...


Edited by - Sandman on January 21, 2002 9:39:07 AM
Hmmm... Not really

The speed problem isn''t there. Like you said, a smart AI will try the simple tricks first, but it might take a while to find an advanced solution.

So, I think you should limit the amount of "steps per frame" for the AI. It only has a certain amount of time to work on its tree, and then has to suspend in order to let the player act, and let the graphics be updated. Then, when it is its turn again, it continues to work on its tree...

So, a complex solution like the light-match-to-find-secret-door would most likely take a while to find, but will not lag the game

-Maarten Leeuwrik
"Some people when faced with the end of a journey simply decide to begin anew I guess."
quote: Original post by SpittingTrashcan
bishop_pass,

I may frequent gamedev, and I may take CS classes, but I''ll not claim to be a coder. I like the annotated objects idea in theory but haven''t the first idea how to implement. Perhaps this topic is better suited to one of the code-centric boards instead...


Well, I would prefer to see it stay right here. I posted here for a reason. The people here are familiar with the idea through the other thread. Too much traffic in the Game Programming Forum would likely create conflicts or it would simply get buried. Besides, I know for a fact that there are several talanted programmers in this forum, and several posted in the other thread.



___________________________________

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
quote: Original post by Sandman
The simplest solution I can see would be to build a kind of ''game tree'', rather like those used in chess AI.


I haven''t been thinking in terms of trees at all. Either I haven''t thought it out yet, or I am seeing a completely different way to do it. I could possibly see a tree being useful to model search for a complex sequence of actions, but then again, the purpose of the annotations is to provide the solution to the NPC in the first place. In other words, the game designer has given direction to the game actors just like a movie director might. These directions are ''note-tagged'' on the objects themselves. I see the search issue more being a case where the NPC needs to make a decision between several objects which are presenting themselves and their associated scripts, or the NPC needs to try each one in turn.



___________________________________

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
Advertisement
Let's take the broom as an example. The following are quick and dirty notes, subject to revision.

Broom : use me to...
  • Sweep away clutter.
  • Prod an object from a distance. (attention getting)
  • Topple an object from a distance.
  • Poke an object from a distance. (weapon oriented)
  • Push an object from a distance.
  • Swat or whack an object. (weapon oriented)
  • Sweep away cobwebs.


Now, each of these items can have extra notes, qualifiers, suggested character dialogue, suggested character direction, required character intelligence, etc. The last one, intelligence follows on the Affordances idea mentioned in the other thread.

Now, the trapdoor has its own set of suggested actions. One of them would happen to be:
  • Push on me to open me.


If the goal is to get the trapdoor open, then the trapdoor is suggesting a solution for that goal. It is quickly obvious though that pushing is not possible with one's hand. So, hopefully, our NPC is receptive to the suggestions being put forth by the broom.

Now, if we look closer at the data which accompanies the broom annotation, we might have the following:

Push an object from a distance.
  • For the loyal sidekick, intelligence > 5: Before doing, say, "Sir, perhaps if we pushed on the [OBJECT] with the broom?"
  • For the independent and brash, intelligence > 5: Do it!



___________________________________



Edited by - bishop_pass on January 21, 2002 1:21:25 PM
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
Right... You''d better also figure out a way to tell the NPC what to do

In this case, perhaps assign "leave me" to the cellar.

Otherwise, your NPC might simply walk through a street, see a door, see a broom, and start knocking the broom against the door for no serious reason...

Mwa...

"It''s not my fault!!! They made me do it!!! The door and the broom are EVIL!!!!"

-Maarten Leeuwrik
"Some people when faced with the end of a journey simply decide to begin anew I guess."
Let''s assume that objects suggest how to accomplish goals, but don''t create goals for the characters except under certain conditions. The character, operating with certain goals in mind, simply taps into the knowledge of the annotated world to see how to accomplish the goals.

However, certain annotated objects, events, and places can suggest goals to characters. There could be a map of Russia hanging on the wall in the cellar. It might be annotated like this:

Map of Russia:
  • For anyone with intelligence > 5: Inspect me to get informed about Russian geography.
  • For scholars, cartogrpahers and the curious: Inspect me to get informed about Russion geography on a whim. While doing, say: "My this is an extraordinary map. What an exquisite piece of work this is."


So, if the NPC in question already has the goal to get informed about Russian geography, he might use the map. If the NPC does not have the goal of getting informed about Russian geography, then, on a whim, he may still walk over and inspect the map if the personality traits of the NPC define him as a scholar, a cartographer or a curious individual. Once again, the annotations are acting as cues from the director/author for behavior. In order for an NPC to act on whim, it would be necessary that he not be in a situation requiring attention elsewhere. It could be that the NPC does not determine the existing situation of being in the cellar as terribly serious, freeing him up to act on whims. So, we might have the player character a little concerned about the current situation while the player''s NPC sidekick is over studying the Russian map expounding on its virutes: "My this is an extraordinary map. What an exquisite piece of work this is.".

Notice that this ties in with NPC personality traits. An NPC could be manually defined to have certain interests, fears, and other traits. Or, the computer could dynamically and automatically create NPC characters with certain traits which then play off of certain annotations of the objects in the environment.


___________________________________

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
It seems to me that a _lot_ of annotation would be required to really gain any advantage over scripting since you have to account for many possible interpretations of an object. This suggests that some kind of organisation is in order.

So for the map of russia we might have :
- paper (which is a high-level annotation)
- map of russia (learn about ''geography of russia'')

For ''paper'' we then have (stored in one place) :
- flammable (light me)
- able to be written on (write on me)

Additionally, it might be good to keep a knowledge base with each NPC. Knowledge of ''paper'' would provide access to the paper sub-annotations, while other NPCs might just see a map (or even just a drawing if they were not familiar with maps). Not sure if this is getting too complex though.

This topic is closed to new replies.

Advertisement