Quiz Game Template
A customer told me he wanted to create a Quiz game and I thought to myself: Wow, if he had THE Dialogue Engine, all he would need is one script and he would have his quiz game up and running…
So that is what I did. I wrote that one script and created a CML file with 4 questions and answers, built a basic prefab and now share it here with you. Install this kit AFTER installing THE Dialogue Engine and then just open the demo and hit play…
- Open up the questions.txt file in the resources folder and just follow the format in there. Note that I assign every turn 4 destinations and all of them is always turn 1. This is because turn selection is random and not handled by the “next” field like normal, but I still need 4 values to tell the system that there are 4 possible answers. Just continue doing that also
- The sample GUI is incredibly basic since you will obviously want to design the GUI to fit your game. Notice that the GUI only calls 2 functions on my GUI: StartNewGame() and SelectAnswer(int number). This should give you a clue how easy it will be for you to adapt this to your custom GUI
- One issue I have come across is that sometimes, just sometimes, when you start your first game the answers all appear blank. Not entirely sure why that happens but still, the rest of the time it works quite nicely.
- Note that in the dialogue script I make provision for loading text AND images for each answer of each question. The included quiz GUI also has the code to load and display the images as long as they are in a Resources folder. I do NOT, however, include the images in this package and the code was written in such a way that the images ARE optional. If you do not wish to use images simply update the buttons prefab to not include it and remove it from the questions file.
For those of you who are curious how I turned THE Dialogue Engine into a quiz game, as I have stated in past, this new version of THE Dialogue Engine has a much more forgiving file format than the original version and allows you to add extra content as you see fit. Here is the questions script for you to look at and see exactly how that can be done… Add extra fields to the dialogue file and a whole world of opportunity awaits…
<actors> <actor>name=ignore; <dialogue> <turn> id=0; next=1,1,1,1; answer=2; images=img0,img1,img2,img3; question=Whice of these is not me? myBad Studios MrDude McGuyver DrDude <turn> id=1; next=1,1,1,1; answer=3; images=img4,img5,img6,img7; question=What color is not in my company logo? Black Red White Yellow <turn> id=2; next=1,1,1,1; answer=1; images=img8,img9,img10,img11; question=Which of these do not belong with the other? www.mybadstudios.com wwww.unity3d.com www.guild.site www.renderer.site <turn> id=3; next=1,1,1,1; answer=2; images=img12,img13,img14,img15; question=Select the statement that is true I totally suck I totally blow I rule! I'm totally nuts <turn> id=4; next=1,1,1,1; answer=1; images=img16,img17,img18,img19; question=Who is the hero of my story? Steve Jobs Me Tinkerbell Bill Gates
Well, enjoy 🙂