Ways to accomplish a clean and manageable quest system?

I’m trying to implement a small quest system into my game, utilising NPC’s to give players quests.

I already have in place a custom dialogue system, so my idea was to give some NPC’s a ‘quest bubble’ above their head. Players would talk to the NPC, be given an option to take on the quest. The problem I am trying to wrap my head around however is the data saving of quests, and keeping everything tidy.

I currently just have a table in the players data store

Quest = {},

With the intent of just adding the quests into there. Leaving would save their quests, and returning would bring the player back up to their current quest completion.

Organising the quests is another thing I’m unsure how to accomplish. How I was gonna store quest was like so

['Collect 5 fish for the fisherman!'] = {Reward = 50, Exp = 25},
['Find and return the gold coin to James'] = {Reward = 50, Exp = 25},

But then if I put them in a datastore, I’d have to way of knowing how much of the quest the player has completed?

And then also, how could I prevent players from just redoing the same quest over and over again? Or would it be better to allow players to do the same quests over and over

So is there a clean way to go about this? Any suggestions/ideas on how I could organise this cleanly

2 Likes

You could perhaps log the objectives of a quest that were completed within a table (which could either be retrieved from a variable to the DataStore table or just be stored inside itself) or simply keep track of how many objectives were completed using an integer.

I think an object-oriented system would be the best way to go here. You’d need a fair degree of abstraction. You could start with a base quest class, and have each quest be its own object, following a general set of logic. This will initially require a significant development investment, but will streamline the process of creating quests later on.

For saving, you could assign a unique identifier for each quest, and a “waypoint” of sorts (also based on a unique identifier) which logs the user’s progress along the quest. For example, a quest could be divided into the following “waypoints”: (1) accept quest, (2) talk to some NPC, (3) talk to another NPC, (4) quest complete. The current quest state/waypoint could be event-based and updated as the player interacts with the game.

4 Likes

How about storing something like:

  1. quest state (is available, in progress, completed)
  2. quest type (ie gather, explore)
  3. quest reward amount
  4. quest reward resource ( coins, exp )
  5. start point
  6. current point
  7. end point (end goal for a Gather quest)

Whenever a quest is finished, it’s state would be changed to completed, therefore, the npc should not pick it up.

If quest is type Gather, then every time the resource is picked up (fish) have an event fired that would cause the quest’s ‘current point’ to increment accordingly. There can be a check to see if it has reached the ‘end point’, if so, then quest is done.

Try putting some things together and you’ll start seeing ways on doing things that will allow you to go further.

These were just thoughts thrown out from my mobile… Keep on hacking and good luck with finding a solution that will work for you.

6 Likes