Int Fic Npcs

An NPC (non-player character) is just a general term for a person other than the player.
A useful thing is to be able to move people around. The NPC_Engine library is available from ftp://ftp.gmd.de/if-archive/infocom/compilers/inform6/library/contributions/npc_engine.zip
Asking characters about things

To ask people about things, I recommend you using a topic system. e.g.

 [ TopicScope? x;
   switch(scope_stage)
     {1: rfalse;
      2: objectloop(x has topic)
           {PlaceInScope?(x);
           }
         rfalse;
     }
   "You can't see any such thing.";
 ];

Extend 'ask' replace * creature 'about' scope=TopicScope? -> Ask; Extend 'tell' replace * creature 'about' scope=TopicScope? -> Tell; Extend 'answer' replace * creature 'about' scope=TopicScope? -> Answer;

Then, you add life routines to every npc and use ask and tell routines. Define topics as any routine with the attribute topic.

NPCs should be interesting. They should behave realistically - move around at will, only talk if they are happy, etc. Ways to achieve this include:

Emotions. Have a series of properties for emotions (happiness, anger etc). Certain actions will increase or decrease the levels - for instance, giving a flower to a princess would increase her happiness (or decrease it if you are _very_ ugly). Above or below certain thresholds they will do certain things - maybe the princess will only talk to you if she is very happy. This allows the creation of extra puzzles and of multiples choices for playing the game: there can be various ways of making her happy; if you do the wrong thing, you will need to do something else to make up for it - but there is never any one way of doing it.

Of course, good game designers don't need to be told that one shouldn't wait until one has a puzzle to add this sort of flavoring, nor should one attempt to come up with a puzzle for every bit of flavor. It is precisely this sort of detail which makes up the true body of the game, and which, more than the plot and the puzzles combined, determines how much people will like it. I call it "brain candy": it's stuff the players can just play around with, knowing without thought that it probably has no importance. -- DanielKnapp

Autonomous Actions

For autonomous actions of NPCs, there are many possibilities. You can use daemon, timer, each_turn or combinations of these. I've used a method (the way the game Deadline did it) that uses separate 'daemon' and 'timer' objects. For example, if a woman starts cooking dinner at four o'clock, you can program a daemon object to:
  1. be called at four o'clock
  2. make the person in question go to the kitchen
  3. present sequences of messages for cooking dinner
  4. serve dinner
  5. stop itself

http://www.gamasutra.com/ has some relevant articles on Game AI.


CategoryIntFic
EditText of this page (last edited March 1, 2002)
FindPage by searching (or browse LikePages or take a VisualTour)