Trivia Game

I’m looking for some advice on creating a trivia game with Unity. Ideally I would create 2 programs, one for adding in the questions and answers and the other for playing the game.

Can Unity use a database? Is there a different or better way more suitable with Unity?

Any thoughts would be appreciated

To generate the questions, I’d simply use a program to build the questions as a database and then convert them into a slab of code.

You can load/save text or XML (and query databases) via the mono library and do with it what you will – you can also get stuff view http.

Would PlayerPrefs be a possible way to store the questions and answers?

Certainly it might work, but I wouldn’t recommend it.

Unity can pull data out of a MySQL database over the Net (assuming an Internet connection) so I’d personally do a simple admin-type web page when you can enter/post your questions and answers in to the DB, and use a Unity front end to pull the data and be the game client. But you could do this same thing in any number of tools … Flash, Torque Game Builder, even a straight web-based php game. Unless there are other features of Unity you need.

In Big Bang Fallacy I stored the quizzes in xml format and read those in. The data files were contained in the game’s application bundle and were copied from the Assets folder when the game was built using a custom script via the BuildPlayerPipeline.

http://unity3d.com/Documentation/Manual/Build%20Player%20Pipeline.html

If I wanted to add 3rd party quiz support, I would also make the application search the current user’s and main library’s Application Support/BigBangBrainGames/ folder for quizzes and create a CoreData application in Cocoa to author the quizzes in a graphical environment.

http://developer.apple.com/cocoa/coredatatutorial/index.html

Might not be the advice you’re looking for, but this is what I’d do and recommend. :slight_smile:

Cheers,
-Jon

Thanks for the ideas. I create games for people with disabilities so I wanted to create a games with strong visual and audio elements. I have a version that I created with REALbasic but it isn’t very graphically stimulating.

My hope is that the people who care for the people who play the games will create the questions based on what the person/people is/are interested in. That way the game would provide an appropriate challenge to the individual or small group playing it.

I will follow up on some of the suggestions made above but I’m was still hoping that there would be a relatively easy way to create a program that would add information into a database and then use a second program to randomly draw that information from the database. Is there an easy way to accomplish this with Unity?

Program 1
Enter question
Enter answer 1-4
Enter correct Answer
Save the 6 pieces of data

Program 2
Determine how many questions are in the database
Randomly choose one
Get the 6 pieces of information
Use Unity to present the information in an exciting manor

Currently my programming skills are limited to fairly simple javascripts. I am happy to learn new ways to do things but I’m not sure my time would be best spent learning a new programming language for this particular project.

If this looks beyond my skills I will look at reworking my REALbasic version as it seems to work with databases more easily.

Thanks again for you help.

Seems to me that this sort of thing is simple enough that you could just output some strings in the format of something like “Question|answer1|answer2|answer3|answer4|correctanswernumber” to a text file as necessary and then read them back into an array. No need for anything fancier I don’t think? Would be simple enough to do both programs in Unity…I understand the desire to keep it all consistent.

–Eric

Are there any example of quiz games made with Unity?

I know this is an old post, but I was wondering if you ended up using Unity to make your quiz game?

I played around a bit more but in the end I think I decided to just continue with my REALbasic solution as it did everything I needed it to do. I was mainly hoping to use Unity so that I could improve the visual look of the game.

From what Eric suggested I’m sure its quite possible in Unity. I was hoping for more of a database solution but reading a simple text file would probably work well for a basic quiz.

Hope this helps.

Thanks. Can you use REALbasic to make an iPhone game? Also can you import REALbasic into unity, so that you can organize the text (questions and answers) of your trivia game and then add characters and graphics from Unity?

I have one more question. With using REALbasic to make your trivia game, did you have to do any coding or was it just drag and drop?

Thanks so much!

To the best of my knowledge REALbasic does not support any iPhone development. There may be a way to share information between REALbasic and Unity but I never explored that option. I wanted a simple all in one solution.

REALbasic allows you to drag and drop the interface but then you have to add the code to create functionality. It works quite well for certain types of application development but is not very good (in my opinion) for anything involving graphics or sound. That’s why I started using Unity in the first place.

This post might help.

http://forum.unity3d.com/viewtopic.php?t=30249&highlight=database

Thanks. I am in a similar boat but with less experience. I am looking for a solution to make a quiz/trivia game with 3d characters and possibly embed the quiz questions into a virtual world. Not really sure on how to approach this as of yet, still looking for the best possible procedure. I want to publish this to the iPhone and web for my students and other teachers to use.

Well, as Voltaire said, “the best is the enemy of the good”, and this is certainly true in programming :wink:

A good way to get started on this project would be to use something very simple. For example, you could use arrays of strings to store the questions and answers and just set the string values from within the script. Then, have a go at building the rest of the game around this simple data set. This will involve picking questions at random, checking the answers, keeping score, etc. When you have got this working to your satisfaction, look at alternative ways of filling the question/answer arrays (hard-coding them in the script is indeed very limiting). The key thing to notice here is that you can use the same array code to drive the game regardless of how the arrays are actually filled with the necessary data. The arrays make the data source “replaceable”, so that you can use something simple for initial development and then gradually improve on it.

I’m creating a Trivia game myself, and I was wondering if it would be easier to use the GUI for a Trivia Game? It seems like it has everything I would need to put it together. I’m a big noob when it comes to Unity.