How do I game send info about play time

Get help using Construct 2

Post » Fri Nov 14, 2014 11:39 am

Im looking solution how do i a system this will be send a info about how long player plays in my game.
B
110
S
27
G
47
Posts: 1,887
Reputation: 35,799

Post » Fri Nov 14, 2014 5:47 pm

So you are looking to tell the player how long they have been playing yes?

If this is just for the current game then you're just going to want to print System.wallclocktime which returns how long the game has been running in seconds.

If you want to have it as total play time for no matter how many times they've run the game then it gets a little more complicated. You're going to need to store the latest play time on every close. Depending on the environment you want your game to be run in and how legitimate you want the value to be different methods will have to be used.

If you just want an indication that doesn't really do much you can just use the WebStorage object. When the game is closed, use the WebStorage object to get a key which you're going to save the value to. If the key doesn't exist (i.e. this is their first time playing the game), create it with a value of System.wallclocktime, if it does (i.e. they've played before), get the value and add System.wallclocktime to it and save the new value. When you need to display this to the user, at any point in the game load the value from WebStorage and add the System.wallclocktimevalue to it (Do not save this back to the WebStorage else the system won't work).

If you need a more secure way in which the user can't edit the value then you may consider setting up a database and using the AJAX object to connect to it to save and load the value in a similar manner. However, this requires you to have a hosted database and I'm not sure how compatible this method is with all export options.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Fri Nov 14, 2014 9:15 pm

@briggybros its possibility to send this info to game developer? I want to know how many players and how long play in my game
B
110
S
27
G
47
Posts: 1,887
Reputation: 35,799

Post » Sat Nov 15, 2014 5:41 pm

@delgado then I would say you're going to need to store the values for you to look at in the future, using a database or possibly and email system.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 50 guests