Skip to content

A Choose Your Safari Adventure generator using Twine and Wikipedia data

Notifications You must be signed in to change notification settings

WhiteFangs/choose-your-safari-adventure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Choose Your Safari Adventure

A Choose Your Safari Adventure generator using Twine and Wikipedia data!

The result is an HTML interactive fiction rewritten everytime you reload the page!

You can try it here.

Made for NaNoGenMo 2018, more informations about how I worked on the project here.

How it works

The generation script is the index.php file. It loads the wikipedia data from the JSON file, builds a story graph and then generates Twine passage elements using the data and some hardwritten narrative resources. All this is wrapped in an HTML file where the twine scripts are loaded to automatically transform the Twine objects into an HTML interactive story once the web page is fully loaded.

Wikipedia Crawler

The crawler/crawler.php script crawls Wikipedia pages of animal species and builds a JSON file of the data. I made some manual corrections to the data.json file, I removed empty data and added some areas information by hand.

Story Graph

The story graph works by multiplying the nodes by 2 at every level until reaching 8 nodes at the same level, then join the choices to 4 nodes and alternate for as long as necessary between 8 and 4. The code is in the generation/graph.php file.

You can debug the story in Twine by setting the $twineDebug variable at true in the main script.

Here is a schema of the story graph for a 10 level generated story in Twine:

About

A Choose Your Safari Adventure generator using Twine and Wikipedia data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages