I’m creating a general job board/market board in my RPG where all quests are stored. Quests can be a bunch of different things from killing an enemy to going to a place to buying an item(s) for a special price. The way it works is there are quest sub-objects for all kinds of tasks you can complete in the game. For example there might be a quest posting for an NPC shop where the player can accept the “quest” and then go pay a specified amount for an item in an NPC Shop inventory.
My question is - what storage architecture is generally best for these types of quest boards? The NPC will have a bunch of functionality that needs to be triggered.
- It issues the quest to the board where the player can see it when it has the relevant item
- It stores the inventory item in its inventory component until the player goes to the NPC
- It can retract the quest after a certain amount of time
- If the NPC dies or loses the item for some reason ( or something else - i.e. game progresses and the area isn’t accessible) it will automatically retract the quest from the board etc.
The question is - how should I set up the reference to the NPC and its quest to trigger these things?
-
I could make the NPC ignorant of it’s own quests and store all the data in the quest on a quest board manager - the quest object would likely have to regularly check the NPC inventory to ensure the item was still there or check the target location to kill an enemy to make sure it was still available etc.
-
I could have the NPC quest giver track the quest - and regularly check its inventory and availability to see if it should take the quest down or post a different one. In the killing case it would have to track the monster’s alive status and whether the player killed it
-
I could store the quest in the target - ex the monster needing killing or the inventory item to buy (this might be weird because my items are structure data when in inventory) will check its status and modify the quest.
-
some combination of these
Not sure how people regularly handle this - maybe event dispatchers in the object like “on change inventory” runs a function in the quest object?
This kind of issue is confusing to me in several areas of development - so a best practice would be appreciated.