0
\$\begingroup\$

I am planning to create a story game in VB.Net which is about making decisions and from there, there's different possible endings.

I want to know ( if there're any ) ways that can be used, other than using If Else Statements which will take a long time if that's to be used.

The game will only have texts and buttons for answers so it's really just a simple story game.

\$\endgroup\$
1
  • \$\begingroup\$ Do you understand Object oriented programming? \$\endgroup\$
    – Katu
    Jul 8, 2014 at 5:14

1 Answer 1

1
\$\begingroup\$

It sounds like you can implement this with a graph data structure of some sort. Each node of your graph is a story step, and each of the edges of given node are the answers which in turn lead to new story steps. In pseudocode:

class Node {
  string Text;
  List<Edge> Options;
}

class Edge {
  string Text;
  Node Target;
}

Then your game involves tracking the current node, which is initialized to the starting node of your story graph when the game loads. You display the current node's story text, and for each edge out of the current node, draw a button. When the player clicks on a button, you set the current node to node at the other end of the edge, and you repeat the process.

Nodes that have no children can be considered "end" states, and the player has reached the game (or lost, perhaps) when the current node is one such.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .