Skip to content

Move the combo garbage line estimate into the engine for reuse - #758

Merged
JamesVanBoxtel merged 1 commit into
panel-attack:betafrom
JamesVanBoxtel:active/comboGarbageLines
Sep 18, 2026
Merged

JamesVanBoxtel merged 1 commit into
panel-attack:betafrom
JamesVanBoxtel:active/comboGarbageLines

Conversation

@JamesVanBoxtel

Copy link
Copy Markdown
Contributor

Problem
Analytics kept its own copy of how many garbage lines each combo size sends, out of reach of engine code.
This makes it hard to share for UI, GPM analysis in future work such as CPU code, etc.

Solution
Stack.getEstimatedGarbageLinesForCombo now provides the value publicly with shared truth from the combo table.

Why this approach
The calculation needs to be shared somewhere, arguably this is not "engine" code but it should be shared between server, client, etc so I think this is the best spot.

Verification
Added tests
lua-language-server check reports nothing in the changed files.

Problem
Analytics kept its own copy of how many garbage lines each combo size sends, out of reach of engine code.
This makes it hard to share for UI, GPM analysis in future work such as CPU code, etc.

Solution
Stack.getEstimatedGarbageLinesForCombo now provides the value publicly with shared truth from the combo table.

Why this approach
The calculation needs to be shared somewhere, arguably this is not "engine" code but it should be shared between server, client, etc so I think this is the best spot.

Verification
Added tests
lua-language-server check reports nothing in the changed files.
Comment thread client/src/analytics.lua
local class = require("common.lib.class")
local RollbackBuffer = require("common.engine.RollbackBuffer")
local Stack = require("common.engine.Stack")
require("common.engine.checkMatches")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

its a little weird that check matches is an exstencion on stack but has to be required in this way, but its preexisting.

Probably should just require check matches at the end of Stack and call it StackCheckMatches or something, but this is a pre existing pattern so I'm not going to bundle it with this change

@Endaris Endaris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we add more helpers for analytics in the future, we probably want to move these into its own file.
I think it's not wrong for this to be in the engine directory as its information directly pertains to the engine but longterm I think it would be nice if this was a separate file.

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.

2 participants