mardi 5 mai 2015

How to design a dependency list and store it

I am working on a game which as a series of quests. There are many quests available to the user at any time, however certain quests depend on others being completed first before they are available. You can look to WoW for possibly the best implementation of this. As you complete various quests, then game state is updated to reflect new options available to the user.

I am curious as to how to build this efficiently. For example:

Quest A: no dependency
Quest B: no dependency
Quest C: dependent on B complete
Quest D: dependent on C and A both complete

Essentially, this becomes a graph with node C having B as a parent, and node D having nodes C and A as parents. As we complete the Quests, the app will look to the children having all completed parents as the ones being available to the user.

I'm sure this is a common problem. I can understand it theoretically, however I'm struggling with the implementation of it.

I am working in C# / sqlite. I want to store the Quest data in my db. I as thinking of a table called Quest (not the tribe) for the quest details, but I am struggling with the best implementation for the dependency information.

Any ideas?

Aucun commentaire:

Enregistrer un commentaire