Skip to content

Conversation

@wjt
Copy link
Member

@wjt wjt commented Jan 23, 2026

Previously we assumed that all quests required the player to collect exactly 3 threads. This has proven to be limiting in practice: some stories are best told with fewer threads, other more.

Add a field to quest.gd to customise this. Make the HUD react to this field. Guess the quest when deep-linking to a scene (via URL hash, or F6 in editor) so that the HUD can rely on GameState.current_quest being set.

Resolves #1234

@github-actions
Copy link

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/variable-threads-in-quests.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@wjt wjt force-pushed the wjt/variable-threads-in-quests branch 2 times, most recently from 206bc1e to 507ee8b Compare January 25, 2026 09:22
wjt added 4 commits January 25, 2026 09:37
Previously if you deep-linked to a scene via the URL hash, and the scene
was not the current scene of the previously-saved state,
GameState.current_quest would be unset. Similarly, if you ran a specific
scene from the editor with F6, GameState.current_quest would be unset.

This is unhelpful: it would be useful to be able to rely on
GameState.current_quest being set if the current scene is part of a
quest.

Add a function to walk up the folder hierarchy to find the quest that a
scene belongs to. Call this in two cases:

1. When the game first loads, in the same codepath that disables saving
   state if the starting scene is not the default scene. This handles
   the F6-in-editor case.
2. When switching scenes via the URL hash. This handles the web-based
   deep linking case.

It is a bit annoying that these two cases are separate. Perhaps in
future we can change the web wrapper to pass --scene to the engine on
startup.
Previously we assumed that all quests required the player to collect
exactly 3 threads. This has proven to be limiting in practice: some
stories are best told with fewer threads, other more.

Add a threads_to_collect field to quest.gd, defaulting to 3, which can
be set between 0 and 6, inclusive.

Rewrite the story_quest_progress scene/script to dynamically add the
correct number of slots for the current quest. In the case where the
quest has no threads, hide it. If no quest is set, this is an error: log
a warning and stop.

Anchor it to the top-right in the HUD scene.

Adjust the Eternal Loom logic, which previously allowed presenting
threads to the loom only if the number of threads collected is at least
3, to compare to the number of threads in the current quest. If there is
no quest, or if its threads_to_collect is zero, do not allow taking
threads to the loom.

Resolves #1234
Previously we required that quests contain three threads: Memory,
Imagination, Spirit, in that order. As a result we simplified the
persisted state to just count how many had been collected so far.

Now we have relaxed this requirement. Store the exact types of thread
collected.
@wjt wjt force-pushed the wjt/variable-threads-in-quests branch from 507ee8b to 6ec3976 Compare January 25, 2026 09:38
@wjt wjt marked this pull request as ready for review January 25, 2026 09:44
@wjt wjt requested a review from a team as a code owner January 25, 2026 09:44
Copy link
Collaborator

@manuq manuq left a comment

Choose a reason for hiding this comment

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

This looks great. Nice sorcery in the last commit to guess the quest.

title = "Placeholder"
description = "A quest to hold scenes that don't yet have a permanent home."
first_scene = "uid://d2ejk3qrh0fo3"
threads_to_collect = 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

The dialogue removed in this 1st commit was granting 2 threads (imagination, spirit). But yes I see that it wasn't updated when the ink_combat_round_6.tscn added a 4th thread. So the threads to collect are indeed 2.

Comment on lines +74 to +76
GameState.current_quest
and GameState.current_quest.threads_to_collect > 0
and GameState.items_collected().size() >= GameState.current_quest.threads_to_collect
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@manuq manuq merged commit 63625cd into main Jan 25, 2026
6 checks passed
@manuq manuq deleted the wjt/variable-threads-in-quests branch January 25, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow quests to contain 0, 1, or 2 collectibles rather than 3

3 participants