= Questsystem = == Author == [wiki:DamianFrick Damian Frick] == Description == This project aims at implementing a system capable of handling quests. == Timetable == || '''Date''' || '''What''' || || 15. oct. 2008 || Project design || || 22. oct. 2008 || Start implementation || || 29. oct. 2008 || continue implementation ;) || || 5. nov. 2008 || Tidying and testing, starting implementation of QuestEffectBeacon || || 12. nov. 2008 || Finishing Quests and Effects || || 19. nov. 2008 || Finishing QuestEffectBeacon || || 26. nov. 2008 || Testing, documenting, fail proofing... || || 3. dec. 2008 || Project finished, thinking about something to do... || || 10. dec. 2008 || Buffer, preparing presentation. || || '''17. dec. 2008''' || '''Orxonox Presentation''' || == Classtree == [[Image(questsystem3.png)]] == More details == The project essentially consists of the Quest entity which is the quest itself (and sub- or helper-entities, such as QuestHint (hints for quest) or QuestDescription (descriptions for quests and hints, to separate content from function)) and the QuestEffect entity which is is the only tool for quests to have an influence on the world. By enabling quests to have QuestEffects their are able to (for example) fail or complete other quests, activate hints give rewards or even trigger quests. The QuestEffectBeacon is the physical entity which finally makes quests available fot the player in the game, by being able to activate a QuestEffect on a player (under some conditions). == Creating Quests == === Creating the Quest-Hierarchy === You firstly have to create a Quest-Hierarchy in the XML-Levelfile by nesting many quests. There are two types of Quests you can use, the LocalQuest and the GlobalQuest. ==== LocalQuest ==== A LocalQuest is a Quest which has different states for each player, that means each LocalQuest can be obtained and completed (or failed) by each player parallely. Creating a LocalQuest in XML goes as follows: {{{ //Where questId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information //The description of the quest. //A list of n subquest, be aware, each of the tags must have a description and so on and so forth as well. ... //A list of n QuestHints, see QuestHint for the full XML representation of those. ... //A list of QuestEffects, invoked when the Quest is failed, see QuestEffect for the full XML representation. ... //A list of QuestEffects, invoked when the Quest is completed, see QuestEffect for the full XML representation. ... }}} ==== GlobalQuest ==== GlobalQUests are different, they can be obtained by every player but the changes made to the Quest (i.e. completion of the Quest) affect all owners of the Quest. In short. There are 3 Players, A, B and C. Player A obtains the Quest, a while later player B obtains the Quest and completes it. Since it is a GlobalQuest it is completed for all Players having obtained the Quest which means it is also completed for player A. Player C though, never having obtained the Quest, can now never complete this Quest. Creating a GlobalQuest in XML goes as follows: {{{ //Where questId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information //The description of the quest. //A list of n subquest, be aware, each of the tags must have a description and so on and so forth as well. ... //A list of n QuestHints, see QuestHint for the full XML representation of those. ... //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is failed, see QuestEffect for the full XML representation. ... //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is completed, see QuestEffect for the full XML representation. ... //A list of QuestEffects, invoked on the player completing this quest. See QuestEffect for the full XML representation. ... }}} As you may see, the difference between a GlobalQuest also lies in the fact of the GlobalQuest having RewardEffects. RewardEffects are only executed on the completing player, while CompleteEffects are executed on all player having obtained the Quest before it is completed, when it is completed.