Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top