interactive story

Interactive Story Examples and Description

Description

Interactive Story is a good game project for a beginner. The programming is easy, however, the hard part is thinking of a compelling (or at least fun) story. The game play revolves around the player making choices at critical moments. In the actual game, the player is given a description of a situation and then is given a chance to make a choice. This is implemented as a series of "nodes". Each node has a description and a series of choices.

Concept of an Interactive Story

  • The game is made up of nodes.
  • Each node has a description of the current situation and at least two choices.
  • Display the description of the node.
  • Get basic input from the player
  • Based on this input, go to the next node.
  • There can be more than one ending node where the game ends.

A Basic Interactive Story Example

This is a very basic example that only has one node with a set of choices and two ending nodes. However, if you turn the ending notes into "choice" nodes, the story can continue.

Sample Run

You are in a dark house. It's storm outside and you begin to
wonder about how sturdy this strange house is.

Do you:
1). Try to find a light?
2). Wait?

 >8

Sorry, that is not a valid choice.
You are in a dark house. It's storm outside and you begin to
wonder about how sturdy this strange house is.

Do you:
1). Try to find a light?
2). Wait?

>1
You stumble around looking for a light. Unfortunately, it's dark
and so you slip, fall, and break your neck.

Game over

Press any key to end the game.

The Code

' FreeBASIC example
' by Shawn Hartnell

dim A as integer

node01:
    print "You are in a dark house. It's storm outside and you begin to"
    print "wonder about how sturdy this strange house is."
    print
    print "Do you:"
    print "1). Try to find a light?"
    print "2). Wait?"
    print
    input " >", A
    if A < 1 or A > 2 then
        print : print "Sorry, that is not a valid choice."
        goto node01
    endif
    if A = 1 then goto node02
    if A = 2 then goto node03

node02:
    print "You stumble around looking for a light. Unfortunately, it's dark"
    print "and so you slip, fall, and break your neck."
    print
    print "Game over"
    print
    print "Press any key to end the game."
    sleep
    end

node03:
    print "The long wait is terrifying. Every second the storm seems to"
    print "get stronger. Then, you wake up to find that the storm was"
    print "only a dream."
    print
    print "Game over"
    print
    print "Press any key to end the game."
    sleep
    end

Requirements

  • DIM - create a variable
  • END - end the game
  • GOTO - goto a new node
  • INPUT - get player's answer
  • PRINT - display text
  • SLEEP - pause the game
  • variable - holds the player's answer
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.