Quests ~ WDL Representation Design - uchicago-cs/chiventure GitHub Wiki
In order to fully integrate the quests module with Chiventure, it is necessary to understand and design the core features corresponding to quests in the WDL. In particular, we need to create a JSON-compatible text format that allows for the specification of quests within the WDL for testing and utility purposes. This specification would require all the information necessary for using the methods of the quest module to build and create a fully functional quest ready for use in the game.
The key elements of the quest struct that need to be preserved are as follows: First, and most critically, the task tree, which details the possible sequences of tasks required to complete the quest as a whole. Secondly, the task structs themselves. Thirdly, the mission structs, which are needed to define the task structs. Fourthly, the reward struct, which is needed for the definition of both the task structs and the quest structs. Finally, some way of storing a list of prerequisite tasks and/or quests, which is necessary for both the task and quest structs.
The outline of our overall WDL representation is as follows:
- Quest
- Task ID Tree
- List of Tasks
- Task
- Mission
- Target Name
- Type
- Reward
- XP
- Item (ID of Item in question)
- Prerequisites
- Health
- Level
- List of IDs
- Mission
- Task
- Reward
- XP
- Item (ID of Item in question)
- Prerequisites
- Health
- Level
- List of IDs
As depicted in the outline above, each quest will have the following:
- A Task ID Tree, which stores Task IDs to map the tree relationships between tasks within a quest
- A list of tasks, which lists all the tasks within a quest
- Each of these tasks contain the following information:
- The mission of the task, which contains further sub-information on the type of mission and the target of the mission.
- he reward upon completing the task
- Any prerequisites for the task
- Including health, level, and prerequisite tasks or quests
- Each of these tasks contain the following information:
- The reward upon completing the quest
- Any prerequisites for the quest
- Including health, level, and prerequisite tasks or quests
Game where the goal is to get the World's Oldest Bubble
{
"QUESTS": [
{
"Quest Name": "Acquire Trident",
"Rewards": {
"XP": 100
},
"Task Tree": [
{
"Task Name": "Meet Poseidon",
"Task Tree" [
{
"Task Name": "Battle Poseidon"
},
{
"Task Name": "Purchase Trident"
}
]
},
{
"Task Name": "Kill Poseidon",
"Task Tree" [
{
"Task Name": "Hide Body"
}
]
}
],
"Task List": [
{
"Task Name": "Meet Poseidon",
"Mission": {
"Target Name": "Poseidon",
"Type": "Meet NPC"
}
},
{
"Task Name": "Battle Poseidon",
"Mission": {
"Target Name": "Poseidon",
"Type": "Battle NPC"
},
"Prerequisites" {
"Health": 50,
"Level": 7
},
"Rewards" {
"Item": ["Trident"]
}
},
{
"Task Name": "Purchase Trident",
"Mission" {
"Target Name": "Trident",
"Type": "Collect Item"
}
},
{
"Task Name": "Kill Poseidon",
"Mission" {
"Target Name": "Trident",
"Type": "Collect Item"
},
"Prerequisites" {
"Level": 15,
"Tasks": [ "Fruitless Murder" ]
}
},
{
"Task Name": "Fruitless Murder",
"Mission" {
"Target Name": "Poseidon",
"Type": "Kill NPC"
}
},
{
"Task Name": "Hide Body",
"Mission" {
"Target Name": "Grave Digger"
"Type": "Meet NPC"
}
}
]
},
{
"Quest Name": "Steal World's Oldest Bubble",
"Rewards": {
"XP": 1000,
"Item": "Bubble Blower"
}
"Prerequisites" {
"Quests": "Acquire Trident"
}
"Task Tree": [
{
"Task Name": "Ask Nicely"
},
{
"Task Name": "Murder Innocent Guard"
}
],
"Task List": [
{
"Task Name": "Ask Nicely",
"Mission": {
"Target Name": "Innocent Guard",
"Type": "Meet NPC"
},
"Rewards": {
"Item": "World's Oldest Bubble"
}
},
{
"Task Name": "Enter Bubble",
"Mission": {
"Target Name": "Bubble Museum",
"Type": "Visit Room"
}
},
{
"Task Name": "Murder Innocent Guard",
"Mission: {
"Target Name": "Innocent Guard",
"Type": "Kill NPC"
},
"Prerequisites": {
"Tasks": [ "Kill Poseidon" ]
},
"Rewards": {
"XP": 20000,
"Item": "World's Oldest Bubble"
}
}
]
}
]
}
This implementation requires the existence of a task hash table, so all of the quest hash table structures and functions need to be copied and renamed so tasks can have the same functionality.
Functions we need to implement (all of these are helper functions except for build_quests
):
-
build_quests()
: Converts all of the quests detailed in the WDL file into quest structs and stores them in a quest hash table -
build_quest()
: Converts a single WDL quest into a quest struct -
build_task_list()
: Converts the list of tasks from a WDL quest into a task hash table -
build_task()
: Converts a single WDL task into a task struct -
build_task_tree()
: Creates a task tree based on the WDL task tree of task ids and a task hash table -
build_prereq()
: Converts a WDL prereq into a prereq object -
build_rewards()
: Converts a WDL rewards into a rewards object -
build_and_store_mission()
: Converts a WDL mission into a mission object and stores it in a task with everything other than the mission already initialized. Note that this function needs to handle the special case where there are multiple missions specified, which is not a feature supported by the current mission implementation. It should handle this by making each mission a separate task and making the inputted task have prerequisites for each of these new tasks.