Password Protected Chapter?

After the first two chapters of the game, I want a pop up box to let the user input a password (provided by me) in order to play the rest of the game.

The user should not be able to discover that password themselves by looking at the source code.

How can we achieve this?

(I haven’t started the project yet, so I can choose between SugarCube or Harlowe, which ever can achieve this password protection function.)


1 Like

If there’s a password prompt, the password the user types must be checked against the correct password, which means the correct password needs to be written down somewhere.

If the correct password is written down inside the game’s code, then the user will be able* to discover the password by looking at the game’s code. I say “able” with an asterisk, because although there is a technique (called “cryptographic hashing”) to obscure the password, it doesn’t protect the password absolutely. It just takes some time (days, weeks, months) to guess.

Even if you obscure the password, if the code to check the password is in the game file, then the user can just edit the game file to remove the check and always allow access to the third chapter. That would take some knowledge of Twine and whatever story format you’re using, but there are a lot of people who know those things and it doesn’t take too long to learn them (days, weeks, months).

As an alternative, you could make a game that only contains the first two chapters, and then a separate game that only contains the third and following chapters. Put the private game on a password-protected website, and put a link to it in the public game. That does mean you’re on the hook for renting a webserver as long as you want the private part of the game to be accessible, however.

1 Like can be used for this. You make a project that is the demo, and then another which requires a payment, or can be password protected, or you can distribute keys.


You could use an encrypted link created with this service.

At the end of the chapter 2, you would insert an encrypted link, which in turn links to another game file that starts at chapter 3.

This way the transition will be (almost) seamless. Plus you don’t have to worry about renting a web hosting service as @Screwtape said.

It’s unlikely that the service will go offline, since it’s hosted on github, but that is unfortunately still a possibility.

It is not very secure though. Users can just copy and paste the unencrypted destination link if they want to share it. If you want users to have one-time codes, @HanonO’s solution is best.

Finally, if you plan to support save files, those files might not work between the two games. Not sure if there is a way around this.

Thanks everyone for the great info.