Passwords and Replay in Parser Games

Hi everyone,

I’m working on a parser game in which, after solving some puzzles, the player learns a password which is used to open a door they encountered earlier. The problem with this is that unlike a puzzle that involves obtaining a physical item, anyone replaying the game from the start can use the password before the PC has learned it. I’m considering writing some code to randomly change the password if the player tries to use it before it’s been ‘discovered’, to one of a number of alternatives from a table, but even these could be learned with enough patience. Can anyone think of a better way of getting around this problem, or indeed a simpler way?

Many thanks,
J J Guest

Could you just use the random number you were originally going to use to index the table and make the door have a PIN instead?

It’s a word, rather than a number. A number wouldn’t really work in this context.

Could it be two words? That could give you a much larger number of combinations from relatively little source material.

Could you at least make brute-forcing boring or dangerous: block undoing for entering the password, make the lock mechanism jam for some period of time after two or more failed attempts, administer some sort of punishment …

You could just set a true/false variable to flag when the in-game PC has learned the password. That way you can prevent them from using it (error message “Out of World Knowledge is not allowed! You’ll need to actually learn the password first!”) beforehand.

This happens at the beginning of Anchorhead - You can try to research the family name before the protagonist learns it, but the game won’t let you find the file until the PC has actually heard the name for herself during game events.

It hadn’t actually crossed my mind, but the direct approach might be the best, and if it’s good enough for Anchorhead…
It’s certainly the simplest approach too.

Mainframe zork had a randomized dual key password/spell feature that allowed you to jump to the end game. You might try to dig up that code.

You can generate a random string at game start. You can have a table that contains all possible characters (a to z), and then generate 8 random numbers from 1 to 26 (or 0 to 25, not sure how Inform [if you’re using Inform] does tables) so that you can construct an 8 letter password.

If by some miracle the player guesses the right password anyway, then you can generate another random password and set it as the correct one, and tell the player they guessed wrong.

If you want the password to be a real word rather than random letters, then you can initialize the password to the word you want at game start instead of generating a random one, and only do the random generation if the player tries to enter the password before having seen it. This way, a walkthrough will still be valid if the player doesn’t try to be cheeky, and your game completion test scripts will still work while you’re still developing the game.

That is exactly what I was thinking of doing, as the password does have to be a real word. I’ll probably end up doing that, but my brain is too fatigued to write the code at present!

If it helps, I’ve done this twice with passwords in my games:

  • in Aunts and Butlers, you have to bring an NPC to say the password in the right accent. (Adaptable to genre as required, e.g. alien with the right sort of vocal cords.)
  • in Portcullis, the wizard’s magic word is a randomised string of alternating consonants and vowels, with a skew towards Xtreme Majik Letterz. (Doesn’t work if you need it to be a real word.) There’s also a randomised door code with colours and animals, which took way longer to program than it does to solve.