Sign In Register

How can we help you today?

Start a new topic
Answered

Trivia game help

Hello!

I'm trying to develop a simple multiplayer trivia game. In it, there will be many questions that will be stored in the database, so when the player enters the game I want to display 1 randomly. Each question has 4 possible answers (only one correct) and 1 feedback (if the player chose the wrong answer). I'm new using GameSparks and I already did some tutorials in Real-Time Multiplayer for my game which gave me some basic understanding on how I can save and load events (players lvl, and his points). What I want to know is, where in the database I can store all my questions with their answers and their feedback (as an event, or as a message or other... I don't know where :c) and how I can i retrieve one randomly and display it on my gaming scene in unity?? In advance, thank you for all the help you could give me c:


Best Answer

Hi Alejandro,


You could store each question in a metaCollection, which can then be retrieved through an event called "getRandomQuestion" or something to that effect.


You could store your question document like so.


{"question": "What is 2+2?", "answers": ["6","12","4","5"], "correctAnswer": "4", "feedback":"Whoops, the correct answer is 4!"}

In your event you would query this metaCollection, and using some random number generator, pick a random question. You could also create multiple metaCollections to differentiate questions by difficulty, or add an extra field to your document called "difficulty" to also query with.


If you'd like any more information please let me know.


-Pádraig


Answer

Hi Alejandro,


You could store each question in a metaCollection, which can then be retrieved through an event called "getRandomQuestion" or something to that effect.


You could store your question document like so.


{"question": "What is 2+2?", "answers": ["6","12","4","5"], "correctAnswer": "4", "feedback":"Whoops, the correct answer is 4!"}

In your event you would query this metaCollection, and using some random number generator, pick a random question. You could also create multiple metaCollections to differentiate questions by difficulty, or add an extra field to your document called "difficulty" to also query with.


If you'd like any more information please let me know.


-Pádraig

Sorry for not answering, I didn't think you would respond so fast, and yes! I will try it! thank you for your fast response =)

Login to post a comment