Making a magic trick work online/as a Twine game
August 13, 2018 7:20 PM   Subscribe

There is a particular style of magic trick that involves the audience member making choices that eventually lead to a very specific choice, such as a specific playing card, and it turns out the magician has predicted this all along. I'd like to convert this into a CYOA/Twine-esque game, but there's a couple of tricky programming ideas I'd like input on. MAGIC SPOILERS INSIDE.

So the trick generally works by the magician making a hidden prediction, then telling the audience member(s) some kind of story and the audience making choices that lead to the prediction. For instance, the choice tree may be:

1. Red vs Black
2. Hearts/Spades vs Diamonds/Clubs
3. Picture/Court Cards vs Number Cards
4. Even or Odd (if it's a Number card)
5. The specific card - this may take a few goes if we're starting from a pool of more than 2


The trick behind this is that no matter what choice the audience member makes, the story shifts to make sure the choices keep the predicted card in the running. For instance, if the desired card is a Red card:

- The audience member chooses Red: "Great, let's go with that then and continue"
- The audience member chooses Black: "OK, we've eliminated that choice, let's continue"

(If this is being told as a story there's usually a plot contrivance that reflects that choice. For example, one version I heard had the cards eventually end up in some deserted island after a shipwreck, and the Red vs Black choice was which set survived the shipwreck. If they chose [Desired Color], they got on lifeboats and rowed to the island; if they chose [Other Color], then that colour got rescued and eliminated, while [Desired Color] were adrift at sea and eventually floated to the island.)

The basis of it could work as a Twine game already, though the danger is that if you preset it with a specific prediction, if you play it enough times (even just twice) you'll figure out that no matter what, you'll choose the same card. So ideally the game could generate a prediction ahead of time and then change the variables around to make sure the choices still worked - for example, replacing [Desired Colour] & [Other Colour] in the shipwreck story above with whatever is relevant to the pre-generated prediction. How do you do that with Twine/Javascript/maybe some other language?

In terms of the prediction, my idea was to give the player a password-protected file that they had to download first, then when they're done with the story they get the password to unlock the file and it holds their prediction. I want this to be a downloadable file because otherwise people might claim that it just gets changed or manipulated online while the story progresses, whereas they should be able to give that file to a friend and then that friend can open the file offline, if they want.

I couldn't figure out a format that worked though. Word docs can be password-protected, though that depends on the other person having Word in the first place. I think some Zip files can be password-protected but I don't know if you need to have a specific program to use that function. What sort of file format works across platforms?

Also, if we go the prediction-is-autogenerated route, what sort of way would we generate that file? It can be as simple as an image or text file.

Side note: I had been imagining this as a Twine game, which I think runs on Javascript, but am open to other programming languages or game systems if there's one that works better.
posted by divabat to Computers & Internet (9 answers total) 4 users marked this as a favorite
How about if instead of a password protected file, the player receives the prediction in the form of plain text encoded by Vigenere Cipher along with the passphrase, or even just encoded with ROT-13? There are plenty of decoders for both online, so the player can use several to confirm there’s no chicanery.
posted by ejs at 7:50 PM on August 13, 2018 [1 favorite]

What's the advantage of having the file be password protected? If anything, having the password be revealed at the end of the trick makes it less trustworthy. A user might think that there are different passwords, which, when used, reveal different files.
posted by Jairus at 9:29 PM on August 13, 2018

Response by poster: Jairus: the password is there to stop the player from looking ahead at the file. Though good point about the different passwords - is that possible though even if I wanted to?
posted by divabat at 9:39 PM on August 13, 2018

For the password protected file, I'm thinking a password-protected PDF file should be accessible by pretty much everyone.
posted by taz at 11:52 PM on August 13, 2018

here's a few more psychological thoughts on how to implement this as someone who has made twine games without much technological knowledge, feel free to skip if that's not what you're looking for :)

my assumption as a player would be that the password is what 'generates' the prediction when you open the file and that the password contains the elements you've picked in the story, maybe there's a few ways around that.

for a downloadable file i would just make a ton of password protected pdfs with prophecies from the game, just in the regular way of creating a pdf. i'd give them a kind of texture or appearance which looks like they definetly aren't machine generated like maybe handwrite them as the magician. each pdf would be made to correspond to a set of conditions that would possibly be generated at the beginning of the game (like when the magician chooses the card) and the game would decide which pdf to send the player based on this (this is because you've physically linked them by for instance saying if the game generates 4 of hearts send pdf 15). obviously this is not a very technical or technologically elegant solution but to me it has the advantage that if the prophecy looks machine generated for instance by just being text then the player will kind of feel like it's just the password that's generated it and not really have enough awareness of when stored files can be changed for it to really feel magical. whereas if it's obviously human created it will feel immediately more magical and mysterious on a gut level.

if i was personally making this in twine having used twine a few times i would have some kind of 'room' within the game where the prediction is 'hidden' and where the player can 'see' the hidden prediction and how long it is and peek at a number or letter they choose, something that verfies the prediction isn't changing but doesn't give away much, like when a bank asks for a particular digit from your security password. this would be where if you wanted i'd add a possibilty to download the password protected pdf file if the player wanted. this is because i feel like a lot of people might be playing on phones or tablets and not really want to download anything and also while i love downloading files i feel like this is a bit of a kind of 90s paradigm of computing and lots of people now put less in the distinction of a file being downloaded vs just in an app, of course it depends what your audience is
posted by mosswinter at 2:50 AM on August 14, 2018

Out of curiosity I did a search and the first result was this FAQ page on an open-source archive/.zip program's web site which states that .7z, .rar. and .zip archives can have multiple passwords on different files within the .zip. (I've never used that software and for all I know it's malware, btw.) But, you might want to look into that either as an element of legerdemain you could use yourself or in case someone objects that your .zip download could be a multi-password file. (In which case you might want to be able to explain the steps for how to verify whether a password-protected .zip file has one password versus multiple passwords?)
posted by XMLicious at 4:24 AM on August 14, 2018

Response by poster: People playing on their phones and not wanting to download anything is a good point I hadn't considered. Is there a way to create that kind of effect some other way? Perhaps an email sent when you start with the cipher and you get the decode word at the end of the story to verify the prediction?

I do like the handwritten note idea, could that work with the cipher too?
posted by divabat at 4:48 AM on August 14, 2018

How about this. You send them an html email to get started. At the end of the game you reveal that the email has a secret message embedded. It could be red text on a red background, and it can be revealed by highlighting it.
posted by bitslayer at 7:58 AM on August 14, 2018

Something you might consider, if you want this prediction to be verifiable and generated beforehand, is to provide something like a SHA1 digest of the predetermined (but encoded) response. They can verify the encoded response and digest beforehand without knowing its contents, and then when the contents are decoded and the answer is revealed, you get the benefit of the "magic"-looking trick.
posted by Aleyn at 11:53 AM on August 14, 2018

« Older Beyond hamburger helper   |   Shiny happy people Newer »
This thread is closed to new comments.