Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use the behavioral AI from a game engine for character conversation modelling. Most game engines provide very good graphics pipeline like here , but I want to use the AI part like shown in this video . Looks like the character is always in a state machine during the gameplay, specially when he talks to the other characters and the NPCs. The other characters like Lucy do not say the same thing but say something which is related to the local goal of the state. Is it all scripted or is there any AI?

share|improve this question

In my experience, conversations with NPCs in games are always scripted. Natural-language parsing and sentence formation are difficult and mostly unsolved problems at this point, so we fake it.

To the extent that there's anything that could be called "AI" you can do one of two things, both of which still count as scripting in my book:

1) Flags. If the player has taken a certain action in the game, or earlier in the conversation, or whatever, then set a flag on the NPC that makes them treat the player differently. Think of every RPG you've ever seen where the palace guard tells you the princess has been kidnapped, until you bring her back, at which point he says something else.

2) Numeric ranges. The player has one or more numeric attributes. These might be global attributes (Karma in Fallout 3, Light/Dark side points in Knights of the Old Republic, etc.), or specific to that NPC or that NPC's faction (like your friendship/romance levels with other characters in The Sims). If your value is higher or lower than a certain threshold, the NPC treats you differently.

share|improve this answer

To my experience some games like RE Outbreak and L4D used a script + variables. Where variables are generated along with the map generator. This usually not part of a game engine, as game differ on the RND generating rules most of the time.

share|improve this answer

The Inform community, which probably writes more realistic game conversations than anyone else, has several different tricks and extensions for scripting character conversations. The content of these conversations is generally scripted, but the form is more dynamic, or at least more variable. This is not a traditional area of AI research, although some people like Nick Montfort are breaking new ground in this area.

share|improve this answer

To date, the only game I'm aware of that is not scripted (in the way you probably mean it) is Facade (Try it, it's worth the time spent)

But even there, it's scripted to some extend : every time you play, there will be 3 "special points" in the drama, and characters still obey to some "scripted" high-level rules.

share|improve this answer

One thing you can do to make conversation more "AI-Like" is to combine your scripts into a greater system. For an individual interaction between characters a script with variables, as described by Ian, is as good a solution as anything involving "real" AI.

But, the way you kick off and transition between these conversations can definitely use "real" AI. For instance, you can model a character's schedule so they go about their lives according to a set of priorities. Then, if an individual character comes into contact with another character, you have a system that evaluates rather they would talk, based on shared history or other factors. This can be as complicated as you would like and there's no need to pre-script the meta-conversations. But, as soon as you drop into an actual conversation you're better off going with something prescripted.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.