In a Computer RPG there are two main forms of Player-NPC interaction: combat and dialogue. Today the focus will be on dialogue. Dialogue is basically a one way graph (can't go back unless looped around) with path choice restrictions (race, guild) and possibly changing one or both parties in the interaction (removal or granting of items/xp/skills). Overall some rather complex things can happen over the course of a dialogue and the challenge is to create a systems that can be represented not only in code, but in a way that can be created and maintained without modifying base class files.
The idea I have is to create a graph of Dialogue objects with a distinct head and each one with a list of possible responses. Sort of like this:
NPS: "I have something interesting to say."
Option 1: "No you don't" -> goto dialogue 3
Option 2: "Yes you do." -> goto dialogue 4
Option 3 (only if Race=Goblin or has item sword): "I am Eror" -> goto dialogue 42
Option 4 (only if not Race=Goblin): "Goblins drule!" -> end
Then if the player chooses 3 dialogue 42 is displayed and any actions contained within are executed (remove sword).
The problem is complexity and representation. The two paths I see are XML or Scripting Language, each with their own advantages and disadvantages. XML is standard and easy to implement, but can get convoluted when you want to represent complex dialogue graphs. With Scripting Languages complexity is easier, but you have to make your own interpreter and language definition/sub-definition to craft an Application-Specific Language to drive your dialogue. Currently I am leaning toward the XML, but I may re-evaluate my stance after a first cut implementation.
Look forward to my next post 'Dialogue 2: Electric Boogaloo: The Game: The Movie'.
No comments:
Post a Comment