-
Notifications
You must be signed in to change notification settings - Fork 91
Allow registering player-based formulas to stats match module #1499
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
Conversation
4a13f88
to
8e5ddfd
Compare
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.
Generally speaking having this feature added would be good, however, it needs some changes to how its implemented.
I think using variables for this is the wrong approach, and you should instead be using a formula. Formulas allow any set of variables to be mixed-and-matched as the map author desires, for example they could make it value="player.health + player.food"
and their final score would be however many hearts and food they were able to keep.
This change alone would remove some of the overhead of dealing with variables, as it simplifies it to an expression that you can call to get the value of at the end of the match.
Ontop of that i'm not sure of the stats -> additions -> stat structure in xml, maybe simplify to:
<stats>
<stat name="Score" value="player.health"/>
</stats>
i'm guessing that the only reason to have additions
is a potential future where removing builtin stats is an option, but if that's the case we could probably have them in an attribute like <stats remove="deaths"/>
or something along the lines
I agree with everything stated here generally, so:
|
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.
Overall looking pretty good, just a few minor touch-ups
One thing that still seems odd is:
AggStat will always pick the higher value for any player, having the initial value be anything other than 0 will probably not work well (eg: imagine you're tracking distance to the goal, winner is 0 distance, the max distance away is 300 blocks, you use default of 300; no player will be able to get better than that, and wont be shown).
You may need to either add the concept of positive/negative stats, or simply get rid of default, make it 0 like all the other stats (they only define it for the sake of specifying the type, ie: int or double) and just assume all stats are positive and count starting from 0
Makes sense on the default value, I am going to remove the XML default and have it initialize to 0 since that seems sensible for most if not all use-cases |
Signed-off-by: chatt <[email protected]>
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.
LGTM, just needs some testing now :)
I did some (very rudimentary) testing with a bridge map (i.e. the example mentioned in the PR) to see if goals were added which looked like they were. Any other test cases I should be evaluating here? |
Match link isn't pgm, in the case of occ it's handled by https://github.com/OvercastCommunity/Dewdrop/blob/main/src/main/java/tc/oc/occ/dewdrop/managers/MatchManager.java#L43 Seems a bit out of scope for this pr to change |
This allows mapmakers to define player-based formulas as match statistics that can be shown in the match stats summary at the end of a match.
i.e. adding this to a Bridge map
(where
value
is a player-based formula)Adds bridge goals as a stat that is appended at the end of the match stats summary
Creating as a draft pull request to receive feedback and/or thoughts!