#### Archived

This topic is now archived and is closed to further replies.

# Using Objects to Represent Knowledge

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

## Recommended Posts

The nature of this idea is the same as using objects to represent . . . well, objects, such as guns and boxes. You give it properties and methods, and it will basically run itself. The game world is really just a sandbox; objects themselves do most of the work. It occurred to me that this idea might be carried into knowledge representation. Memory is something every AI programmer struggles with at some point, but if you used objects to represent bits of information, you could effectively emulate both short- and long-term memory, and decide how it''s used. These objects would be data containers only, unless you can find some clever reason to give them methods. (Actually, it may be possible to emulate an entire mind using these objects, but I haven''t thought that far yet.) I''m sure this technique has been used in chatterbots -- and perhaps in the confines of universities where they build huge AI''s to duplicate human thought -- but I haven''t seen any examples myself. You can group this information anyway you please, build an index for faster recursion, create a database of "common" knowledge that everyone knows, and so on. You can edit knowledge on a per-character basis, create blocks that supercede common knowledge (or anything else in the hierarchy), etc. How you manipulate it is irrelevant. Anyway, I''d like to hear what everyone else thinks about this, flesh the idea out a bit. It''s one step on the long road to creating a truly convincing game world.

##### Share on other sites
Who cares about convincing, why not make it FUN first?

void Signature(void* Pointer)
{
PObject(Pointer)->ShowMessage("Why do we need so many pointers?");
};

##### Share on other sites
Erm, do you mean, like, when the player learns a piece of info a physical represenation of it gets put into an inventoryrepresenting his memory? Or am I just completely confused?

##### Share on other sites
The current problem with the suggested approach is the overhead of maintaining distinct stores of knowledge/information and the challenges of retrieving and distributing their contents at appropriate junctures. Games are simulations, and therefore do not have to mimic the real world precisely. Until we have processing power to spare, simply modeling our processes after the way we perceive things to occur in the real world will not be particularly effective; consequently, we work backward from a desired result to a given model.

AFAIK, the colloquial solution is to store all information in a knowledge base, implement some sort of collection of indices into the KB to represent what a given character knows, and work from there.

##### Share on other sites
It''s definitely tricky. When you talk about items, I''m inclined to envision a sort of inventory screen you can go to and see all your worldly knowledge displayed. With a larger, more complex game that sort of thing might become a little unwieldy. In Fallout there were conversations trees, and you could "unlock" new dialogue options by gaining new information. When you talk to Laura in the Cathedral, she offers pleasantries and is offended by off-color comments, but you can''t get anywhere by talking to her. Once you had spoken to the Children of the Apocalypse and learned that Laura is a spy, you are told to give her a code word and enlist her aid in saving the world. Next time you meet, you have a new dialogue option, and by choosing it you can advance the conversation in exciting new directions.

So, how sophisticated do you want this knowledge base to be? Is it enough to have a big list of "KnowsInfo762=true" type switches, or do you actually want to build a network of information that includes things like NPCs'' maiden names and other info that is essentially meaningless to gameplay? I''d say that making certain information into "keys" that unlock behavioral "doors" would be sufficient.

If that''s what you mean by "using objects to represent knowledge" then by all means do so, but remember that there''s no sense in getting fourteen different "The capital of France is Paris" items, and if there are fourteen different ways to learn this, then that''s just what might happen. Maybe switches would be the way to go.

To complicate matters further, you might want to make it matter where the character learned something, so perhaps a "KnowsInfo762=X" system, where X is the number that corresponds to the original source of that information, might be more appropriate, if a little bit bigger.

##### Share on other sites
How would you make this objects interact with each other? How would you make them work as , say, a simple mind?

You can store information in a millon of cool forms, but how do you put it to work is the key.

[edited by - owl on March 25, 2004 11:51:40 PM]

##### Share on other sites
I think when he says "objects" he really means "classes". In other words, he''s saying: use a different instance of a class to represent each bit of information that the character knows about.

Phlegmatic Weasel

##### Share on other sites
I think I brought this idea up months ago when we were discussing how to take RPGs away from a totally numeric-dependant system. My suggestion was to represent characters as a set of all of their characteristics, defined by some binary representation.

Vash
+ Loves Red
+ Goog with guns
+ Agile

So, since I already thought up a similiar idea, of course I''d like this idea, to have a boolean list of knowledge.

From a programming standpoint, I''m not sure what advantages there are to having as part of a character''s instantiation, a set of member pointers to classes that have no inherint features. To that I''d either suggest just an enumeration and an array, or an array and a set of preprocessor macros.
#define CHARACTER_ATTRIBUTES attr_list[16]#define LOVES_RED( x ) ( x->attr_list[0] & 1 )class Character {  CHARACTER_ATTRIBUTES;};void b() {  Character * Vash = new Character;  if LOVES_RED( Vash ) explode_violently();}

I hope that helps.

##### Share on other sites
http://www.cee.hw.ac.uk/~alison/ai3notes/chapter2_4.html#SECTION0040000000000000000

try here i think it would help

i was a slight different version for frame however which is cross with neural network, each frame is like a neuron and link beetween object are appraise like neuron like, this building relationship between object while experimenting the world and mimick implicit knowledge, the cool things it's more readable than ANN, then more controlable since all neural frame are define
but to work well you must have an inline supervising system, which score positivaly or negativaly action taken as a feedback

if the agent take a bad action it would backpropagate the error or the rewards, use alslo some context neural which feedback the output to input but it would became more complexe to control the learning but the agent would have more temporal capacity
oh! i forget the first layer is a common hidden layer (no name blank frame aka normal neuron)

however i have just poorly implement since i haven't a good test space, and i'm not a specialist of ai or programmation, but it's very promising, since each neural frame act as an attractor, i have heard of counter propagation that would ameliorate the sys...

EDIT: the beauty of this system is that it automatically discard irrelevent knowledge by following weigth of link according to context, an idea i have not test is having another system based on explicit knowledge (expert? A*? whatever you name it?) which would use the activate frame by context, maybe they would have their parameter as a frame too, in order that the system create is own thought process, the implicit system asting as a context sensitive filter

>>>>>>>>>>>>>>>
be good
be evil
but do it WELL
>>>>>>>>>>>>>>>

[edited by - neoshaman on March 26, 2004 10:05:53 PM]

##### Share on other sites
quote:
Original post by Tom
The nature of this idea is the same as using objects to represent . . . well, objects, such as guns and boxes. You give it properties and methods, and it will basically run itself. The game world is really just a sandbox; objects themselves do most of the work.

Perhaps:

type: hates
property1 = Jason

object: sunlight kills vampires
type: kills
property1 = sunlight
property2 = vampires

Interesting, extremely flexible, even if not scripted, and can create complex webs with just a few knowledge types. Cool. This of course requires a world which will respond appropriately to whatever knowledge types there are. This also assumes verbs exist and therefore you need to write the method(s) but I believe even a data container contains a method(the equal sign, which would be equivalent to the verb ''is'').

What I''ve written is actually pretty simple in semantic information processing, but such simple sentences could actually describe a lot. What''s important is that your world is fully described before you start writing the language. If you write that
kill(obj1, obj2) = reduce HP to zero OR make NOT alive OR make dead etc.
and suddenly change the meaning of ''alive'' or stop using hit points you will be f***ed, you may need to implement words having different senses(like kill[1] = HP = 0, kill[2] = make dead, etc.

Now the problem is overintegration if you have an incompatible weapon/magic system planned, particularly if you don''t want to be forced to use an open system. Although that might be a problem, imagine we only have a set number of hard-coded spells that aren''t a part of this system(ie not described), an NPC could look at what''s available and the ai system could run a test by copying the objects, running the spell on the copies, and sending back the changes made and that should be available in many AIs which makes decisions or predictions.

• 32
• 12
• 10
• 9
• 9
• ### Forum Statistics

• Total Topics
631349
• Total Posts
2999473
×