Being home for Christmas means that I don’t get quite so much uninterrupted time to work on Epitaph as I get at weekends and such. Don’t get me wrong, it’s been great being here, it’s just that all I can really focus on is ‘low impact’ work. As such, over the past week or so I have been focusing on quests (again) – not the coding of them this time, but the flavour and polishing that goes around them.

In previous posts I’ve spoken a lot about about we design quests and what we hope to get from then. I’ve mentioned in passing that during ‘asset reuse’ I tend to just completely abandon quests I wrote for Discworld because they don’t fit into either our theme or our codebase. Since it’s been the thing I’ve been focusing on so much recently, I thought I’d write a bit about what a quest looks like on Epitaph and how our quest system works to reduce the burden of work on developers.

Quests are broken up into at least two parts – the ‘metadata’ if you will about the quest, and the quest code itself. Most quests are handed out by NPCs, although not all of them – many are given just for doing something while playing, others are offered by other game objects (like items you find while playing). However, we have a formal quest tracking system here which is something we didn’t inherit with the DW lib. Our quest system is entirely our own, written from the ground up, and was intended to solve a number of problems with the way quests are done elsewhere.

The main aspect of our system is that it’s driven by data files for the most part – a quest is a (often quite meaty) data file which outlines everything that constitutes the ‘moving parts’ of the quest. It gives us an easy way to adjust criteria for completion, adding hints and solutions, descriptions and difficulties (which are algorithmically used to generate the quest level). The base DW lib comes with a ‘quest manager’ interface which is done from the game. There’s a slightly more user friendly version available through the web. Neither of them are actually convenient to work with though, and give a greatly substandard method of manipulating quest data. Here we just load up the data file, adjust it and then hit the ‘rehash’ command.

More than that though, and the biggest departure from the way they’re done on Discworld, is that a formal packaging of quest data gives gives us a nice, clean way to implement quest narrative and to very easily extend that quest narrative as needed. We don’t need to mess around with LPC save files or add in query methods or anything – we add an entry to the class definition, we add the code to support that new entry wherever it is required, and then we update the quest data files. It’s all so elegant.

When NPCs give you a quest on Epitaph, they usually give you a little description too – not in terms of ‘Go there and do this’, but something more involved outlining what it is you are to do, why they want it done, and what good you’re doing in the process. When a quest is accepted, they go through this little speech in whispers to the player.

There’s nothing technically difficult about this of course, but with the quest system we inherited it was just tedious to do – you’d need to manually add the quest speech code when something in the quest was performed. There was little conception of such a thing as ‘accepting’ or ‘completing’ a quest – you just got them awarded for accomplishing whatever the quest goals were. Some quests had multiple stages, others just magically triggered when you typed the right magical incantation in the right room. It was never a case that you went up to an NPC and said ‘I will accept this quest you are offering’ – they asked for something and you did it or you didn’t. The result of this is that the only time any of the code would know that you were interested in the quest was after you’d already started accomplishing the goals.

The formal offering and accepting of a quest here generates both a speech (if it comes from an NPC) and an entry in your quest log. It’s a more substantial feeling that you have entered into an agreement to accomplish a task, and this is important – many of our quests are things that you wouldn’t do on your own for any given reason. They are things that other people need to have done.

Of course, forcing *all* quests into this mould would be tremendously limiting – sometimes quests are rewards for observation in a room, and no NPC is ever credibly going to give you a ‘do something whimsical’ quest. So, we also have ‘alt text’ on quests that can legitimately be started without anyone asking for a task to be accomplished. If you didn’t formally accept a quest, in (most) cases you can still complete it. You’ll just get a little ‘Hey, someone will probably be interested in what you did’ bit of context when the first progress towards the goal is recorded. Don’t worry, we’ve got your back.[1]

We separate this kind of stuff out into a data file, because it means that we can easily adjust both the criteria and the speech when necessary. We also have speeches given when a quest is completed by a hand in. Because these speeches are often narrative heavy, we also allow for responses to be added to an NPC at the same time. These get layered on along with guard conditions that stop anyone who isn’t currently registered on the quest from getting a response. Similarly when a quest is completed, an NPC gets responses that only trigger if the player has that quest completed. In that way we have a simple way of adding a progressing dialogue based on quest completion. The NPC will say stuff, you can ask about it as long as you have the right level of involvement with the quest, and we can do all of that within the quest file without needing to touch an NPC other than to indicate that it should be the giver or hand-in point for the quest.

This kind of system has been wonderful for me when writing these things because it actually makes me look beyond the nuts and bolts of the code and just stuff the game full of narrative and context. In many ways, it’s is similar to our responses system. Back on Discworld, the code that makes an NPC respond to conversation is ridiculously cumbersome and awkward to work with. As a result, hardly any of the NPCs I (or most others) wrote had anything interesting to say to players. Here though, it’s as simple as adding a response and a list of keywords associated with it. The result is that NPCs here have literally hundreds of times as much dialogue associated with them. I might have added in a couple of terse ‘hellos’ in response to a player greeting an NPC with the add_respond_to_with system[2]. Now every NPC has hundreds of words of dialogue that can be triggered. It’s not that I *couldn’t* do this with add_respond_to_with, it’s that I *didn’t*, and I didn’t because it was too cumbersome and awkward and in the end I just didn’t want to.

All of this I think speaks well of our general philosophy on Epitaph – make the tools easier to use and the game will get better as a result just because sometimes the main thing stopping people adding in flavour and polish is that there are obstacles in the way.

Our quest system allows us to add a quest to an NPC by a single function call, and set them up as the hand in for a quest accordingly. Doing this layers an NPC with all kinds of extra flavour which gets folded in from the data files. Nobody needs to fiddle around with the code to make this happen – it all happens for free because our infrastructure has been designed with that in mind. It makes our game more consistent, and more immersive. As a result of the lowered barriers to participation, it also has the natural side effect of making people more creative as less of their effort is spend on the ‘how’ and more is spent on the ‘what’.

Drakkos.

[1] It’s also a lot more ‘user friendly’ that letting people find an interesting looking puzzle in the game but refusing to let them play with it until they have found what NPC is responsible for giving out the quest. We could give hints to that in the puzzles I suppose, but then I’m not sure how saying ‘Go see Stabby Joe about this puzzle, accept the quest, then come back here to complete it’ is great design either.
[2] Check out my older, now deprecated, LPC for Dummies which is available on the Discworld website. It’s really beyond awful. That is, the add_respond_to_with system is beyond awful, not my LPC for Dummies. Or, for that matter, the Discworld website but I don’t really care if you find that awful or not. Make your own mind up. Why are you bothering me with this? Leave me alone. God dammit, just go away.