jinc0930 / Clue

A game
2 stars 0 forks source link

Dialogue graph #49

Open mishimalisa opened 1 year ago

mishimalisa commented 1 year ago

Rationale:

  1. To allow creation of new quests/puzzles with npcs.
  2. Help make items useful (example: trading, buying)
  3. Make the game more rich by allowing game designers create rich dialogues

Context aware npcs

Talking with npcs should enter in a loop where each npc will have their own set of commands. Some commands have side effects that the npc MUST remember! For example:

me: talk bob
  bob: hey, ask me anything [ ballroom, about,  stfu ]
me: ballroom
  bob: i heard somenthing tonight do you want know more? [ yes, no, stfu ]
me: stfu
  bob: ???
me: talk bob
  bob: ....
me: talk bob
  bob: ....

Directed Graph implementation

image

Specifics

  1. NPC stores a graph, a nodes array and a edges array.
  2. The directed graph will be used to guide the dialogue.
  3. Nodes are a powerful data structure that have the instructions to be processed. I gave an example below.
  4. Each node have at least a text and a trigger. Text are just the current npc speech. trigger is the command that needs to be used by the player to trigger this specific node.
  5. The graph structure implementation is up to the developer in charge
  6. After graph is implemented we need a interpreter to interpret the nodes and do the actions.

https://github.com/jinc0930/Clue/blob/1c40fac26590f59733e3f698544e49488f08f910/character.c#L383-L409

Tasks