How do I game send info about play time

0 favourites
  • 4 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Im looking solution how do i a system this will be send a info about how long player plays in my game.

  • 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.

  • briggybros its possibility to send this info to game developer? I want to know how many players and how long play in my game

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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