How do I store timestamps along with a set of situational conditions?

0 favourites
  • 5 posts
From the Asset Store
A whole set you need to create a gorgeous winter 2d game
  • How would you set up a system like the following:

    There are 72 sprites (all instances of the same object) in the game that the player interacts with at some point.

    For any of these interactions the reaction time is recorded.

    When showing statistics to the player they should see the average response time and be able to filter it by certain criteria:

    First of all the time frame of the interaction:

    Show only the average response time of:

    - the current play session

    - today

    - this week

    - this month

    - this year

    And for any of these calculations only consider records that meet a set of certain conditions.

    So for example the player would choose the statistic for:

    The average response times from this week, for all interactions that happened in "ArcadeMode" AND playing the game character "Hunter" AND taking place in the "Woods" AND having been lower on health than 30%.

    All I know is I will need the date plugin for the times and dates aspect.

    But I am unsure about how and where to record the timestamps along with the information about the other criteria. Where would I use arrays, where dictionaries and so on.

    Maybe someone has some experience with something of the sort. That would be really helpful! :-)

  • Push your data into an array.

    Each row of data would include anything of interest, like timestamp (use unixtime), object, mode, character, location, health, ect.

  • Thanks for your reply, oosyrag!

    Maybe I was overthinking it. I'll try that! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • After your data is entered into the array, displaying (actions) the parts you want based on your filter requirements (conditions) should be fairly straightforward.

  • I think I got it. I scribbled a rough implementation already to implement later tonight.

    For the 72 sprites I could either store their UID along with the rest or I could have them share a container with the array so they would each have their own array instance. Stuff like retrieving the last 5 entries to create an average or even comparing the last 5 entries for one sprite with the last five for another would become a bit faster that way?

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