Keeb's Quest - 002 Simple Branching Demo

A possible key mechanic for the adventure game.
Created: 2019-10-24
colorful keeb’s quest logo

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!

screenshot of the branching typing demo

Click on the screenshot above or this link to try it out: 002/index.html

See if you can get to all branches!