- NPCs' goals are stored in a linked list. Each NPC has their own linked list. Each goal has a priority and the goals are processed according to that priority.
- NPCs can receive messages through a string that is sent to them.
The reason I chose strings is that there could be a variety of types of messages that could be sent and as long as I'm consistant the messages could be very powerful. The string is broken up into seperate words and then processed accordingly.
This tells the NPC who receives the message that NPC number 0 killed npc number 2. This may cause an NPC that is nearby to react this message by maybe avenging the NPC's death or maybe calling for help. There are many possibilities here. Messages of footsteps, smells, anything like that could be sent.Ex: "<npc> 0 <action> kill <target_npc> 2"
- Npcs can add things to their database of knowledge.
They are kept in a linked list of strings. These work similar to the messages.
The details of how the strings are arranged is not too important as much as the fact that I think strings would make things easily processed.Example: "<item> broadsword <location_x> 100 <location_y> 30 <location_z> 55"
- Also NPCs and the player can ask about any part of a string in other NPCs' knowledge-bases. For instance an NPC could ask about the " broadsword" the NPC could tell him everything he knows about that item. An NPC could, of course, lie or choose not to tell. There is also a number associated with each piece of knowledge that indicates how secret the knowledge is.
- Npcs can buy items from each other If an NPC has a goal BUY, he will look for a merchant (every NPC has an occupation) that deals in the type of thing he wants to buy (there's food, drink, weapons, etc) and will look for the nearest merchant. Then the NPC will GIVE that NPC the cost of the item and go toward that NPC and send him a message that he wishes to buy a certain item. That NPC will use the GIVE action to give the item.
- Also, I am thinking that each goal will have a list of attributes that it can potentially increase/decrease. For instance a STEAL goal could potentially increase wealth but decrease reputation. A EAT goal could potentially increase the food attribute... In essence an NPC would choose a particular goal based upon what he/she wants to increase (food, reputation, etc). I'm not sure of all the details yet though. This is the abstract version of the idea
NPC Interactions
I've been working on some NPC AI stuff that Wavinator & I have discussed before. Here's what I have going so far:
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Ok. I read your other topic and was very intrested. So you plan to do this in 3D? That will be quite an undertaking for the AI. How many NPCs will there be? Another suggestion: don''t use a linked list of strings for knowledge representation. Instead you should try a semantic net with strings which is a form of a linked list. Each element would have multiple links and a descriptor before each link. The descriptor could tell you if the thing it linked to was a characteristic, an example, what it is, etc. Please don''t flame me if you don''t like my idea.
quote: Original post by Puzzler183
Ok. I read your other topic and was very intrested. So you plan to do this in 3D? That will be quite an undertaking for the AI. How many NPCs will there be?
Yes, I am thinking of implementing it in 3D. I wouldn't have to, but that's my plan. I am doing this now using a 2D environment as a testbed though.
I'm not sure of the number of NPCs. I am thinking less NPCs each highly detailed and intelligent may be better than a whole lot NPCs. Fewer NPCs would mean less resources and I think it might be more interesting for the player 'cause the player would be able to remember the NPCs he meets and treat them as individuals rather than a mass of nameless NPCs.
quote:
Another suggestion: don't use a linked list of strings for knowledge representation. Instead you should try a semantic net with strings which is a form of a linked list. Each element would have multiple links and a descriptor before each link. The descriptor could tell you if the thing it linked to was a characteristic, an example, what it is, etc. Please don't flame me if you don't like my idea.
I wouldn't flame you for a suggestion!
Thanks. I haven't read much about semantic nets but now I believe I will take a look at them.
A CRPG in development...
Need help? Well, go FAQ yourself.
Edited by - Nazrix on December 24, 2001 9:53:25 PM
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Just to let you know, my description of a semantic net may be different than what you find. The way I have it set up in memory is my way of doing. I like your quality instead of quantity thing. If you do use semantic nets, you have to set one up for each person, and I think you might also want to set up a community one for the latest news. Oh and one other thing: if you decide 3D is too complex, please email me at puzzler183@hotmail.com so I can assist you with artwork.
Another thing: to save space so you can have more NPCs, you might also set up a common sense network that everyone can access. That will save time with questions, and once everyone has a piece of knowledge you can move it to the common sense net to save memory.
I just thought of something else. For AI, you could have the basic actions:
move
move object
pick up
drop
use
break
and maybe several others. Then these functions would change for each item. For example, if a player PICKs UP a hamburger, the USE action would be eat. If they PICKed UP a pencil, the USE action would be write.
move
move object
pick up
drop
use
break
and maybe several others. Then these functions would change for each item. For example, if a player PICKs UP a hamburger, the USE action would be eat. If they PICKed UP a pencil, the USE action would be write.
quote: Original post by Puzzler183
Another thing: to save space so you can have more NPCs, you might also set up a common sense network that everyone can access. That will save time with questions, and once everyone has a piece of knowledge you can move it to the common sense net to save memory.
Yes, that''s not a bad idea at all. Another thing I was thinking about was AI LOD where the further away an NPC is the less frequent he/she is processed to save CPU time.
Also there is always the option of storing NPC info in files or databases when not being used or when the NPC is far away to save on memory.
A CRPG in development...
Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
quote: Original post by Puzzler183
I just thought of something else. For AI, you could have the basic actions:
move
move object
pick up
drop
use
break
and maybe several others. Then these functions would change for each item. For example, if a player PICKs UP a hamburger, the USE action would be eat. If they PICKed UP a pencil, the USE action would be write.
I like that idea a lot although I have been thinking a bit more on the opposite side. As in, an NPC would be hungry (because his EAT priority would raise to the point where it's at the top) and then search for something to eat (first look in his inventory, then perhaps look for a food vendor...or maybe he'll steal food if he's an immoral NPC and/or very poor).
I will keep that concept in mind. That kind of abstraction is exactly what I'm looking for.
Another thing I haven't explained yet here is that all higher-level goals will be made up of lower-level actions that are reusable.
For instance, stealing just uses the GET action but of course causes other things to happen like maybe lowering the NPC's repuation with the law if he's caught, etc.
A CRPG in development...
Need help? Well, go FAQ yourself.
Edited by - Nazrix on December 25, 2001 6:50:17 PM
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
This isn''t exactly NPC interaction but it intresting so here it is: change the pallete based on time of day. In the morning you would brighten it, mid-day make it a little more yellow, at sun down, add red, and at night, darken it.
quote: Original post by Puzzler183
This isn''t exactly NPC interaction but it intresting so here it is: change the pallete based on time of day. In the morning you would brighten it, mid-day make it a little more yellow, at sun down, add red, and at night, darken it.
Yes I plan to include features such as that. Also, I am thinking that some NPCs will have a daily schedule. Basically besides goals and actions being assigned based upon things the NPC wants to accomplish they could be added based on the time of day too each with priorities of course.
This would mean that many NPCs will go to their jobs during the day and have a set schedule. However, of course, if another goal''s priority outweighs a scheduled priority then that goal would take over as usual.
A CRPG in development...
Need help? Well, go FAQ yourself.
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement