Page 1 of 1

Questing system

Posted: Mon Aug 15, 2011 12:38 pm
by Xaleph
Hi guys, wondering what a good implementation is for a quest mechanism.

As in most games you have different types of quests like: collect X of Y, Locate X at Y, Kill X of Y, et cetera.

How is this best implemented?

Code: Select all

table Quest:
    quest_id
    quest_type_id
    name, description

table QuestType
    quest_type_id
    name

table QuestCollect
   quest_id
   item_id
   quantity

table QuestKills
   quest_id
   monster_id
   quantity

table QuestLocate
  quest_id
  location
  npc
Something like this? Or am I way off?

Re: Questing system

Posted: Mon Aug 15, 2011 11:26 pm
by Jackolantern
It looks good to me. For me, most of the quest system will be in the PHP code, and the database just must be streamlined to handle all of the specific data points, such as Quest Giver, Quest Ender, quest text, what you kill, what you give and what you get. Really to me, it seems the meat is going to be in the PHP code that attaches it to the game.

Re: Questing system

Posted: Mon Aug 15, 2011 11:38 pm
by Xaleph
Hmm could you explain a bit more? You want the quests to be written in PHP? An array of the quests? I was thinking of storing it all in the database. All data that is related to the quest.

If you need to collect X from Y, every time you gain one of X, the database will be updated. If you have met the requirements ( 10 of X ) you can go the the quest giver/rewarder, check if user has 10 of X(of Y) give the reward. Next, clear the database to sanitize a bit, obviously.

But if it`s the case that you mean that battling for X should be in PHP, that`s correct. If the quest is an collect X of Y and you need to buy 10 potions, you buy 10 potions ( both PHP and db ) and once you meet the requirements, you can go to rewarder.

Re: Questing system

Posted: Mon Aug 15, 2011 11:48 pm
by Jackolantern
Xaleph wrote:Hmm could you explain a bit more? You want the quests to be written in PHP? An array of the quests? I was thinking of storing it all in the database. All data that is related to the quest.
No, that is right. The quest data will be in the database, so basically, all of your quests will be stored there. But (in my opinion) the real meat of a quest system is all of the logic and mechanics to take those quest specifics and turn them into real, playable, trackable quests. That obviously will be in the PHP code, and I think that has been the stumbling block for many in our community who tried to add a questing system but couldn't get it working. The database back-end to it is likely going to follow along the same design standards as anything else in the game: turn enumerated values into a master table that can be referenced by ID, break-apart seemingly-related categories that need specific column headings to reduce empty cells, etc. All of these types of things I can see you are doing, and I didn't expect anything less from you :) But the real challenge with a quest system is making elegant PHP code that can deal in a generic and efficient way with all of those quest specifics in the database.

Re: Questing system

Posted: Tue Aug 16, 2011 10:30 am
by Xaleph
Hmm what else can I say but this...? Challenge acepted!

Re: Questing system

Posted: Tue Aug 16, 2011 5:59 pm
by Jackolantern
Can't wait to see the results :)

Re: Questing system

Posted: Tue Aug 16, 2011 6:24 pm
by Xaleph
Haha i`m going to implement it later on.... I tried figuring out a good model, but the tables are stacking up. And there`s still so much left to do first before the game can be played, so i`m going to skip that part to a later time. But I will definitely implement it though :)