Skip to content

Add quest definitions, JSON loading and the CharacterQuests table - #109

Open
Sulphural wants to merge 3 commits into
Open-Source-Free-Realms:mainfrom
Sulphural:quest-data-model
Open

Add quest definitions, JSON loading and the CharacterQuests table#109
Sulphural wants to merge 3 commits into
Open-Source-Free-Realms:mainfrom
Sulphural:quest-data-model

Conversation

@Sulphural

Copy link
Copy Markdown

Data model and resource loading for quests, plus the persistence schema they will use.

Quests are authored in Resources/Quests.json: text ids, giver/turn-in NPCs, rewards, and an ordered list of goals (talk to an NPC, reach a location, or collect pickups).

QuestDefinitionCollection indexes quests by giver and by every goal target, and assigns world guids to each Collect goal's pickups so an interaction can be traced back to the goal it credits.

Data model and resource loading for quests, plus the persistence schema they
will use. Nothing consumes them yet - the manager, packets and handlers follow
in separate PRs.

Quests are authored in Resources/Quests.json: text ids, giver/turn-in NPCs,
rewards, and an ordered list of goals (talk to an NPC, reach a location, or
collect pickups). Quests written before goals existed still work through
EffectiveGoals, which synthesizes the single talk-to-target goal.

QuestDefinitionCollection indexes quests by giver and by every goal target, and
assigns world guids to each Collect goal's pickups so an interaction can be
traced back to the goal it credits.
@yungcomputerchair yungcomputerchair added the enhancement New feature or request label Aug 11, 2026
@yungcomputerchair

Copy link
Copy Markdown
Contributor

This is a perfect first step. Thank you!! I'll put in a review soon.

@yungcomputerchair yungcomputerchair added the database This change directly involves the database layer label Aug 11, 2026

@yungcomputerchair yungcomputerchair left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked into the logic too deeply just yet but I spotted a few issues that need to be addressed.

Comment thread src/Sanctuary.Database/Entities/DbCharacterQuest.cs Outdated
Comment thread src/Sanctuary.Database/Entities/DbCharacterQuest.cs Outdated
Comment thread src/Sanctuary.Game/Resources/Definitions/QuestDefinition.cs Outdated
Comment thread src/Sanctuary.Game/Resources/Definitions/QuestDefinition.cs Outdated
Comment thread src/Sanctuary.Game/Resources/Definitions/QuestDefinition.cs Outdated
Comment thread src/Sanctuary.Game/Resources/Definitions/QuestGoal.cs Outdated
Comment on lines +55 to +56
public byte CollectCursorId { get; set; } = 17;
public int CollectInteractRange { get; set; } = 12;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these both here and also in the quest definition? They should ideally only be in one place

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dedupe here went the wrong way. These stats are per-goal, not per-quest. So move them back to the QuestGoal and use them from there.

I'm actually not sure it makes sense for these interactable values to be in the quest domain at all; we should probably have an IInteractable interface that unifies this and the collection NPCs (@amuralle FYI)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(to be clear, you don't have to worry about an interface right now. Just move these to QuestGoal for now)


// One collectible pickup to spawn for a Collect goal. Guids are assigned at load time and map back to
// (quest, goal) via Collectibles.
public sealed class CollectibleSpawn

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amuralle some of this looks like repeated work that the collections system already put in. can you take a look?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed collections stuff from PR.. but the current system is global with a respawn timer. Definitely need to discuss more on this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I've been thinking about this- there's collectables that are user-specific used in quests for sure, I remember tons of them that only the quester could see. Will start looking through my own stuff and see if we can fit this in somehow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to all have a talk about how this should be architected

Comment thread src/Sanctuary.Game/Resources/QuestDefinitionCollection.cs Outdated
@Sulphural
Sulphural force-pushed the quest-data-model branch 2 times, most recently from abf0160 to bb9bb00 Compare August 12, 2026 02:35
These stats are per-goal, not per-quest: one quest can mix a distant landmark
step with a close-up pickup, so a single quest-level pair cannot describe both.
Move them off QuestDefinition onto QuestGoal and read them from there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database This change directly involves the database layer enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants