Sign in to follow this  
Ubermeowmix

Implementing a quest/achievement system

Recommended Posts

What's the best way to implement a quest system that's modular and how are the variables checked for say conversations being had, are they stored in the entities themselves as boolean triggers or in a bigger global list/class.

 

I've never done one before an it's a bit daunting trying to figure out what course of action is best.

 

I thought that if I store the variables in the NPC's and then have the quest class check for whether condition1 & itemB have been done then that would be the best way to bolt on extra levels and characters.

 

Am I on the right track?

Share this post


Link to post
Share on other sites

It's generally a good idea that you're trying to keep different mechanics modular, and expose public interface with information that these systems need.

 

However, quest and achievement mechanics (at least, how they're usually understood) are conceptually different: you don't get new dialog options because you unlocked some achievement, but you certainly will see new dialog options if you're on a certain quest (you didn't mention this scenario, but it usually exists). So, since the quest mechanic can affect the behaviour of dialogs and vice versa in a variety of ways, they need to be coupled closely. How exactly — depends on your exact goals and game architecture.

 

But if you're talking about achievements, statistics, user analytics and other mechanics that can't affect the gameplay in any way, you only need to pass information one way, and while achievements/stats/analytics need to have knowledge about NPC/Dialogs/Quests, the latter don't need to know about the former. So, as you suggested, I would expose a public interface with read-only access to all necessary data. Also, if your language has events, I would use them instead of public getters: that way, your achievement system can just subscribe to an event and then act on it, instead of constantly checking if the variables changed.

Share this post


Link to post
Share on other sites

Binary save files are explained poorly across the net and are not as complicated as they are first made out to be.

 

I understand that pointers kill the loading process as they don't really exist unless you force the save to do them separately, short of that this is a doddle.

 

I was confused before as I didn't wan't to save in a text file and I didn't really understand how C++ saved into binary format as it pussy-foot's around the subject rather than showing a solid model of what is saved and how.

 

I can see it now and I can start saving my saves/achievements accordingly in binary. Thanks for the help guys, especially sunsharior for the observer pattern.

Share this post


Link to post
Share on other sites

How you interact with the information in-memory at run-time does not have to dictate how you need to serialize it.  For example, if you were using a database to store quest and achievement data, you would typically store that in a normalized manor across several tables.  During the start-up phase of your game, you would read your database and construct in-memory objects of this data that are designed for run-time efficiency. 

Share this post


Link to post
Share on other sites

So i'm thinking of this the wrong way round then?

 

I've been messing around with the input output streams in binary and I've managed to save a class array of variable (and unlimited) size with no issues, I was just going to build a save for all the achievements that I create on the fly from the engine itself using a quick link to an asset list

 

Sudo code:

 

//assets

//list

ANIMAL_DOG_REX

ANIMAL_FISH_BUBBLES

MAN_DOCTOR_DE'ATH

ITEM_DRUG_MEOWMEOW

 

ACHIEVEMENT class

switch

( hits(MAN_DOCTOR_DE'ATH) && using(ANIMAL_FISH_BUBBLES) )

       then unlock(ACHIEVEMENT_WET_FISH_DEATH_SLAP)

 

( uses(ITEM_DRUG_MEOWMEOW) && using(ANIMAL_DOG_REX) )

       then unlock(ACHIEVEMENT_BE_MORE_CAT)

 

Once I have created these little scenarios I can just save them in binary and load them at run time can't I, or Is this not how things pan out?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this