• Advertisement

Archived

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

Ghosts - an idea to improve NPC AI

This topic is 5979 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

Ghosts are NPC-like objects generated after a NPC is killed, kidnapped, etc. A ghost cannot change the game world in any way, it has no graphic representation. The ghost performs all the actions the NPC wanted to perform. It will go to the market the NPC wanted to go to, it will go back to the NPCs village and so forth. The trick is that every time the ghost gets close to another NPC, it send the NPC object an event: "Hey, look, remember me, I should be here and I am not." Depending on how inteligent and perceptive the NPC is, how well did he know the other NPC, he could react to these events and take action (sound the alarm, go find the lost NPC, etc.). This could work very well in Thief: killing or banging the guards would create a ghost that moves around the exact circuit of the guard. The ghost would move around, creating visual and audio ghost events. If another guard would see the visual event of the ghost, he can become more alert, start looking for that guard, shout his name, ask other guards about him, sound the alarm etc. If he heard the audio events of the guard, but would not hear real audio events matching them, he can also react. This gives a bonus: the player can bang the head of a guard, then walk over a marble area at the same pace as the guard: the other guards will not mind, because they think the banged guard did it.

Share this post


Link to post
Share on other sites
Advertisement
This is an excellent idea, it would remove some of the burden of constant state checking, etc. It''s far easier to have the ai react to an explicit event than to have it "know" everything that should be happening and continuously monitor whether everything is in order. Perhaps you could set a variable delay after the ghost event which would give some leeway before someone became alarmed. You could also add counters, for example every time a character visits the market a counter is added, as this value gets higher the chances of someone in the market noticing a ghost event would be greater. Even cooler, you could have important items give off ghost triggers, so that if something is stolen the item''s ghost could remind anyone who views it that it should be there but isn''t. Then as you said you could add in modifiers for characters with better perception or higher alert status. Great idea!

Share this post


Link to post
Share on other sites
Yup, this seems to be a really useful idea.

You can then put an alertness level to each NPC, assigning how many ghost events (of what importance - visual and tactile ranking highest, audio probably lowest) it takes until he starts doing something.
You can also top it off on the other end of the scale, perceiving one or two ghost events makes you NPC alert and cautious to the events that might have happened, but if there are a huge number of different ghosts then he would become panicky.

Something like that: If you come home and a vase is missing, you might not even notice it. If the furniture is gone, you will probably call the police. If the house is empty, the neighbours are all gone, the noise of the traffic is missing and ALL the houses are empty you will probably have a nervous breakdown sooner or later.


Share this post


Link to post
Share on other sites
That''s ingenious!

You could leave a ghost as an after effect of an event. If someone takes a bazooka and blows a hole through a wall, you could leave a ghost there for NPCs to find and get excited about (as opposed to having them go there and perform some complicated scanning algorithm to check whether the wall is broken or not). A ghost for a patch of burned trees which fell victim to someone''s fireball might cause the NPCs following the PCs as henchmen to get real nervous.

George D. Filiotis
Are you in support of the ban of Dihydrogen Monoxide? You should be!

Share this post


Link to post
Share on other sites
Annotated worlds... it''s in the AI literature. Diodor has taken it a step further with ambulatory annotations. Annotations are notes or instructions left in key areas to NPCs (invisible to the player) on how to behave.



___________________________________

Share this post


Link to post
Share on other sites
Thanks for the replies. And here''s another idea: spirits. Spirits are a variation of ghost, but they appear in the world by themselves, and try to accomplish certain goals. (A thief spirit for instance would try to climb the wall of a castle, sneak inside, move around without being seen (if he is seen, the spirit will either disappear or be thrown outside the castle for a new try), stealing stuff and getting out) If successful, the spirit will then prompt passing NPC thieves that the castle needs some looting. Or they could prompt the same thief NPCs that the castle is very secure or has little value inside if the spirit fails in his attempts.

This is more of an idea for improving NPC intuition, not AI. The NPC would know that there is a way inside the castle from the spirit, but he would first need to take in game action to find game information about that route before proceeding to make everything look legal. The player would suspect nothing. From what he knows, the thief was an honest NPC, he read the secret plans of the castle, talked to the drunken guards about the back entrance, and then went on stealing.

Share this post


Link to post
Share on other sites
I dont really see the point behind the "spirits" idea, at least not in the example you provided. If you go about letting your NPCs "scout ahead" via spirits, then you have run into that age-old "the computer is cheating" problem, even if you legitimise it by what you mentioned. I think that if you want to make a NPC behave realistically, you have to do that based on the moment. The spirit would probably give more information than just the map, so it would not really serve a purpose in the sense of giving them "intuition".
The basic idea is good, but I dont believe that NPC intuition is something we need (yet), right now the main problems are NPCs being dumb as rock, getting stuck in doorways and not reacting properly to their environments.

The way I see it a spirit is essentially an optimisation routine, if you let it learn, you can let it go at the same problem again and again, until it succeeds with a certain probability. The are where I would see applications for this is AI (as in chess computer), when you let your computer-played opponent play out different strategies in order to come up with a way to surprise you.. in a fps it would amount to something like "what happens if I (the monster) run around the corner and try to shoot the player". Then you´d find a probable outcome, determinde by stuff like the monsters stats, the players average aim and lots more. If the outcome is not favorable (for the monster) then it stays back or goes elsewhere.
I think by that you could essentially avoid all kinds of "rushes", be it strategy games, the rpg-orc or the fps target.



Share this post


Link to post
Share on other sites
Guest Anonymous Poster
great idea

Share this post


Link to post
Share on other sites

  • Advertisement