Skip to content
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

[UI] Results table refactor #931

Merged
merged 45 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
df87731
Add spells chool colors
1337LutZ Aug 10, 2024
f2695d7
Damage / healing / dtps table metrics WIP
1337LutZ Aug 10, 2024
2281e39
Add metrics combined totals tooltip
1337LutZ Aug 11, 2024
825688c
Add isPeriodic bool and fix spellschools
1337LutZ Aug 11, 2024
779821c
Add SpellType filtering & concat Metrics options
1337LutZ Aug 12, 2024
affd1ef
Add isProc check to ActionMetrics and pet resolvers
1337LutZ Aug 12, 2024
a7f6962
Add damage/healing crits
1337LutZ Aug 12, 2024
6d67945
Add damage done metric & dtps miss concat
1337LutZ Aug 12, 2024
009ce42
Merge branch 'master' into feature/results-refactor
1337LutZ Aug 12, 2024
2a8fd53
Merge threat metrics
1337LutZ Aug 13, 2024
6e6c581
Remove unused metrics
1337LutZ Aug 13, 2024
04112a0
Remove console log
1337LutZ Aug 13, 2024
efa11b2
Fix typo
1337LutZ Aug 13, 2024
161074f
Fix healing prop missing
1337LutZ Aug 13, 2024
56fd1f4
de-compact H/DPS values & only ignore moving pets
1337LutZ Aug 13, 2024
ac56896
Add healing hit/crit metric & Unholy Strength crits
1337LutZ Aug 13, 2024
6d46845
Updated tests due to Unholy Strength heals being able to crit
1337LutZ Aug 13, 2024
4aa86a4
Add DPET and fallback string to formatter
1337LutZ Aug 13, 2024
22204b6
Fix aura pet movement filter
1337LutZ Aug 13, 2024
5b67e05
Remove DPASP & refactor topline results to table
1337LutZ Aug 13, 2024
bfa6624
Change field tmi to old dpasp field number
1337LutZ Aug 14, 2024
ab583eb
Add IsPassiveAction
1337LutZ Aug 14, 2024
e5e8098
PR Feedback
1337LutZ Aug 15, 2024
7c3457a
Add more PassiveSpell flags
1337LutZ Aug 15, 2024
b711226
Normalize cast / hits
1337LutZ Aug 15, 2024
2332ab0
Add glancing, blocks, crit blocked damage
1337LutZ Aug 15, 2024
4c8d8ef
Add accidental removed shoulder name
1337LutZ Aug 15, 2024
5506eb5
Add missing CritBlocks metric
1337LutZ Aug 15, 2024
46d756a
Fix descriptive comments
1337LutZ Aug 15, 2024
c30c5c0
WIP adding ticks/crit ticks
1337LutZ Aug 15, 2024
b0af6a7
Add Dot tick metrics
1337LutZ Aug 15, 2024
f98e933
Remove spelltype, add proxy spell outcomes for non-hit additions and …
1337LutZ Aug 16, 2024
e68e45c
Fix summon action ID names
1337LutZ Aug 16, 2024
3fb97e1
PR feedback: hardcode spellschools in FE
1337LutZ Aug 16, 2024
a5b3086
Fix logs layout & add NoCounter outcomes
1337LutZ Aug 16, 2024
bbb1a38
Disabled recuperate heal dot
1337LutZ Aug 16, 2024
4a3f100
Fix Casts column & update subtlety test
1337LutZ Aug 16, 2024
909c393
a few style tweaks on results refactor
kayla-glick Aug 17, 2024
2fe7782
Merge pull request #934 from wowsims/feature/results-refactor-style-t…
kayla-glick Aug 17, 2024
1b8f714
Fix InDebt findings
1337LutZ Aug 17, 2024
42bbda4
Fix mind sear metrics
1337LutZ Aug 17, 2024
2fffcfe
[Metrics] Add correct cast time metrics for channels
Aug 18, 2024
0fee7ef
Fix TotalCastTime metric for channels being 0
1337LutZ Aug 18, 2024
fadaaa8
Merge branch 'master' into feature/results-refactor
1337LutZ Aug 19, 2024
40342d8
Merge branch 'master' into feature/results-refactor
1337LutZ Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package.json.tmp
/cata/
*.code-workspace
wowsimcata
wowsimcli

# old result file
TestAPL.results
Expand Down
22 changes: 20 additions & 2 deletions proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ message SimOptions {
bool use_labeled_rands = 9; // Use test level RNG.
}

enum SpellType {
SpellTypeCast = 0;
1337LutZ marked this conversation as resolved.
Show resolved Hide resolved
SpellTypePeriodic = 1;
// Needed for Frontend
SpellTypeAll = 2;
}

// The aggregated results from all uses of a particular action.
message ActionMetrics {
ActionID id = 1;
Expand All @@ -154,6 +161,12 @@ message ActionMetrics {
// Note that some spells are untargeted, these will always have a single
// element in this array.
repeated TargetedActionMetrics targets = 3;

int32 spell_school = 4;
SpellType spell_type = 5;

// True if action is applied/cast as a result of another action
bool is_passive = 6;
}

// Metrics for a specific action, when cast at a particular target.
Expand Down Expand Up @@ -188,12 +201,18 @@ message TargetedActionMetrics {
// Total damage done to this target by this action.
double damage = 9;

// Total critical damage done to this target by this action.
double crit_damage = 15;

// Total threat done to this target by this action.
double threat = 10;

// Total healing done to this target by this action.
double healing = 11;

// Total critical healing done to this target by this action.
double crit_healing = 16;

// Total shielding done to this target by this action.
double shielding = 13;

Expand Down Expand Up @@ -268,10 +287,9 @@ message UnitMetrics {
int32 unit_index = 13;

DistributionMetrics dps = 1;
DistributionMetrics dpasp = 16;
DistributionMetrics threat = 8;
DistributionMetrics dtps = 11;
DistributionMetrics tmi = 17;
DistributionMetrics tmi = 16;
DistributionMetrics hps = 14;
DistributionMetrics tto = 15; // Time To OOM, in seconds.

Expand Down
2 changes: 1 addition & 1 deletion proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ message ProtoVersion {
// protos need to define an api_version field so that the UI code knows
// to up-convert these protos to the new format whenever api_version is
// missing (0) or lower than current_version_number.
option (current_version_number) = 1;
option (current_version_number) = 2;

// The actual field value is only used within unit tests.
int32 saved_version_number = 1;
Expand Down
2 changes: 1 addition & 1 deletion sim/core/TestProtoVersioning.results
Original file line number Diff line number Diff line change
@@ -1 +1 @@
saved_version_number: 1
saved_version_number: 2
1 change: 1 addition & 0 deletions sim/core/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ const (
SpellFlagCombatPotion // Indicates this spell is the combat potion.
SpellFlagNoSpellMods // Indicates that no spell mods should be applied to this spell
SpellFlagCanCastWhileMoving // Allows the cast to be casted while moving
SpellFlagPassiveSpell // Indicates this spell is applied/cast as a result of another spell

// Used to let agents categorize their spells.
SpellFlagAgentReserved1
Expand Down
93 changes: 58 additions & 35 deletions sim/core/metrics_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func NewDistributionMetrics() DistributionMetrics {

type UnitMetrics struct {
dps DistributionMetrics
dpasp DistributionMetrics
threat DistributionMetrics
dtps DistributionMetrics
tmi DistributionMetrics
Expand Down Expand Up @@ -119,10 +118,14 @@ type CharacterIterationMetrics struct {
}

type ActionMetrics struct {
IsMelee bool // True if melee action, false if spell action.
IsMelee bool // True if melee action, false if spell action.
IsPassive bool // True if melee action, false if spell action.
1337LutZ marked this conversation as resolved.
Show resolved Hide resolved
SpellType proto.SpellType // Spell is cast, periodic (DoT or HoT) or both

// Metrics for this action, for each possible target.
Targets []TargetedActionMetrics

SpellSchool SpellSchool
1337LutZ marked this conversation as resolved.
Show resolved Hide resolved
}

type tmiListItem struct {
Expand All @@ -137,9 +140,12 @@ func (actionMetrics *ActionMetrics) ToProto(actionID ActionID) *proto.ActionMetr
}

return &proto.ActionMetrics{
Id: actionID.ToProto(),
IsMelee: actionMetrics.IsMelee,
Targets: targetMetrics,
Id: actionID.ToProto(),
IsMelee: actionMetrics.IsMelee,
IsPassive: actionMetrics.IsPassive,
SpellType: actionMetrics.SpellType,
Targets: targetMetrics,
SpellSchool: int32(actionMetrics.SpellSchool),
}
}

Expand All @@ -155,11 +161,13 @@ type SpellMetrics struct {
Parries int32
Blocks int32

TotalDamage float64 // Damage done by all casts of this spell.
TotalThreat float64 // Threat generated by all casts of this spell.
TotalHealing float64 // Healing done by all casts of this spell.
TotalShielding float64 // Shielding done by all casts of this spell.
TotalCastTime time.Duration
TotalDamage float64 // Damage done by all casts of this spell.
TotalCritDamage float64 // Damage done by all critical casts of this spell.
TotalThreat float64 // Threat generated by all casts of this spell.
TotalHealing float64 // Healing done by all casts of this spell.
TotalCritHealing float64 // Healing done by all critical casts of this spell.
TotalShielding float64 // Shielding done by all casts of this spell.
TotalCastTime time.Duration
}

type TargetedActionMetrics struct {
Expand All @@ -174,37 +182,40 @@ type TargetedActionMetrics struct {
Blocks int32
Glances int32

Damage float64
Threat float64
Healing float64
Shielding float64
CastTime time.Duration
Damage float64
CritDamage float64
Threat float64
Healing float64
CritHealing float64
Shielding float64
CastTime time.Duration
}

func (tam *TargetedActionMetrics) ToProto() *proto.TargetedActionMetrics {
return &proto.TargetedActionMetrics{
UnitIndex: tam.UnitIndex,

Casts: tam.Casts,
Hits: tam.Hits,
Crits: tam.Crits,
Misses: tam.Misses,
Dodges: tam.Dodges,
Parries: tam.Parries,
Blocks: tam.Blocks,
Glances: tam.Glances,
Damage: tam.Damage,
Threat: tam.Threat,
Healing: tam.Healing,
Shielding: tam.Shielding,
CastTimeMs: float64(tam.CastTime.Milliseconds()),
Casts: tam.Casts,
Hits: tam.Hits,
Crits: tam.Crits,
Misses: tam.Misses,
Dodges: tam.Dodges,
Parries: tam.Parries,
Blocks: tam.Blocks,
Glances: tam.Glances,
Damage: tam.Damage,
CritDamage: tam.CritDamage,
Threat: tam.Threat,
Healing: tam.Healing,
CritHealing: tam.CritHealing,
Shielding: tam.Shielding,
CastTimeMs: float64(tam.CastTime.Milliseconds()),
}
}

func NewUnitMetrics() UnitMetrics {
return UnitMetrics{
dps: NewDistributionMetrics(),
dpasp: NewDistributionMetrics(),
threat: NewDistributionMetrics(),
dtps: NewDistributionMetrics(),
tmi: NewDistributionMetrics(),
Expand Down Expand Up @@ -308,7 +319,16 @@ func (unitMetrics *UnitMetrics) addSpellMetrics(spell *Spell, actionID ActionID,
}

if !ok {
actionMetrics = &ActionMetrics{IsMelee: spell.Flags.Matches(SpellFlagMeleeMetrics)}
spellType := proto.SpellType_SpellTypeCast
if spell.dots != nil {
1337LutZ marked this conversation as resolved.
Show resolved Hide resolved
spellType = proto.SpellType_SpellTypePeriodic
}
actionMetrics = &ActionMetrics{
IsMelee: spell.Flags.Matches(SpellFlagMeleeMetrics),
IsPassive: spell.Flags.Matches(SpellFlagPassiveSpell),
SpellType: spellType,
SpellSchool: spell.SpellSchool,
}
unitMetrics.actions[actionID] = actionMetrics
}

Expand All @@ -322,7 +342,9 @@ func (unitMetrics *UnitMetrics) addSpellMetrics(spell *Spell, actionID ActionID,

for i, spellTargetMetrics := range spellMetrics {
tam := &actionMetrics.Targets[i]
tam.Casts += spellTargetMetrics.Casts
if !spell.Flags.Matches(SpellFlagPassiveSpell) {
tam.Casts += spellTargetMetrics.Casts
}
tam.Misses += spellTargetMetrics.Misses
tam.Hits += spellTargetMetrics.Hits
tam.Crits += spellTargetMetrics.Crits
Expand All @@ -331,10 +353,14 @@ func (unitMetrics *UnitMetrics) addSpellMetrics(spell *Spell, actionID ActionID,
tam.Blocks += spellTargetMetrics.Blocks
tam.Glances += spellTargetMetrics.Glances
tam.Damage += spellTargetMetrics.TotalDamage
tam.CritDamage += spellTargetMetrics.TotalCritDamage
tam.Threat += spellTargetMetrics.TotalThreat
tam.Healing += spellTargetMetrics.TotalHealing
tam.CritHealing += spellTargetMetrics.TotalCritHealing
tam.Shielding += spellTargetMetrics.TotalShielding
tam.CastTime += spellTargetMetrics.TotalCastTime
if !spell.Flags.Matches(SpellFlagPassiveSpell) {
tam.CastTime += spellTargetMetrics.TotalCastTime
}

target := spell.Unit.AttackTables[i].Defender
target.Metrics.dtps.Total += spellTargetMetrics.TotalDamage
Expand Down Expand Up @@ -373,7 +399,6 @@ func (unitMetrics *UnitMetrics) IsTanking() bool {

func (unitMetrics *UnitMetrics) reset() {
unitMetrics.dps.reset()
unitMetrics.dpasp.reset()
unitMetrics.threat.reset()
unitMetrics.dtps.reset()
unitMetrics.tmi.reset()
Expand Down Expand Up @@ -418,7 +443,6 @@ func (unitMetrics *UnitMetrics) doneIteration(unit *Unit, sim *Simulation) {
}

unitMetrics.dps.doneIteration(sim)
unitMetrics.dpasp.doneIteration(sim)
unitMetrics.threat.doneIteration(sim)
unitMetrics.dtps.doneIteration(sim)
unitMetrics.tmi.doneIteration(sim)
Expand Down Expand Up @@ -507,7 +531,6 @@ func (unitMetrics *UnitMetrics) ToProto() *proto.UnitMetrics {
n := float64(unitMetrics.dps.n)
protoMetrics := &proto.UnitMetrics{
Dps: unitMetrics.dps.ToProto(),
Dpasp: unitMetrics.dpasp.ToProto(),
Threat: unitMetrics.threat.ToProto(),
Dtps: unitMetrics.dtps.ToProto(),
Tmi: unitMetrics.tmi.ToProto(),
Expand Down
13 changes: 8 additions & 5 deletions sim/core/sim_concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (rsrc *raidSimResultCombiner) newUnitMetrics(baseUnit *proto.UnitMetrics) *
Name: baseUnit.Name,
UnitIndex: baseUnit.UnitIndex,
Dps: rsrc.newDistMetrics(),
Dpasp: rsrc.newDistMetrics(),
Threat: rsrc.newDistMetrics(),
Dtps: rsrc.newDistMetrics(),
Tmi: rsrc.newDistMetrics(),
Expand Down Expand Up @@ -152,9 +151,12 @@ func (rsrc *raidSimResultCombiner) addActionMetrics(unit *proto.UnitMetrics, add

if am == nil {
am = &proto.ActionMetrics{
Id: add.Id,
IsMelee: add.IsMelee,
Targets: make([]*proto.TargetedActionMetrics, len(add.Targets)),
Id: add.Id,
IsMelee: add.IsMelee,
IsPassive: add.IsPassive,
SpellType: add.SpellType,
Targets: make([]*proto.TargetedActionMetrics, len(add.Targets)),
SpellSchool: add.SpellSchool,
}
for i, addTgt := range add.Targets {
am.Targets[i] = &proto.TargetedActionMetrics{
Expand All @@ -178,8 +180,10 @@ func (rsrc *raidSimResultCombiner) addActionMetrics(unit *proto.UnitMetrics, add
baseTgt.Blocks += addTgt.Blocks
baseTgt.Glances += addTgt.Glances
baseTgt.Damage += addTgt.Damage
baseTgt.CritDamage += addTgt.CritDamage
baseTgt.Threat += addTgt.Threat
baseTgt.Healing += addTgt.Healing
baseTgt.CritHealing += addTgt.CritHealing
baseTgt.Shielding += addTgt.Shielding
baseTgt.CastTimeMs += addTgt.CastTimeMs
}
Expand Down Expand Up @@ -225,7 +229,6 @@ func (rsrc *raidSimResultCombiner) addResourceMetrics(unit *proto.UnitMetrics, a

func (rsrc *raidSimResultCombiner) combineUnitMetrics(base *proto.UnitMetrics, add *proto.UnitMetrics, isLast bool, weight float64) {
rsrc.combineDistMetrics(base.Dps, add.Dps, isLast, weight)
rsrc.combineDistMetrics(base.Dpasp, add.Dpasp, isLast, weight)
rsrc.combineDistMetrics(base.Threat, add.Threat, isLast, weight)
rsrc.combineDistMetrics(base.Dtps, add.Dtps, isLast, weight)
rsrc.combineDistMetrics(base.Tmi, add.Tmi, isLast, weight)
Expand Down
10 changes: 8 additions & 2 deletions sim/core/spell_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ func (spell *Spell) CalcAndDealOutcome(sim *Simulation, target *Unit, outcomeApp
func (spell *Spell) dealDamageInternal(sim *Simulation, isPeriodic bool, result *SpellResult) {
if sim.CurrentTime >= 0 {
spell.SpellMetrics[result.Target.UnitIndex].TotalDamage += result.Damage
if result.DidCrit() {
spell.SpellMetrics[result.Target.UnitIndex].TotalCritDamage += result.Damage
}
spell.SpellMetrics[result.Target.UnitIndex].TotalThreat += result.Threat
}

Expand All @@ -291,9 +294,9 @@ func (spell *Spell) dealDamageInternal(sim *Simulation, isPeriodic bool, result

if sim.Log != nil {
if isPeriodic {
spell.Unit.Log(sim, "%s %s tick %s. (Threat: %0.3f)", result.Target.LogLabel(), spell.ActionID, result.DamageString(), result.Threat)
spell.Unit.Log(sim, "%s %s tick %s (SpellSchool: %d). (Threat: %0.3f)", result.Target.LogLabel(), spell.ActionID, result.DamageString(), spell.SpellSchool, result.Threat)
} else {
spell.Unit.Log(sim, "%s %s %s. (Threat: %0.3f)", result.Target.LogLabel(), spell.ActionID, result.DamageString(), result.Threat)
spell.Unit.Log(sim, "%s %s %s (SpellSchool: %d). (Threat: %0.3f)", result.Target.LogLabel(), spell.ActionID, result.DamageString(), spell.SpellSchool, result.Threat)
}
}

Expand Down Expand Up @@ -399,6 +402,9 @@ func (dot *Dot) SnapshotHeal(target *Unit, baseHealing float64) {

// Applies the fully computed spell result to the sim.
func (spell *Spell) dealHealingInternal(sim *Simulation, isPeriodic bool, result *SpellResult) {
if result.DidCrit() {
spell.SpellMetrics[result.Target.UnitIndex].TotalCritHealing += result.Damage
}
spell.SpellMetrics[result.Target.UnitIndex].TotalHealing += result.Damage
spell.SpellMetrics[result.Target.UnitIndex].TotalThreat += result.Threat
if result.Target.HasHealthBar() {
Expand Down
12 changes: 12 additions & 0 deletions sim/core/test_result_compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,24 @@ func checkActionMetrics(t *testing.T, loc string, st []*proto.ActionMetrics, mt
continue
}

if stAction.SpellSchool != mtAction.SpellSchool {
t.Logf("%s.Actions: %s expected SpellSchool = %d but was %d in multi threaded results!", loc, stAction.Id.String(), stAction.SpellSchool, mtAction.SpellSchool)
t.Fail()
continue
}

if stAction.IsMelee != mtAction.IsMelee {
t.Logf("%s.Actions: %s expected IsMelee = %t but was %t in multi threaded results!", loc, stAction.Id.String(), stAction.IsMelee, mtAction.IsMelee)
t.Fail()
continue
}

if stAction.IsPassive != mtAction.IsPassive {
t.Logf("%s.Actions: %s expected IsPassive = %t but was %t in multi threaded results!", loc, stAction.Id.String(), stAction.IsPassive, mtAction.IsPassive)
t.Fail()
continue
}

compareValue(t, fmt.Sprintf("%s.Actions[%s]", loc, stAction.Id.String()), reflect.ValueOf(stAction.Targets), reflect.ValueOf(mtAction.Targets), baseFloatTolerance)
}
}
Expand Down
3 changes: 2 additions & 1 deletion sim/death_knight/blood/blood.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ func (bdk *BloodDeathKnight) ApplyTalents() {
shieldSpell := bdk.GetOrRegisterSpell(core.SpellConfig{
ActionID: core.ActionID{SpellID: 77535},
ProcMask: core.ProcMaskSpellHealing,
SpellSchool: core.SpellSchoolPhysical,
SpellSchool: core.SpellSchoolShadow,
Flags: core.SpellFlagPassiveSpell,

DamageMultiplier: 1,
ThreatMultiplier: 1,
Expand Down
Loading
Loading