An Indie Oldschool Role-Playing Game

The Dialogue System

The Dialogue System

on Sep 22, 2013 | 4 comments

DarkDale – as you obviously know if you have been following this development blog – is an oldschool RPG, which draws its inspiration from classic games such as Dungeon Master. That common ancestry is obviously set to inspire comparisons with another recent incarnation of the Dungeon Crawler genre, Legend Of Grimrock: yes, both DD and LoG will feature grid-based movement, mapping, puzzles, exploration and real-time combat. But we aim this game to be more than just dungeon exploration, and fully assume its “role-playing” pedigree. CRPGaddict recently provided a very useful distinction between framing and background stories. To quote him:

I’ve used the term several times in my blogging, and I want to make clear the distinction between a back story and a framing story. Back stories simply explain what’s happened in the past, and how we got to our present circumstances. The player then carries the narrative forward. Framing stories, on the other hand, describe the beginning, end, and edges of the game, and what happens in the middle is really unconnected. You could replace it with a different “frame” and the player would barely notice, because the story itself is hardly referenced in-game. In fact, it often feels like the developers wrote the story after designing the game. By the same token, you could put the same frame on completely different content.

Ultima IVChampions of Krynn, and The Magic Candle all use back stories. What happens in the game–all the NPCs and elements you encounter–is inextricable from the continuing narrative. Dungeon MasterBloodwych, and most roguelike games use framing stories.

As a true hommage to Dungeon MasterGrimrock adopted to an extent this framing approach (a fact which otherwise does not diminish its value as a game). In DarkDale, on the other side, the player’s progression will be essentially story-driven, the party pursuing the background story and “carrying the narrative forward”.

I’ll Do the Talking

All these story elements have to be passed on to the player somehow. “Lore” obviously plays an important role in setting up the stage through books, item descriptions, places and character names, notes and scrolls, maps, writings on walls and other static world elements. But to get the quests rolling, nothing beats the good old dialogue. The last few weeks have thus been spent in implementing this distinctive feature of the game. Along the way:

  • To make a dialogue system, you need someone to talk to, so a merchant NPC was modeled, textured, rigged & animated.
  • It’s always better with a proper environment, so work started on making up a shop interior.
  • Getting a decent mix of interior vs exterior lighting in the shop brought many positive tweaks to the visuals, post-processing, etc.
  • You have to edit that dialogue somehow, so the DarkDale Editor GUI was rewritten from scratch and is now way faster, powerful and more flexible.
Dialogue with the owner of the Northern Blades in Mountain Shadow.

Dialogue with the owner of the Northern Blades in Mountain Shadow.

Phew. As for the dialogue system design itself, the prime models are the Infinity engine games, namely the Baldur’s Gate series and Planescape: Torment. Closer to us, we could also name Dragon Age: Origins as another RPG where dialogue played an important part (I’ve also read positive things on the original Fallout‘s dialogue implementation while doing research, despite being personally less familiar with the game). Essentially the system had to be:

  • Deep enough to allow true role-playing choices;
  • Scalable and easily moddable;
  • Dynamic to respond to particular party configurations or changes in the game world state.

The last point in particular quickly indicated that dialogue could not be stored as simple strings. The fact that the dialogue will not have voice-overs, but be (almost) strictly text-based allows a great degree of freedom as NPC’s lines can be adjusted to include the champions’ names, classes, levels, races, for a much richer and personalized playing experience.

The system is thus organized in a state-machine like fashion, with an arbitrary number of dialogue “nodes”, each with an associated Lua script controlling both the text and options to display and the logic flow. It’s simple, but powerful and flexible. A 10 replies exchange between a character and a NPC can for example be all scripted in a single node, or split in 10 different nodes, or anything in between, according to the designer’s preference. Dialogue scripts also having access to the game world, you can instantly heal or damage players based on what happens in the dialogue, add or remove items from the inventory, open doors, spawn enemies, change the AI state of guards from friendly to aggressive, set/modify quest variables, teleport the party away…

Dialogue is also added to entities as a component, and no one said it had to appear only on live beings. Magic chests asking for passwords? Check. Doors playing riddles? Check. Talking swords? Check. Haunting voices in the middle of a crypt corridor? Check. Adding a dialogue component is easy with the new editor GUI, and it can be quickly edited in the new “edit component” window, present for more complex components. Dialogue (as any script in the game) can also be stored in external .lua files and loaded dynamically by the component, should you wish to use an external editor.

The video at the end of this post shows the dialogue system in action, with a quick glimpse of the editor. As a first example of what the dialogue scripting can do, here is the dialogue node triggered when the player asks for more info about the district. After the default response (always displayed), the script checks if there is a Vindaar amongst the party. If yes, it makes the merchant add a race-related comment which includes that character class, and has that champion answer back, before continuing to the next question.

--[dialogueNode: "districtInfo"]
--[onNodeEnter]
dialogue:add(dialogue.entity,
    {
        en = "Well, with the Festival approaching, the market district is getting quite busy. Good for business, that. Lots of shady types though.",
        fr = "Eh bien, avec le Festival qui approche, le district marchand devient pas mal achalandé. C'est bien pour le commerce. Beaucoup de gens louches aussi, par contre.",
    })
vindaar = game:getChampionByRace("Vindaar", dialogue.champion)
if vindaar then
    dialogue:add(dialogue.entity,
        {
            en = "You know, those mountain people, like your "..string.lower(vindaar:getClassUIName()).." here.",
            fr = "Vous savez, ces gens des montanges là, comme votre "..string.lower(vindaar:getClassUIName())..", ici.",
        })
    dialogue:add(vindaar,
    {
        en = "Mind your words, merchant!",
        fr = "Faites attention à vos paroles, marchand!",
    })
end
dialogue:addOption(dialogue.champion,
    {
        en = "The Festival?",
        fr = "Le Festival?",
    },
    function(game, dialogue)
        dialogue:switchTo("festival")
    end)

And the video:

    4 Comments

  1. Man this look so cool I cant wait to play it..

    Eleven Warrior

    September 27, 2013

  2. Man this looks so good

    Eleven Warrior

    September 27, 2013

  3. Hope there´s an update soon .

    Would like to know more from the game development.

    AXS

    November 14, 2013

    • Hi AXS,

      I will post an update soon. After an intense summer, I took a little break from the game in October, which is the busiest month for me otherwise, but I’m getting back to it and things are going on good!

      Georges Dimitrov

      November 15, 2013

Post a Reply

Your email address will not be published. Required fields are marked *