Open brynnb opened 1 month ago
Example implementation of QuestSteps:
The NPCID and ItemID values are example values
StepID | QuestID | StepNumber | Description | NPCID | RequiredItemIDs | NextStepID |
---|---|---|---|---|---|---|
1 | 1 | 1 | Obtain Bog Juice: Brew or purchase Bog Juice. | NULL | NULL | 2 |
2 | 1 | 2 | Obtain Edible Goo: Cook or purchase Edible Goo. | NULL | NULL | 3 |
3 | 1 | 3 | Collect Drom's Champagne: Buy 4 Drom's Champagne from the bartender in Seafarer's Roost bar in East Freeport. | NULL | NULL | 4 |
4 | 1 | 4 | Turn in Champagnes: Hand 4 Drom's Champagne to Tykar Renlin in Seafarer's Roost to receive Bunker Cell #1. | 102 | 4 × Drom's Champagne (203) | 5 |
5 | 1 | 5 | Deliver Items to Prisoner: Give Bog Juice, Edible Goo, and Bunker Cell #1 to a prisoner in West Freeport Arena prison to receive H.K. 102. | 103 | Bog Juice (201), Edible Goo (202), Bunker Cell #1 (204) | 6 |
6 | 1 | 6 | Turn in H.K. 102: Hand H.K. 102 to Bank Clerk Jaylin in Highpass Keep bank to receive A Sealed Note. | 104 | H.K. 102 (205) | 7 |
7 | 1 | 7 | Obtain Spider Venom Sac: Kill giant spiders to loot a Spider Venom Sac. | NULL | NULL | 8 |
8 | 1 | 8 | Acquire Cloth Shirt: Purchase a medium-sized Cloth Shirt from a vendor. | NULL | NULL | 9 |
9 | 1 | 9 | Turn in Cloth Shirt: Give the Cloth Shirt to Altunic Jartin in East Commons to receive the Token of Generosity. | 105 | Cloth Shirt (208) | 10 |
10 | 1 | 10 | Turn in Spider Venom Sac: Give the Spider Venom Sac to Merko Quetalis in North Freeport to receive the Token of Bravery. | 106 | Spider Venom Sac (207) | 11 |
11 | 1 | 11 | Combine Tokens: Hand both the Token of Generosity and Token of Bravery to Merko Quetalis to spawn Guard Willia. | 106 | Token of Generosity (209), Token of Bravery (210) | 12 |
12 | 1 | 12 | Defeat Guard Willia: Kill Guard Willia and loot the Token of Truth. | 107 | NULL | 13 |
13 | 1 | 13 | Return Token of Truth: Give the Token of Truth to Merko Quetalis to receive the Testimony. | 106 | Token of Truth (211) | 14 |
14 | 1 | 14 | Defeat Xicotl: Kill Xicotl in Mistmoore Castle to loot the Glowing Sword Hilt. | 108 | NULL | 15 |
15 | 1 | 15 | Defeat Sir Lucan D'Lere: Kill Sir Lucan D'Lere (both forms) in West Freeport to loot the Testimony of Truth. | 109 | NULL | 16 |
16 | 1 | 16 | Improve Faction with Knights of Truth: Achieve high warmly faction with the Knights of Truth. | NULL | NULL | 17 |
17 | 1 | 17 | Turn in Testimony of Truth: Give the Testimony of Truth to Valeron Dushire in North Freeport to receive the Brilliant Sword of Faith. | 110 | Testimony of Truth (214) | 18 |
18 | 1 | 18 | Improve Faction with Priests of Life: Achieve warmly faction with the Priests of Life. | NULL | NULL | 19 |
19 | 1 | 19 | First Turn-in to Brother Hayle: Give A Sealed Note to Brother Hayle in Splitpaw. He returns an unsealed note. | 111 | A Sealed Note (206) | 20 |
20 | 1 | 20 | Final Turn-in to Brother Hayle: Give the Unsealed Note, Testimony, Glowing Sword Hilt, and Brilliant Sword of Faith to Brother Hayle to receive SoulFire. | 111 | Unsealed Note (206), Testimony (212), Glowing Sword Hilt (213), Brilliant Sword of Faith (215) | NULL |
NPCID | Name | Zone |
---|---|---|
101 | Kalatrina Plossen | North Freeport |
102 | Tykar Renlin | East Freeport |
103 | a prisoner | West Freeport |
104 | Bank Clerk Jaylin | Highpass Keep |
105 | Altunic Jartin | East Commons |
106 | Merko Quetalis | North Freeport |
107 | Guard Willia | North Freeport |
108 | Xicotl | Mistmoore Castle |
109 | Sir Lucan D'Lere | West Freeport |
110 | Valeron Dushire | North Freeport |
111 | Brother Hayle | Splitpaw Lair |
ItemID | Name |
---|---|
201 | Bog Juice |
202 | Edible Goo |
203 | Drom's Champagne |
204 | Bunker Cell #1 |
205 | H.K. 102 |
206 | A Sealed Note / Unsealed Note |
207 | Spider Venom Sac |
208 | Cloth Shirt |
209 | Token of Generosity |
210 | Token of Bravery |
211 | Token of Truth |
212 | Testimony |
213 | Glowing Sword Hilt |
214 | Testimony of Truth |
215 | Brilliant Sword of Faith |
216 | SoulFire |
By structuring the quest steps in this way, you can programmatically control the flow of the quest within your application. Each step can be checked for completion before allowing the player to proceed, ensuring that the LLM remains aligned with the quest logic and cannot be manipulated into granting rewards prematurely.
When interacting with the player, the LLM should be provided with context about the current quest step. For example:
Current Quest Step: The player is on Step 9, needing to turn in a Cloth Shirt to Altunic Jartin.
LLM Prompt Context:
You are Altunic Jartin in East Commons. The player is here to give you a Cloth Shirt to receive the Token of Generosity. Respond accordingly.
LLM Response:
Altunic Jartin says: "Ah, a Cloth Shirt! Thank you for your generosity. Please accept this Token of Generosity as a symbol of your kindness."
By updating the context for each interaction based on the quest steps, the LLM will provide accurate and relevant responses.
Ensure application keeps track of:
Source of example LUA scripts: https://github.com/EQMacEmu/quests
Example quest walkthrough: https://wiki.project1999.com/Zimel%27s_Blades_(SoulFire)
Would be amazing to get an Alla clone working with its quest database, however the only open source version I can find basically says "go find quests.sql" which doesnt seem available on the internet anywhere. Would be a lot of effort to run an extraction tool myself but might be possible? At minimum they all seem to be here in PHP format:
I want to scrape a bunch of quests off the project1999 wiki, which is based on the old game EverQuest. The original questing structure for the game is actually LUA scripts, but instead of a strictly scripted interaction, I want to use an LLM for a more dynamic text based roleplay. So I need the LLM to stay sort of on script and not allow the user to convince them to give a quest reward when they haven't actually earned it. But structuring this all into a relational database format that integrates with an LLM is a bit complex.
1. Data Model
The main entities are:
Entity Tables
Quests Table
NPCs Table
Items Table
Dialogue Table
QuestSteps Table
Requirements Table
Rewards Table
2. Parsing and Populating the Database
Need to parse the quest descriptions and extract relevant information to populate the database tables.
Example Parsing Steps
3. Interacting with the LLM
To ensure the LLM stays on script and doesn't grant rewards prematurely, you need to manage the conversation context and state.
State Management
Prompt Engineering
System Prompts: Use system-level prompts to instruct the LLM to adhere to the quest logic.
Dynamic Context: Include relevant information in the prompt about the user's current quest state.
Example Interaction Flow
Player Initiates Conversation
Input to LLM:
LLM Response:
Player Proceeds
Player Input:
LLM, with updated context:
Update User State: The player has received the note and the quest has progressed to the next step.
Preventing Premature Rewards
If the player tries to skip steps:
4. Enforcing Quest Logic
To prevent the LLM from being manipulated into giving rewards prematurely:
5. Integration Workflow
User Input Handling
Contextual Prompt Creation
Build a prompt that includes:
LLM Response Generation
Response Validation
Output to Player
6. Example Database Entries
Quests Table Entry
NPCs Table Entries
Items Table Entries
7. Additional Tips
8. Potential Challenges and Solutions
LLM Hallucination: The LLM might generate incorrect information.
Complex Quest Logic: Some quests may have branching paths or conditional steps.
User Attempts to Bypass Mechanics: Players may try to trick the LLM.