0

I would like to create a text based RPG game for iPhone. In this user will have some questions with answers, and navigate to the next page depends on the answer in which the user selects. As per the requirement I have to store the entire story in the app itself. And I need to access each event in the story, when the user selects. So which kind of database can I use? Please share your ideas. Thanks.

vice
  • 605
  • 1
  • 8
  • 16
Mithuzz
  • 1,091
  • 14
  • 43

1 Answers1

0

I'm not so sure you need to create some type of off-device database. If the game has predefined answers and questions then you should probably load the app with each of these on the device.

I'm sure there are plenty of ways to go about this, the simplest being if/else statements. This would obviously be a hindrance and easy to mess up if the storyline is long.

One thing that comes to mind would be to design the story using a Tree representation. The starting point would be the root of the tree, and from there the user would progress down the tree until it eventually reaches a leaf (end). Depending on the number of options a user has for each page, this really wouldn't be too tough to implement if you have any knowledge of this type of data structure.

But, this is just off the top of my head. I would definitely consider the use of a Tree data structure though.

CorboKhan
  • 101
  • 3
  • Thanks for your reply. Is it possible to create a extra file and write the story, as you said the Tree data structure format and pass the value to the file and access the appropriate answer from the file? And also if the story is a lengthy one we need to write a long Tree data structure. Does that make any problem? – Mithuzz Nov 26 '11 at 08:22
  • Once you have methods in place, your tree will build recursively so length won't be a problem unless it's so large that it's dominating the device's memory. I'm not quite sure what you mean by an "extra file". Perhaps you could make a separate class with the story line and each time you advance through the story you just send the class the part of the story you are in and it sends back the appropriate information. – CorboKhan Nov 26 '11 at 08:48