MegaMek / megamek

MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight using giant robots, tanks, and/or infantry on a hex-based map.
http://www.megamek.org
GNU General Public License v2.0
292 stars 280 forks source link

[RFE] Make an alternate gamelog format to make summarizing game stats easier #4127

Open GiovanniBertuccio opened 1 year ago

GiovanniBertuccio commented 1 year ago

Environment

This should apply to all versions and platforms

Description

I'd like an alternate or additional game log format to make summarizing game stats easier.

A flat file that meets one of the Normal forms would be convenient. Something like below for each attack in the weapons and physicals phases is a good start, though I'm not sure the exact format that will work yet.

turn, phase, player, unit ID, unit name, target ID, target name, weapon lookupname, ammunition type, base weapon damage, to-hit target, roll, damage done
2, Weapon Attack Phase, Bertuccio, 4, Flashman FLS-9B, 14, Galahad GLH-1D, IS ER Large Laser, NA, 8, 10, 8, 8
2, Weapon Attack Phase, Opfor, 12, Kodiak 2, 17, Scorpion SCP-1N, Clan ER Large Laser, NA, 10, 7, 6, 0
2, Weapon Attack Phase, Bertuccio, 11, Cataphract CTF-4X, 14, Galahad GLD-1D, AC/5, AC/5 Precision Ammo, 5, 5, 8, 5
2 Physical Attack Phase, Bertuccio, 4, Flashman FLS-9B, 14, Galahad GLH-1D, punch (left arm), NA, 8, 9, 8, 0

I have a rough prototype, but the existing format is difficult for a computer to parse and also uses conventions that are basically impossible to distinguish. Such as Clan and IS ER Large Lasers are both called "ER Large Laser" in the log, but have different damage values.

To entice a dev to do this, here is an example partial output from my current program. I use anydice.com right now for the visuals:

https://anydice.com/program/2d31e Press the "Graph" button for a chart of the probability curves for each team. These show how much damage each player could potentially do based on the to-hit targets they were rolling against. In this case, the Youngbloods team's to-hit were more likely to do more damage than the other team's to-hits, regardless of how of how well either player rolled.

Below is a by-unit comparison of the expected damage a unit could do based on their weapon damage and to-hit targets, and how much damage they really did after rolling. The "expdamage" column is the expected damage (as in base weapon damage * probability of hitting), "actualdamage" is how much damage the unit did after actually rolling, this is usually the base weapon damage, but is variable for cluster weapons. And "ratio" is the comparison of the two. Ratios above 1 mean the unit did more damage than expected, and between 0 and 1 mean the unit did less damage than expected.

Hunchback HBK-4G ID:13 did better than expected, AC/20s tends to be feast or famine. Whitworth WTH-1 ID:14 both produced a lot of expected damage, and got quite a bit lucky with their rolls. Galahad GLH-1D ID:4 also got lucky, doing 75% more damage than expected.

          team                                                     unit  expdamage actualdamage ratio
1    Mr. OpFor                     Grasshopper GHR-5N ID:16 (Mr. OpFor)  9.8611111         10.0  1.01
2    Mr. OpFor                       Hunchback HBK-4G ID:13 (Mr. OpFor) 35.8333333         70.0  1.95
3    Mr. OpFor Maxim Heavy Hover Transport (Standard) ID:21 (Mr. OpFor)  0.4444444          0.0  0.00
4    Mr. OpFor                     Phoenix Hawk PXH-1 ID:22 (Mr. OpFor) 34.7222222         54.0  1.56
5    Mr. OpFor         Scorpion Light Tank (Standard) ID:26 (Mr. OpFor) 11.5555556         10.0  0.87
6    Mr. OpFor          Striker Light Tank (Standard) ID:25 (Mr. OpFor) 10.5472222          6.3  0.60
7    Mr. OpFor                       Trebuchet TBT-5S ID:15 (Mr. OpFor) 50.5000000         46.0  0.91
8    Mr. OpFor              Vedette Medium Tank (AC2) ID:23 (Mr. OpFor) 22.5555556         22.4  0.99
9    Mr. OpFor                           Vulcan VL-2T ID:27 (Mr. OpFor)  0.2333333          0.0  0.00
10   Mr. OpFor                       Warhammer WHM-6R ID:24 (Mr. OpFor) 31.0555556         28.0  0.90
11   Mr. OpFor                        Whitworth WTH-1 ID:14 (Mr. OpFor) 96.7027778        148.2  1.53
12   Mr. OpFor                        Whitworth WTH-1 ID:28 (Mr. OpFor)  6.4750000         25.2  3.89
13 Youngbloods                      Catapult CPLT-C1 ID:8 (Youngbloods) 65.0833333        107.0  1.64
14 Youngbloods                       Crossbow CRS-6B ID:7 (Youngbloods) 56.9777778         40.0  0.70
15 Youngbloods                        Galahad GLH-1D ID:4 (Youngbloods) 70.2777778        124.0  1.76
16 Youngbloods                      Quickdraw QKD-5A ID:9 (Youngbloods) 60.9527778         65.9  1.08
17 Youngbloods                       Rifleman RFL-5M ID:2 (Youngbloods) 21.5555556         16.0  0.74
18 Youngbloods                   Thunderbolt TDR-9SE ID:1 (Youngbloods) 70.6583333         81.5  1.15
19 Youngbloods                  Vulcan VL-2T (Timms) ID:5 (Youngbloods) 22.8055556         27.8  1.22
20 Youngbloods                      Whitworth WTH-1 ID:11 (Youngbloods) 54.9861111         42.8  0.78
21 Youngbloods                      Whitworth WTH-1 ID:12 (Youngbloods) 58.0500000         59.1  1.02

I've found this tool helpful to learn about how well I played, and how much luck had a factor in the game. I hope to make it reliable enough for anyone to use.

SuperStucco commented 1 year ago

I would have a preference of XML over CSV. Although a bit longer character-wise it's easier to query e.g. looking for all elements with a "Player Name" sub-element, or finding all medium laser results by finding all Attack elements with a "Medium laser" in a weapon_name attribute. Also easier to do summaries and basic analysis, and generate HTML reports, by applying standardized XSLT templates.