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

Get help using Construct 2

Post » Wed Jun 07, 2017 2:52 pm

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?
B
15
S
3
Posts: 38
Reputation: 917

Post » Wed Jun 07, 2017 3:20 pm

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.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Wed Jun 07, 2017 4:08 pm

imhotep22 wrote: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?
B
15
S
3
Posts: 38
Reputation: 917

Post » Wed Jun 07, 2017 4:20 pm

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.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Wed Jun 07, 2017 4:54 pm

Thanks again for your help. I'll check out mysql for more. :)
B
15
S
3
Posts: 38
Reputation: 917


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests