Skip to content

Conversation

@Catizard
Copy link
Collaborator

@Catizard Catizard commented Oct 2, 2025

Motivation

Store modded score in database, and provide mechanism to view them

Goal

  • Correctly storing the full play history, and adding an in-game history viewer
  • Viewing modded lamp/scpre in-game: show corresponding lamp/score for selected mods

Implementation Details

The first goal is pretty straightforward. Creating a similar table eddatalog in scoredatalog.db, but:

  • Removes the primary key, which causes scoredatalog.db file doesn't save each play record
  • Adds two new fields rate and overridejudge

And by querying this table we can easily render a local history in-game using imgui. Demo:
6a9f95591d9fd21be58214c5fea3dd02

The second goal, however, it's much complicated than first step. The most straightforward idea would be to implement the same strategy from step1: expand the definition of score table and modifies the query statements. However, it's very hard to expand the score table because its primary key is (sha256, lnmode) and it means for each chart, it stores the best score for each lnmode. Therefore, we need to expand the primary key as (sha256, lnmode, freq, override judge rank) and maintains the best score based on current selected mods and adds more fields into primary key set if we added more mods in the future.

Therefore, instead of expanding the definition of score table, this pr chose to calculate the best score based on users' full play history. Which is implemented in step1.

Compatibility

  • Drop-in: nothing affected
  • Backward: handled by creating a similar table instead of modifying the original table from scoredatalog.db directly. Because it would violate the primary key restriction.
  • Upstream doesn't store course score into database.

Known Issues

  • An incomplete play of course won't be recorded into scoredatalog but in score. Personally speaking I don't think this is an issue and need to be fixed.

TODOs:

  • The second goal, allow user viewing the lamp/scores based on the selected mod directly

  • Add sort & filter button for local history table

  • View course scores

  • Migrate old data from scoredatalog to eddatalog when it's empty Deleted because not very useful.

  • Currently, the new added functions don't have the line song.hasUndefinedLongNote() ? lnmode : 3. I couldn't understand it rn. Not a thing now.

Other improvements

  • Customizable columns for local history table
  • Store gauge data in database (requiring a good compress algorithm)

@Catizard
Copy link
Collaborator Author

I uploaded a commit 0fcba82 as the prototype of the step2: displaying lamps based on the modded scores
Showcase:
96c33b7e975f06105b63f10e69d2ecdb
acee847d7d5c66e7439e3e1789297bae

The main idea of the commit is providing overloads for the query functions in ScoreDataCache, which is the glue layer between game display logic(lamps on bar, folder lamps, etc) and actual database access(PlayDataAccessor, ScoreDatabaseAccessor, etc). The original query functions only have one extra parameter except chart's hash: lnmode, which is the current ln playstyle(LN, HCN, CN). Obviously we need to add freq and override judge rank as the parameters. Which in this commit, is wrapped as a "context" class QueryScoreContext.

This implementation doesn't add a new sqlite table or modify any existed table's definition. Completely based on the work from step1, which implements the correct full play history, and records the mods that was using. Another idea is extending the definition of score table, which is demanding huge internal changes.

@Catizard
Copy link
Collaborator Author

Fixed the lamp folder display issue and fill the fallback strategy. This pr is now can be considered as completed. But not ready to be merged, demanding further discussion and fill the todos

@Catizard Catizard marked this pull request as ready for review November 24, 2025 02:03
@Catizard
Copy link
Collaborator Author

This pr allows users to view their scores on courses too:

image

During implementing this feature, I found a strange thing is raja actually doesn't record course result into scoredatalog. So I filled this behavior in this pr, which may cause conflicts in the future.

@Catizard
Copy link
Collaborator Author

image

This pr has an uncommitted extension, based on #179, which allows user review their score in result scene/course result scene. I couldn't decide whether to include this feature in this pr or not. Need some advice :)

@Catizard Catizard force-pushed the feat/modded_log branch 3 times, most recently from 09b70df to 2b09c1a Compare December 12, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant