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

Introduce infrastructure for tracking past games #42731

Merged

Conversation

jbytheway
Copy link
Contributor

@jbytheway jbytheway commented Aug 5, 2020

Summary

SUMMARY: Features "Show which achievements have been completed in past games"

Purpose of change

Generally speaking achievements are intended to be tracked globally, not just within a single game. We need to start implementing that.

Describe the solution

This PR introduces the infrastructure code to do that, and implements a minimal application of that code in the form of showing which achievements have been completed in past games (when you're looking at the achievements screen).

This works by reading the json memorial files I added in #41886. The new past_games_info class has a global instance which is not part of game (since it's not specific to a single game).

The only extracted data we actually use is the achievement completion info. We report in the achievements window when an achievement has been previously completed, reporting the first character to do so and how many have.

Describe alternatives you've considered

There's certainly more we want to do with past game info, but this is intended to be a minimal viable product.

The "first" character is actually determined by the order in which those characters died, not the order in which they gained the achievement. We could add real-world time of getting achievements, but that's not currently available.

We currently only get past game info from games with memorial files, which means only games which have finished. We could try to also include currently active games, but that's rather more complicated.

Testing

Got some achievements in some games and then looked at the achievements window.

Feel guilty about not writing more unit tests.

Additional context

The next step is to implement popup windows when you complete an achievement. I want to only do that for the first time you get an achievement (by default) and so was waiting until this infrastructure was in place before doing that.

I'd like to argue for this to bypass the feature freeze for a couple of reasons:

  • It's fairly separate from core game mechanics and thus relatively safe.
  • It's needed to make the achievements system a more complete whole. Without this, and the aforementioned popups still to be implemented, most players won't generally notice achievements being a thing.

But if it doesn't make it in before release it won't be the end of the world.

past-achievements-1
past-achievements-2

@ZhilkinSerg ZhilkinSerg added 0.F Feature Freeze <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Game: Achievements / Conducts / Scores Player goals and how they are tracked. and removed [JSON] Changes (can be) made in JSON labels Aug 5, 2020
@jbytheway jbytheway force-pushed the global_achievements_tracker branch from dee9fd1 to 029d803 Compare August 5, 2020 14:27
@nexusmrsep
Copy link
Contributor

What would it take to clear the record? Deletion of the memorial file?

@jbytheway
Copy link
Contributor Author

What would it take to clear the record? Deletion of the memorial file?

Yes. Specifically, the memorial json file. The txt file doesn't matter.

Use it to simplify the data loading code.
This is intended to be a class to centralize details about past games to
be used e.g. to determine when achievements are newly achieved.
In past_games_info, provide access to exactly which games previously
completed certain achievements.
In most situations we want to see past games in the order they occurred.
Sort them by the date encoded in the filename.  This sorts by date the
game ended, which seems as good an order as any.  Of course, games can
overlap, but there's only so much we can do.
In the achievements window, show which achievements have been completed
in past games.
This is just sorting date/time strings so we don't need a localized
sort.
The past game info loading code puts up a popup window.  This was being
run in test mode, which fails because the UI stuff isn't initialized.

Add an early return from the redraw function in test mode to avoid this
issue.
@jbytheway jbytheway force-pushed the global_achievements_tracker branch from 9c1d303 to 448613e Compare August 6, 2020 23:50
@jbytheway
Copy link
Contributor Author

I believe the remaining CI errors are not related to this PR.

@ZhilkinSerg ZhilkinSerg merged commit f670374 into CleverRaven:master Aug 7, 2020
@jbytheway jbytheway deleted the global_achievements_tracker branch August 8, 2020 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Game: Achievements / Conducts / Scores Player goals and how they are tracked.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants