Jared
Jared

Reputation: 4983

Android: Create Your Own Adventure Engine Basics

So here's my rather open-ended question. I've spent the last 7 hours creating numerous different "concepts" for a simple CYOA game engine. (Create Your Own Adventure) I have no problem with displaying/updating graphics, the UI, playing audio, etc. but it's the seemingly simplest of things that's really frustrating me, the core engine itself.

Here's the idea...

There are 4 TextViews: prompt, option1, option2 and option3. When the game begins the user is met with a prompt and 3 options. They then click on an option and all 4 text views update based on what they chose. If the user chooses say..."Buy a hotdog." from the "What would you like to buy?" prompt, the next screen would say something like "Choose a condiment!" with 3 different condiments, etc.

I've tried ArrayLists, Bundles, HashMaps, etc. but nothing seems to work without some seriously convoluted code. I am at a complete stand still (and my wits end) and have no idea how to create an optimized mechanism for this in Java/Android.

Any ideas?

Upvotes: 2

Views: 641

Answers (1)

gorlok
gorlok

Reputation: 1155

You need some data structure like a graph. Or maybe a tree. You can implement this with arrays, lists, maps, etc. There are many implementantion options.

Your initial data can be saved on xml files or in binary files. You can use a database like sqlite, too.

Upvotes: 3

Related Questions