How do I collect user's answer like "Would you rather"

0 favourites
  • 5 posts
From the Asset Store
A game with 3D terrain, realistic water and various 3D objects.
  • Firstly, I have to apologize for my broken English but I'll try my best to explain.

    I want to make a mobile game which shows the decision made by other players as a form of statistic eg. 45% do like cookies and 55% do not like cookies, like the game "would you rather" has. This game is probably be internet connection needed since you have to get a data from your database server (correct me if I'm wrong) then upload the answer of the user to database.

    My questions are :

    1.Do I really need some kind of cloud server or database to do that? Which one should I pick? (firebase, google cloud,mongodb etc.)

    2.What is the best method to upload user's answer to cloud server and what type of save files format should it be?

  • You can keep the players answers in a Json string or an XML file.

    Or if it just a choice question where they just select things from already written answer, you can add a function to add +1 to a variable depending on what they pick, example you have 3 choices, 1 is apple, 2 is banana and 3 is avocado, if player selects apple, add +1 to global variable apple. In the end you keep those variables in local storage, or if its multiplayer game you keep them in an json or XML file which you load on start of game with AJax call.

  • You can keep the players answers in a Json string or an XML file.

    Or if it just a choice question where they just select things from already written answer, you can add a function to add +1 to a variable depending on what they pick, example you have 3 choices, 1 is apple, 2 is banana and 3 is avocado, if player selects apple, add +1 to global variable apple. In the end you keep those variables in local storage, or if its multiplayer game you keep them in an json or XML file which you load on start of game with AJax call.

    Thank you so much! I have a much clearer idea now.

    By the way, instead of global variable, is it possible to use array to stored value since there would probably be more than 100 questions available and it must be like 100+ global variable to organize.

    Also, could Ajax handle it when says 10 people play, access, and edit data at the same time?

  • You can use an array instead a global variable if you have to keep many values.

    If you plan on making a multiplayer games, you will have to keep the data on a server, the date can file can be anything from json, XML or MySQL. But I suggest using a MySQL database, because its secure and its made to handle more requests at the same time.

    You will need to find tutorials how to link construct 2 file to MySQL, because its not easy as it seems.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks again for your help. I'll check out mysql for more.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)