With this article, I intend to present to you some techniques on how to generate content. Most specifically, quests. If you want to take a look at procedural map generation, you can read my previous article.

Please be aware that this will be a generic explanation. It may or may not fit the style of your game, so adaptations will probably be in order. And, as you’re probably aware, nothing beats handcrafted content. But since creating a lot of quests/plots by hand can get boring, I’ll try to push you forward in a direction that allows you to create your own quest generator. Take notes!

What is a quest?

A quest is simply one or more steps that the player can complete, and can be grouped in one of many categories, such as Kill quests, Escort quests, Gather quests and so on.

They are used to help the player advance in the game, be it story-wise (let the player know the lore of a specific piece of the game), or power-wise (help the player get stronger). So let’s get into the definition:

We consider something to be a quest when there is some kind of goal to be achieved. Rewards are optional, but there is always some kind of starting/conclusion criteria.

And so, considering our goal is to generate a quest randomly, what do we need to accomplish that? Since quests are a thing that requires manual labor to be designed, people think a computer can’t create them. But that’s not the case. If we want to create procedurally generated quests, we can do it in many ways, but it all comes down to reusable quest steps.

What is a quest step?

To be able to generate a quest randomly, we will need to create a lot of smaller pieces, like jigsaw pieces, that can be put together to create a larger image. In this case, the larger image is the quest, and the jigsaw pieces are the quest steps.

For this to be possible, we will need to define each step of the quest, with the following properties:

  • Triggers – This is a list of actions that allows the start of the current step, and it can be one or more of several things, such as, but not limited to:
    • Talk to someone
    • Pick a certain item
    • Enter / Exit a town
  • Description – This is the description of the current goal. It can be either the very start of a quest, the description of the current goal, or the conclusion to the quest. Some examples:
    • Due to the increase of people affluence in the town, the spiders have started to attack children at night. You volunteered to help kill some.
    • Joshua has requested you pick 10 lumber to help him repair his house.
    • Sven asked you to meet him at the Inn’s door at midnight.
  • Goal – The actual action that the player is required to do to complete the current step. Picking off from the last example:
    • Kill 10 spider minions
    • Deliver 10 lumber to Joshua
    • Be at the Inn’s door, at midnight
  • Allowed next steps – What should be the allowed next steps for when the player completes the current one. It’s a list of permitted triggers for the next step. For example, if you have a kill allowed next step, then you will pick a random kill step, and continue from there. If you don’t have any, or it’s explicitly finished, then the quest will be completed after this step. This property allows us to have some randomness, but still some consistency. We can’t have the player do a good deed, like gather 10 items, and then receive a quest to kill an NPC. That’s too random. Some examples of possible next steps:
    • Finished
    • Kill “Spider Boss”
    • Reach level 10
  • Reward – This is the reward the player will receive. It can either be a reward for the entire quest or a reward for each of the steps completed. For example:
    • 100 gold coins
    • A wooden sword
Hang in there, don’t give up yet!

Some examples of Quest Steps

Let’s see some examples of quest steps. For example, a talk quest step:

talk_27 ← QUEST STEP TYPE + ID
Triggerskill * (kill any monster)
talk * (talk to any NPC)
get * (get any item)
level * (get any level)
DescriptionSmith is looking for you
GoalTalk to Smith
Allowed Next Stepsgather items
kill
Reward20 gold coins

Or maybe a kill step:

kill_32
Triggerskill * (kill any monster)
talk * (talk to any NPC)
DescriptionA Wolf Boss has been causing mayhem
GoalKill 1 Wolf Boss
Allowed Next Stepstalk “Joshua”
Reward100 gold coins

Now, imagine you have a lot of these small pieces, all with their IDs and their description, goals, etc. They are jigsaw pieces, meant to be used in conjunction with each other. These pieces allow us to generate a quest that, for example, can go like Pick up a rare book → deliver the book to NPC → kill 1 mob → report back to NPC.

An example of quest

So remember, we have five main traits that a quest step is supposed to have to be able to create a quest in your game system. A quest is made up of one or more quest steps.

Imagine you have a lot of pieces for every kind of trigger in your game: killtalkexit_townenter_townget_itemsleepeatdie… You get the point. Now we can generate a random quest from start to finish. For example, by talking to Joshua, you can get a quest which can be represented like this:

  1. Kill 10 spiders. After the spiders are dead:
  2. Kill the spider boss. Then, after that:
  3. Report back to Joshua.

So, to start the quest, we go to Joshua and say “Hey! I heard you’ve been having some trouble! What’s wrong?” and this triggers the generation of a killquest. So, to start the quest we have:

kill_76
Triggerstalk “Joshua”
DescriptionReports of spider near the road. Go and fix that please
GoalKill 10 spiders
Allowed Next Stepskill
Reward100 gold coins

When the player kills the 10 spiders, you should process the reward. (if you want to process it at the end of the entire quest, that’s also fine). Now we have to check the allowed next step property, which will act as our trigger for the next quest step. We see that there is a new quest step, kill. So, we randomly pick another quest step that matches the trigger, and we got:

kill_32
Triggerskill * (kill any monster)
talk * (talk to any NPC)
DescriptionA Wolf Boss has been causing mayhem
GoalKill 1 Wolf Boss
Allowed Next Stepstalk “Joshua”
Reward100 gold coins

At this point, the player killed 10 spiders, one wolf boss, and we must fetch another random quest step, with the trigger talk_to. So we fetch:

talk_32
Triggers* (any trigger is allowed)
DescriptionGo check on %npc_name% and deliver the quest.
GoalTalk to Joshua
Allowed Next StepsFinished
Rewardnothing

The allowed next step is finished, so, when the player talks to Joshua, the quest is over. If you haven’t yet, you must process all of the rewards.

What we just did was a simple random quest generation without worrying about story and context, so make sure your pieces are generic. And, unless you don’t mind, make sure to put a limit to the amount of quests you generate in succession.

Let’s try another one! You are on your own and find a rare diary (maybe a monster ate its owner?). You take the diary and then read it. When you read it, the random quest starts, and this random quest step is created:

talk_38
Triggersuse item diary_12 (rare diary number 12)
DescriptionYou found a diary and it seems it belongs to someone who knew Smith. Go talk to him and see if he knows the owner.
GoalTalk to Smith
Allowed Next Steps* (allow all steps)
Rewardnothing

When you talk to Smith and tell him about the previous quest step, you complete it and generate the next step, for example:

kill_78
Triggerstalk *
Description%npc_name% asked you to kill 10 lizards.
GoalKill 10 lizards
Allowed Next Stepstalk
gather
Reward100 Gold coins

After killing the last monster, we randomly choose one of the next allowed steps, and we get gather. So, we fetch:

gather_11
Triggers*
DescriptionGather 25 iron ores.
GoalGet 25 iron ores
Allowed Next Stepstalk
Reward125 Gold coins

After collecting the iron ores, we generate the next step, which will be a talk one:

talk_07
Triggers*
DescriptionDeliver your quest to %npc_name%.
GoalTalk to %npc_name%
Allowed Next StepsFinished
Reward55 Gold coins

This is the last step of the quest, which therefore ends. The player obtained a total reward of 275 gold pieces (excluding experience points and loot from monster kills).

Conclusions

Again, remember: this procedure is used for random quests, or quests that you generate in a quest board. They are not meant for main or side quests. They are intended for grinding. When using this system for creating side-quests, or lore quests, you should take into account the context and the story of the characters involved.

Did you enjoy this article? Then consider buying me a coffee! Your support will help me cover site expenses and pay writers to create new blog content.

By continuing to browse this Website, you consent to the use of cookies. More information

This Website uses:

By continuing to browse this Website without changing the cookies settings of your browser or by clicking "Accept" below, you consent to the use of cookies.

Close