-
Notifications
You must be signed in to change notification settings - Fork 136
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
Fix levels skipped status #258
base: master
Are you sure you want to change the base?
Conversation
This does fix the doubled calculation, but it makes it calculate skipped levels over the last 10 seconds, not 5. |
So maybe iterate from 2 down to 0 instead? |
I've been working on this issue with someone else and we've yet to come to a fix that solves the calculation issue and also keeps the tickrate correct. We're still trying, and also testing your fixed fix locally. |
When I first looked at this it seemed obvious that the shifting down of the levelsSkipped array in getLevelsSkipped was wrong, after all why should getLevelsSkipped be moving data around when the MainLoop already was handling the adjustment in each iteration. Is this not the case? |
It seems, to us, that the second shift is actually important to keeping the count to a 5s interval rather than 10s. |
So the MainLoop management piece for the levelsSkipped array: // Make sure to only include ticks that are relevant
var level_jump = getGameLevel() - oldLevel;
if (level_jump > 0) {
// Iterate down the levelskipped memory
for (var i = 4; i >= 0; i--) {
levelsSkipped[i+1] = levelsSkipped[i];
}
levelsSkipped[0] = level_jump;
oldLevel = getGameLevel();
} It never adds zeroes to the list. The MainLoop is scheduled to run once a second. If we assume that it ever takes longer than 1 second to clear a level (which seems pretty clear that it does) then we aren't really a 5 second sum anyway. The way I see it is that the array represents the number of levels transitioned when levels were actually transitioned. It will store a 1, but not a 0. So if you beat 1 level every 10 seconds for a minute, the status would show that you skipped 4 levels ( I very well may be misinterpreting this, but the above seems to be accurate and I've never seen the status say "Skipped 0 levels in the last 5s" while sitting on a boss for 3-4 minutes. And if I cared to be critical of the text instead of extracting meaningful information from the intent of the text, that would be where I would start. |
Tested locally, makes the "Skipped xxx levels in last 5s" status not be about 2x what it should be.