Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make unlocks accessible from other stories #4

Open
Shepard opened this issue Sep 9, 2023 · 0 comments
Open

Make unlocks accessible from other stories #4

Shepard opened this issue Sep 9, 2023 · 0 comments
Assignees
Labels
Milestone

Comments

@Shepard
Copy link
Owner

Shepard commented Sep 9, 2023

Depends on #2.

Motivation

With the basic unlock system, unlock ids are scoped to a story and the state of an unlock id can be requested from within the story it belongs to via hasUnlocked('unlock id').

While this makes sure there are no unlock id clashes across stories, it would still be desirable if a story could check the state of an unlock id of another story. This way, a story author writing a sequel to a previous story of theirs can "import" some of the achievements of a player of the previous story and adjust its behaviour accordingly.

Solution

For this, the story author needs to be able to identify the story that they want to check an unlock id of, ideally via a string parameter to the external function hasUnlocked.

  • The story id saved in the database could be used. It's a UUID auto-generated when a story gets uploaded to a server. It is unique and never changes. The admin interface would have to provide access to it. However, it's also quite cryptic, it doesn't convey to a reader what story is being identified. And it's not available until after the story has been created in the server, so the story author can't know it beforehand.
  • The title of the story is much more readable. But it can also be changed after the fact, making its use for identification purposes from within the story content quite fragile.
  • A user-defined id could be added. This could maybe be set via a metadata tag or in the admin interface when creating the story. The admin code would ensure it is unique in the server. It would not be changable afterwards.

Accessing the state of an unlock from another story would then be done via the external function call:
hasUnlocked('unlock id', 'story id')

A story author will not be able to change the state of an unlock from another story. Similar behaviour can probably be achieved by instead triggering an unlock in the current story and having the other story check its state.

@Shepard Shepard added enhancement New feature or request interactive stories labels Sep 9, 2023
@Shepard Shepard added this to the Unlocks milestone Sep 9, 2023
@Shepard Shepard self-assigned this Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant