-
Notifications
You must be signed in to change notification settings - Fork 234
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
Move vetDamage total inside instigator check #6110
Move vetDamage total inside instigator check #6110
Conversation
... also, with the pitiless attitude of working with code I didn't write, is there a reason not to condense VetDamage ( |
efc2493
to
0c3e307
Compare
There certainly is! When you use a table as a key the memory reference is used as the actual 'key' value. This memory reference is not deterministic and is therefore almost guaranteed to be different among players. As a result iterations on this collection are in a different order for each player. And the moment that happens all bets are off and the game can randomly desync, especially when mods or future contributors may suspect it is safe to use for other purposes. All in all; no - we can't eliminate the table 🤠 |
This reverts commit c7d2392.
lua/defaultcomponents.lua
Outdated
@@ -665,6 +667,11 @@ VeterancyComponent = ClassSimple { | |||
return | |||
end | |||
|
|||
-- Update a mass value killed stat, not used | |||
-- by veterancy but potentially useful to the player | |||
self.MassValueKilled = self.MassValueKilled + experience |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other veterancy values start with Vet
, I think this one should too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do VetMassKillCredit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about VetMassKilled
?
We could maybe however use this: Lines 192 to 195 in ceb09ce
I'm not sure how efficient that function is, we'd need to benchmark it. But that way we can entirely rely on the |
Would be nice to annotate what stats units usually have. |
How would we annotate that? |
The use of |
@clyfordv can you write a changelog snippet? Make sure to also describe the practical change for the players |
Dropping the VetInstigators table introduces the issue where a new unit with a reused ID might get credit for kills by the previous (now dead) unit that had the same entity id. Thoughts? |
Is there a way to detect how often this occurs? If it barely, if ever happens then I don't see an issue. |
Unfortunately, I think it might happen... all the time? Basically, any time:
Which feels like it could be an extremely common (inevitable, really) occurrence. |
But is there a way to test and see how often it happens? What if we re-introduce the backup table and see how often they're not the same unit for an AI vs AI game? |
…periment)" This reverts commit fb57fb4.
Okay; that is super interesting. Let's let this sink in and see if we can come up with a solution. |
I've given it some thought and to me the only correct solution was the old solution where we use a separate table. Did you manage to come up with something? |
I did not, I think it's inescapable, will revert the changes. |
@clyfordv can we get this finalised so we can have as a part of the game patch |
It's done, just needed to update the changelog. |
Previously, all damage taken from any source (including an allied unit or
self
) would be included in the veterancy dispersal calculations. This moves the addition operation toVetDamageTaken
(the denominator inveterancyDispersal
) inside an "IsEnemy" check, which prevents (for example) the Paragon from stealing 10,000 damage of veterancy experience for itself as it dies.Downside is a particular unit may get more credit than it is "rightfully" owed for a unit that was hit by friendly fire--not a big downside, in the scheme of things.