RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Game statistics

    Scheduled Pinned Locked Moved Projects and Themes
    script
    44 Posts 7 Posters 5.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • langestL
      langest @muldjord
      last edited by

      now is probably the time to look into this

      Glad to hear it. :)

      checksum on the first 512 k of data instead of the entire rom

      This sounds like a really good idea.

      1 Reply Last reply Reply Quote 1
      • langestL
        langest @muldjord
        last edited by

        @muldjord said in Game statistics:

        Just a thought: Is it not a bit much to make this rely so much on Skyscraper's db.xml (unless it's just one of several lookup methods you plan to implement)? Just my 5 cents.

        I implemented it as separate module. You can easily replace it with something else to get the rom meta information. You just plug in a new get_title_info(som_path: str, system: str) -> title. The reason why I depend on skyscraper is because I don't want to build a scraper, so I need to depend on at least one other scraper to get the meta info. And skyscraper is the one I am using on my system, so it makes sense for me to use it. I understand that the db.xml is not supposed to be part of an external api (in its current state) and that because of this it might seem a bit strange to depend on it.
        You can use the tool without any meta information but then the title be whatever your rom name is. And at least for arcade this could be somewhat confusing.

        muldjordM 1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator
          last edited by

          Why don't you use the info from the gamelist.xml instead of the Skyscraper's cache ? This way it's the name that appears in ES and you don't have to hash the ROM.
          Regarding arcade games ROMs, Emulationstations comes with a list of ROM name -> Game name mappings, it's in /opt/retropie/supplementary/emulationstation/resources/mamenames.xml. It uses the list to show the pretty name in gamelists for systems which are considered Arcade like.

          langestL 1 Reply Last reply Reply Quote 1
          • langestL
            langest @mitu
            last edited by

            @mitu
            Because I forgot that this file should have all the info I need.
            You're absolutely right. This is the way to go.

            langestL 1 Reply Last reply Reply Quote 1
            • muldjordM
              muldjord @langest
              last edited by muldjord

              @langest I've been working all day to implement a "quick id" system into Skyscraper. It's functional right now, but untested. You were right about the necessity of the filepath for this system to work. I basically do a check on lastmodified and filepath. And if lastmodified is in the past or equal and filepath matches, I use the cached id from my quickid list. Otherwise it reverts to calculating the id from the file itself. More info soon as I test it a bit further. And for obvious reasons I'll move any further comments I have on this to the Skyscraper thread. :)

              1 Reply Last reply Reply Quote 1
              • langestL
                langest @langest
                last edited by langest

                Did the implementation using gamelist.xml, was very easy and the program is lightning fast now that it doesn't do any file IO or hashing.
                Not as interesting problem to solve, but it works just as expected. (Might have some minor bug)
                Thanks for the input @mitu and @muldjord .
                I am still looking forward to the cache improvements of skyscraper. I'll make sure to look by the skyscraper thread to see when it is finished.

                1 Reply Last reply Reply Quote 1
                • langestL
                  langest
                  last edited by

                  I have implemented a bash menu, similar to the ones used in the rest of RetroPie.
                  I am also using dialog since I though it would look consistent.
                  However, it seems like controller support doesn't work by default in the menu.
                  How are the controller configured to work in the retropie-setup.sh for instance?

                  mituM 1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator @langest
                    last edited by

                    @langest There's a helper program (joy2key) which translates the gamepad inputs to keyboard inputs to navigate and use the dialog screens. Look at the joy2keyStart and joy2keyStop functions here.

                    langestL 1 Reply Last reply Reply Quote 1
                    • langestL
                      langest
                      last edited by

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • langestL
                        langest @mitu
                        last edited by

                        @mitu
                        Do you think it would be possible to assume I am running on RetroPie and source the helpers into my scrip? Or do I need to copy the code?

                        mituM 1 Reply Last reply Reply Quote 0
                        • mituM
                          mitu Global Moderator @langest
                          last edited by

                          @langest It's up to you - however without a RetroPie installation the joy2key program might not be available to run.

                          1 Reply Last reply Reply Quote 1
                          • langestL
                            langest
                            last edited by

                            @mitu
                            What would make the most sense to me would be to reuse the already implemented functionality in retro pie, because I don't plan to use the dialog interface anywhere else.
                            The end goal of the tui is to add it to experimental programs in the retro pie install script.
                            I tried to source the files, but I most likely did something wrong.
                            I haven't really done much bash programming before so I am not sure how everything should be set up. Could you give me some pointers to get started?
                            Thanks

                            On a separate note, I have come up with some neat new features for the python program that I am going to add. Such as bar chart for visualization and weekly/daily activity.

                            langestL 1 Reply Last reply Reply Quote 0
                            • langestL
                              langest
                              last edited by

                              @administrators Maybe this thread should have been in the ideas and development sub-forum.

                              1 Reply Last reply Reply Quote 0
                              • langestL
                                langest @langest
                                last edited by

                                @langest said in Game statistics:

                                new features for the python program that I am going to add. Such as bar chart for visualization

                                Got it implemented now together with a new exclude flag as well:

                                $ python3 /home/pi/repos/RetroStats/retro-stats/game_stats.py -c total -b 20 -n 4 -e kodi
                                                     Wario Land 3 ▏ 6:36:28 ████████████████████
                                                Crash Team Racing ▏ 2:01:08 ██████
                                                   Super Mario 64 ▏ 1:59:56 ██████
                                 Pokémon Pinball: Ruby & Sapphire ▏ 0:55:12 ██▊
                                
                                $ python3 /home/pi/repos/RetroStats/retro-stats/game_stats.py -c total -b 20 -n 3  -s nes -c times
                                Balloon Fight ▏ 3 ████████████████████
                                   Salamander ▏ 2 █████████████▎
                                  Smurfs, The ▏ 1 ██████▋
                                
                                
                                1 Reply Last reply Reply Quote 1
                                • langestL
                                  langest
                                  last edited by

                                  I have implemented the daily schedule feature. It can now tell you when during a day you spend most time playing your games.

                                    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                        ░░░░▒▒▒▒░░░░▒▒▒▒▒▒▒▒░░░░░░░░▓▓▓▓▒▒▒▒▓▓▓▓████████░░░░        
                                  

                                  Next step would be to extend the daily view to a weekly view so you can track your invested time per hour per week day. And possibly add some machine learning to categorize invested time to get a nice gradient. Right now I hardcoded some values that looked good on my data.
                                  Of course you can use this new view with some selected systems or excluded systems.

                                  I also updated the format of the log to make sure that the time in the log is UTC. I then convert to your local time zone when printing. You either throw away your current log or use the convert script here: https://github.com/langest/RetroStats/commit/e8567b456c6e2f3d5e9bdbf6f764d9abcca3361f if you want to keep your data.

                                  Also, if someone who reads this could give me some pointers on how to make this available in the install script experimental section or how to the controllers working in the TUI, I would be grateful, more detailed question above. Until then you will probably have to run this via CLI.

                                  1 Reply Last reply Reply Quote 1
                                  • langestL
                                    langest
                                    last edited by langest

                                    I extended the daily view to a weekly view and added a recent history option and a lookback option. Lookback decides how many recent days you want your stats from.

                                    $ python3 /home/pi/repos/RetroStats/retro-stats/game_stats.py -w
                                    Monday
                                      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                                      ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓
                                    Tuesday
                                      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                                                              ▒▒▒▒▓▓▓▓▓▓▓▓
                                    Wednesday
                                      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                                                          ▒▒▒▒████████▓▓▓▓
                                    Thursday
                                      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                                                      ░░░░▒▒▒▒▒▒▒▒████▓▓▓▓
                                    Friday
                                      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                                      ░░░░░░░░▒▒▒▒▒▒▒▒░░░░░░░░▓▓▓▓████▓▓▓▓
                                    Saturday
                                      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                                      ▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓████▓▓▓▓████▓▓▓▓▓▓▓▓▒▒▒▒
                                    Sunday
                                      0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24
                                                                  ▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▓▓▓▓    ▓▓▓▓████████▓▓▓▓████▓▓▓▓
                                    
                                    
                                    $ python3 /home/pi/repos/RetroStats/retro-stats/game_stats.py -r -n5
                                    2019-11-01 19:36:37+00:00 gba Pokemon Gaia
                                    2019-11-01 19:15:18+00:00 n64 Mario Kart 64
                                    2019-11-01 18:49:16+00:00 kodi
                                    2019-10-31 19:39:49+00:00 gba Rhythm Tengoku
                                    2019-10-30 20:37:13+00:00 megadrive Sonic the Hedgehog 2
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • langestL
                                      langest
                                      last edited by

                                      I wrote a server to deliver your stats, so now you can get them in your browser on your PC or on your phone.
                                      Currently looks pretty ugly since I haven't put any effort into that yet. But most of the functionality is there.
                                      If you want to test it out, install it by cloning the repo and run pip3 install . --user and start the server with retro-stats-server. Using your browser go to <retropie_ip>:5000.

                                      PC:
                                      barchart.png
                                      heatmap.png

                                      Phone:
                                      phone-bar.png
                                      schedule-phone.png

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post

                                      Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                      Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.