I’d been thinking that branching text would be the core mechanic of the game - a sort of "type your own adventure".
Again, using the Playground.js library, I wrote another tiny demo (this time a whopping 150 lines rather than 50). And again, I wrote the simplest thing I could get away with.
Look at how I stored the game data:
var paths = [
{str:"i went to the ",then:[1,2]}, //0
{str:"store to buy milk ",then:[3]}, //1
{str:"mountain of adventure. ",then:[4]}, //2
{str:"and i saw sam potatoes. ",then:[5]}, //3
{str:"i saw a waterfall. ",then:[5]}, //4
{str:"then i was tired ",then:[6]}, //5
{str:"so i went to sleep. ",then:[7]}, //6
{str:"the next day, ",then:[0]}, //7
];
Even in this tiny example, those hard-coded indexes were awful to work with!
Click on the screenshot above or this link to try it out: 002/index.html
See if you can get to all branches!
