Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gameplay Stat Tracker V1 #1986

Merged
merged 44 commits into from
Nov 23, 2022
Merged

Conversation

Sarge-117
Copy link
Contributor

@Sarge-117 Sarge-117 commented Nov 20, 2022

This would introduce a feature to collect and display some stats about your playthrough of the game (whether vanilla or rando). The stats include showing chronological timestamps upon collecting major items and defeating bosses as well as keeping counters of various things, such as rupees collected/spent, number of rolls, sword swings, pots broken, bushes cut, chests opened, and a few others.

coloured_timestamps

It also includes a count of enemies defeated which is broken down by individual enemy (this is the primary reason for the large number of files changed in this PR). Enemy counts are shown alphabetically in a collapsible tree, and only shows enemies that have been defeated at least once. Counts of ammo used and buttons pressed are similarly shown in collapsible trees.

Early footage showing timestamps:
https://cdn.discordapp.com/attachments/1019824570938699798/1039734068490805248/stat-tracking-test.mp4

Early footage showing enemies defeated/breakdown and ammo used:
https://cdn.discordapp.com/attachments/1034682552100855848/1041612176844136498/enemies_ammo.mp4

The stats are currently stored in gSaveContext and tied to the save file. For a "version 2" it would be nice to have an option to persist your stats without saving everything, but I feel that might be beyond me and this PR is already pretty large.

For future use, adding a new stat to be counted (or timestamp to be shown) is as simple as adding an entry to the corresponding enum in gameplaystats.h and then adding it to the lists in gameplaystats.cpp.

Shoutout to @RaelCappra for adding this to his experimental branch, which has allowed this to get some early testing.

Copy link

@Tulip-0333 Tulip-0333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love you (also for anyone seeing this I'm not underaged, please unban me from the Discord server.)

@garrettjoecox
Copy link
Contributor

Two initial thoughts, haven’t looked through the code much yet:
A) Why not put these into the SoHStats struct?
B) As it currently stands I’m not sure how I feel about the time stamp functionality being bundled with the rest of this. My thoughts on this aren’t fully developed yet, I’ll revisit later with some better feedback

@Sarge-117
Copy link
Contributor Author

Sarge-117 commented Nov 20, 2022

A) Why not put these into the SoHStats struct?

I think I had this confused with the little stat window that shows the framerate + platform you're playing on. But good idea regardless, I'll make the switch.

+ rearrange the counts enum for easier addition of future counts
@Archez
Copy link
Contributor

Archez commented Nov 20, 2022

My quick two cents: maybe the colors should be more UI friendly on a black screen, like use something that is easier on the eyes. The dark blue mostly is the one that stands out as hard to see for me.

@Sarge-117
Copy link
Contributor Author

My quick two cents: maybe the colors should be more UI friendly on a black screen, like use something that is easier on the eyes. The dark blue mostly is the one that stands out as hard to see for me.

I actually did brighten that one up somewhat after that screenshot was taken based on similar feedback from the experimental branch, so we should be good there!

Copy link
Contributor

@briaguya-ai briaguya-ai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great! after getting confirmation on that one question i left in a comment let's :shipit:

Comment on lines +1001 to +1008
SaveManager::Instance->LoadData("playTimer", gSaveContext.sohStats.playTimer);
SaveManager::Instance->LoadData("pauseTimer", gSaveContext.sohStats.pauseTimer);
SaveManager::Instance->LoadArray("timestamps", ARRAY_COUNT(gSaveContext.sohStats.timestamp), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.sohStats.timestamp[i]);
});
SaveManager::Instance->LoadArray("counts", ARRAY_COUNT(gSaveContext.sohStats.count), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.sohStats.count[i]);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this cause any issues with loading old saves? i would assume it's fine considering these are new as opposed to modified, but it'd be nice to confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try setting up some save files on 5.0.0 and see what happens loading them into this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading an older save doesn't seem to create any obvious problems! Obviously the timers and stats will be off for that particular save file but that's to be expected. @briaguya-ai

@briaguya-ai briaguya-ai merged commit 9c162fc into HarbourMasters:develop Nov 23, 2022
@Sarge-117 Sarge-117 deleted the timer-stats-test branch November 23, 2022 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants