Why aren't item statistics saved?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
User avatar
GuyNamedErick
Posts: 10
Joined: Sun Nov 05, 2017 9:33 pm
Location: Illinois, United States
Contact:

Why aren't item statistics saved?

Post by GuyNamedErick »

Recently I used the savestatistics CVAR to print out episode statistics after completing a TNT: Evilution playthrough. Looking into the stats, while I saw that the maps I have completed are shown, I noticed that no item stats were saved and dumped onto the stat file. Looking into statistics.cpp on the source code, I do see that mapnames, kills, secrets, and level times get saved into the stat file and save games, but items are not included. Any reason why that is? Wouldn't it be simple to add items and have them saved, at least for the save games (not sure on how they'll appear on the stat file)?

I did read that single level statistics is on the to-do list, though I still wonder as to why GZDoom cannot dump statistics after completing a level, similar to how PrBoom+'s -levelstat parameter works.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Why aren't item statistics saved?

Post by Graf Zahl »

This was just some old code that got plugged in there. Items weren't part of it and so far nobody has complained.
User avatar
GuyNamedErick
Posts: 10
Joined: Sun Nov 05, 2017 9:33 pm
Location: Illinois, United States
Contact:

Re: Why aren't item statistics saved?

Post by GuyNamedErick »

So the savestatistics and statfile CVARs were old features added that were never meant to be used by anybody and haven't been updated majorly since then? I'm aware this isn't a feature to be concerned of, though at its current state, would adding items cause any issues or not much at all? Although by the looks of the statistics.cpp file, the statfile output format doesn't look friendly to edit.
User avatar
GuyNamedErick
Posts: 10
Joined: Sun Nov 05, 2017 9:33 pm
Location: Illinois, United States
Contact:

Re: Why aren't item statistics saved?

Post by GuyNamedErick »

Okay I decided to add item statistics into save games and onto the statfile, tested it with the four original IWADs (including NUTS.wad), even a full playthrough of Doom 2 to test the output. No errors occurred from what I see between both save games and statfile output. I haven't been able to figure out how to get single level stats.

Code: Select all

DOOM.E1M1 "Knee-Deep in the Dead"
{
	 1. 15.06.2018 "   1/  70,    0/  41,   0/  4,  2" 00:00:12 3
	{
		E1M1     "   0/  29,    0/  38,   0/  3    " 00:00:00
		E1M8     "   1/  41,    0/   3,   0/  1    " 00:00:11
	}
	 2. 15.06.2018 "   1/  70,    0/  41,   0/  4,  2" 00:00:11 3
	{
		E1M1     "   0/  29,    0/  38,   0/  3    " 00:00:00
		E1M8     "   1/  41,    0/   3,   0/  1    " 00:00:10
	}
	 3. 16.06.2018 "  21/  25,    0/  40,   0/  4,  2" 00:00:13 0
	{
		E1M1     "   0/   4,    0/  37,   0/  3    " 00:00:00
		E1M8     "  21/  21,    0/   3,   0/  1    " 00:00:13
	}
}

DOOM.E2M1 "The Shores of Hell"
{
	 1. 15.06.2018 "  21/  75,    0/  18,   0/  4,  2" 00:00:03 3
	{
		E2M1     "   0/  54,    0/  16,   0/  4    " 00:00:00
		E2M8     "  21/  21,    0/   2,   0/  0    " 00:00:03
	}
	 2. 15.06.2018 "  21/  75,    0/  18,   0/  4,  2" 00:00:03 3
	{
		E2M1     "   0/  54,    0/  16,   0/  4    " 00:00:00
		E2M8     "  21/  21,    0/   2,   0/  0    " 00:00:03
	}
	 3. 15.06.2018 "  21/  75,    0/  18,   0/  4,  2" 00:00:03 3
	{
		E2M1     "   0/  54,    0/  16,   0/  4    " 00:00:00
		E2M8     "  21/  21,    0/   2,   0/  0    " 00:00:03
	}
	 4. 16.06.2018 "  21/  75,    0/  18,   0/  4,  2" 00:00:06 3
	{
		E2M1     "   0/  54,    0/  16,   0/  4    " 00:00:03
		E2M8     "  21/  21,    0/   2,   0/  0    " 00:00:03
	}
}

DOOM.E3M1 "Inferno"
{
	 1. 15.06.2018 "   4/  30,    0/   6,   0/  1,  2" 00:00:03 3
	{
		E3M1     "   0/  26,    0/   6,   0/  1    " 00:00:00
		E3M8     "   4/   4,    0/   0,   0/  0    " 00:00:03
	}
	 2. 15.06.2018 "  30/  30,    0/   6,   0/  1,  2" 00:00:04 3
	{
		E3M1     "  26/  26,    0/   6,   0/  1    " 00:00:00
		E3M8     "   4/   4,    0/   0,   0/  0    " 00:00:03
	}
	 3. 16.06.2018 "  30/  30,    2/   6,   1/  1,  2" 00:00:23 3
	{
		E3M1     "  26/  26,    2/   6,   1/  1    " 00:00:19
		E3M8     "   4/   4,    0/   0,   0/  0    " 00:00:03
	}
}

DOOM.E4M1 "Thy Flesh Consumed"
{
	 1. 15.06.2018 " 120/ 183,    0/  27,   0/  3,  2" 00:00:06 3
	{
		E4M1     "   0/  63,    0/  21,   0/  2    " 00:00:00
		E4M8     " 120/ 120,    0/   6,   0/  1    " 00:00:06
	}
	 2. 15.06.2018 " 120/ 183,    0/  27,   0/  3,  2" 00:00:10 3
	{
		E4M1     "   0/  63,    0/  21,   0/  2    " 00:00:00
		E4M8     " 120/ 120,    0/   6,   0/  1    " 00:00:10
	}
	 3. 16.06.2018 "  53/  86,    0/  27,   1/  3,  2" 00:00:09 1
	{
		E4M1     "   0/  33,    0/  21,   0/  2    " 00:00:00
		E4M8     "  53/  53,    0/   6,   1/  1    " 00:00:09
	}
}

DOOM2.MAP01 "Hell On Earth"
{
	 1. 15.06.2018 "   1/  28,    0/  15,   0/  5,  2" 00:00:08 3
	{
		MAP01    "   0/  27,    0/   9,   0/  5    " 00:00:00
		MAP30    "   1/   1,    0/   6,   0/  0    " 00:00:08
	}
	 2. 15.06.2018 "3880/3880, 1115/1121, 139/139, 32" 02:42:15 3
	{
		MAP01    "  27/  27,    9/   9,   5/  5    " 00:01:08
		MAP02    "  90/  90,   20/  20,   1/  1    " 00:01:47
		MAP03    "  78/  78,    9/   9,   1/  1    " 00:01:59
		MAP04    "  55/  55,   34/  34,   3/  3    " 00:01:51
		MAP05    " 124/ 124,    3/   3,   3/  3    " 00:03:22
		MAP06    " 114/ 114,   17/  17,   3/  3    " 00:04:20
		MAP07    "  19/  19,    6/   6,   1/  1    " 00:02:05
		MAP08    " 150/ 150,    5/   5,   7/  7    " 00:05:03
		MAP09    " 259/ 259,   47/  47,   6/  6    " 00:07:26
		MAP10    " 295/ 295,  100/ 100,  18/ 18    " 00:10:46
		MAP11    "  89/  89,   21/  21,   3/  3    " 00:04:34
		MAP12    " 109/ 109,    5/   5,   4/  4    " 00:05:18
		MAP13    " 126/ 126,   61/  61,   8/  8    " 00:08:34
		MAP14    "  84/  84,    2/   2,   0/  0    " 00:03:48
		MAP15    " 182/ 182,    8/   8,  10/ 10    " 00:09:35
		MAP16    " 161/ 161,    5/   5,   4/  4    " 00:05:45
		MAP17    " 132/ 132,  112/ 112,   3/  3    " 00:06:49
		MAP18    " 178/ 178,  182/ 182,   4/  4    " 00:06:55
		MAP19    " 208/ 208,   58/  58,   9/  9    " 00:07:45
		MAP20    " 101/ 101,   45/  45,   7/  7    " 00:07:04
		MAP21    " 128/ 128,   18/  18,   0/  0    " 00:03:54
		MAP22    "  56/  56,    7/   7,   3/  3    " 00:02:21
		MAP23    " 135/ 135,   22/  22,   2/  2    " 00:04:58
		MAP24    " 167/ 167,   49/  49,   4/  4    " 00:10:54
		MAP25    " 107/ 107,    2/   2,   2/  2    " 00:03:35
		MAP26    " 101/ 101,   58/  58,   4/  4    " 00:06:08
		MAP27    " 175/ 175,   93/  93,   7/  7    " 00:07:07
		MAP28    " 132/ 132,   25/  25,   7/  7    " 00:05:43
		MAP29    " 115/ 115,   25/  25,   0/  0    " 00:05:52
		MAP30    "   1/   1,    0/   6,   0/  0    " 00:00:10
		MAP31    " 149/ 149,   64/  64,   4/  4    " 00:04:01
		MAP32    "  33/  33,    3/   3,   6/  6    " 00:01:24
	}
	 3. 15.06.2018 "3880/3880, 1115/1121, 139/139, 32" 02:42:15 3
	{
		MAP01    "  27/  27,    9/   9,   5/  5    " 00:01:08
		MAP02    "  90/  90,   20/  20,   1/  1    " 00:01:47
		MAP03    "  78/  78,    9/   9,   1/  1    " 00:01:59
		MAP04    "  55/  55,   34/  34,   3/  3    " 00:01:51
		MAP05    " 124/ 124,    3/   3,   3/  3    " 00:03:22
		MAP06    " 114/ 114,   17/  17,   3/  3    " 00:04:20
		MAP07    "  19/  19,    6/   6,   1/  1    " 00:02:05
		MAP08    " 150/ 150,    5/   5,   7/  7    " 00:05:03
		MAP09    " 259/ 259,   47/  47,   6/  6    " 00:07:26
		MAP10    " 295/ 295,  100/ 100,  18/ 18    " 00:10:46
		MAP11    "  89/  89,   21/  21,   3/  3    " 00:04:34
		MAP12    " 109/ 109,    5/   5,   4/  4    " 00:05:18
		MAP13    " 126/ 126,   61/  61,   8/  8    " 00:08:34
		MAP14    "  84/  84,    2/   2,   0/  0    " 00:03:48
		MAP15    " 182/ 182,    8/   8,  10/ 10    " 00:09:35
		MAP16    " 161/ 161,    5/   5,   4/  4    " 00:05:45
		MAP17    " 132/ 132,  112/ 112,   3/  3    " 00:06:49
		MAP18    " 178/ 178,  182/ 182,   4/  4    " 00:06:55
		MAP19    " 208/ 208,   58/  58,   9/  9    " 00:07:45
		MAP20    " 101/ 101,   45/  45,   7/  7    " 00:07:04
		MAP21    " 128/ 128,   18/  18,   0/  0    " 00:03:54
		MAP22    "  56/  56,    7/   7,   3/  3    " 00:02:21
		MAP23    " 135/ 135,   22/  22,   2/  2    " 00:04:58
		MAP24    " 167/ 167,   49/  49,   4/  4    " 00:10:54
		MAP25    " 107/ 107,    2/   2,   2/  2    " 00:03:35
		MAP26    " 101/ 101,   58/  58,   4/  4    " 00:06:08
		MAP27    " 175/ 175,   93/  93,   7/  7    " 00:07:07
		MAP28    " 132/ 132,   25/  25,   7/  7    " 00:05:43
		MAP29    " 115/ 115,   25/  25,   0/  0    " 00:05:52
		MAP30    "   1/   1,    0/   6,   0/  0    " 00:00:10
		MAP31    " 149/ 149,   64/  64,   4/  4    " 00:04:01
		MAP32    "  33/  33,    3/   3,   6/  6    " 00:01:24
	}
	 4. 16.06.2018 "   0/  19,    0/  15,   0/  5,  2" 00:00:10 2
	{
		MAP01    "   0/  19,    0/   9,   0/  5    " 00:00:00
		MAP30    "   0/   0,    0/   6,   0/  0    " 00:00:10
	}
}

NUTS.MAP01 "Hell On Earth"
{
	 1. 16.06.2018 "10687/10687,   10/  45,   1/  1,  3" 00:00:31 2
	{
		MAP01    "10617/10617,    0/  19,   0/  0  " 00:00:00
		MAP02    "  70/  70,   10/  20,   1/  1    " 00:00:21
		MAP30    "   0/   0,    0/   6,   0/  0    " 00:00:09
	}
}

PLUTONIA.MAP01 "The Plutonia Experiment"
{
	 1. 15.06.2018 "   1/  65,    0/   2,   0/  1,  2" 00:00:12 2
	{
		MAP01    "   0/  42,    0/   0,   0/  1    " 00:00:00
		MAP30    "   1/  23,    0/   2,   0/  0    " 00:00:12
	}
	 2. 15.06.2018 "   1/  63,    0/   2,   0/  1,  2" 00:00:10 1
	{
		MAP01    "   0/  40,    0/   0,   0/  1    " 00:00:00
		MAP30    "   1/  23,    0/   2,   0/  0    " 00:00:10
	}
	 3. 16.06.2018 "   1/  63,    1/   2,   0/  1,  2" 00:00:14 0
	{
		MAP01    "   0/  40,    0/   0,   0/  1    " 00:00:00
		MAP30    "   1/  23,    1/   2,   0/  0    " 00:00:14
	}
}

TNT.MAP01 "TNT: Evilution"
{
	 1. 15.06.2018 "   0/  57,    0/   9,   1/  2,  2" 00:00:18 0
	{
		MAP01    "   0/  22,    0/   6,   0/  1    " 00:00:00
		MAP30    "   0/  35,    0/   3,   1/  1    " 00:00:18
	}
	 2. 15.06.2018 "   0/ 110,    0/   8,   1/  2,  2" 00:00:22 3
	{
		MAP01    "   0/  36,    0/   6,   0/  1    " 00:00:00
		MAP30    "   0/  74,    0/   2,   1/  1    " 00:00:22
	}
	 3. 15.06.2018 "  36/ 160,    6/  11,   2/  6,  3" 00:01:23 2
	{
		MAP01    "  36/  36,    6/   6,   1/  1    " 00:01:07
		MAP02    "   0/  70,    0/   3,   0/  4    " 00:00:00
		MAP30    "   0/  54,    0/   2,   1/  1    " 00:00:15
	}
	 4. 16.06.2018 "  30/ 197,    6/  11,   2/  6,  3" 00:00:59 3
	{
		MAP01    "  25/  36,    6/   6,   1/  1    " 00:00:32
		MAP02    "   5/  87,    0/   3,   0/  4    " 00:00:07
		MAP30    "   0/  74,    0/   2,   1/  1    " 00:00:18
	}
}

I was thinking of replacing the statfile output to something similar to the stored statistics of save games or just something less archaic, but for now I just want to add in item statistics.
https://github.com/guynamederick/gzdoom ... istics.cpp
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Why aren't item statistics saved?

Post by Graf Zahl »

Can you make a pull request? Also, can this read old statfiles? If this works I'd be happy to add it, but first I need it in a form I can actually test without setting up a new project.
Regarding the file format - yes, it definitely needs to be handled better. That stuff is nearly 15 years old and was initially done just as a private thing that later only got added because someone asked for it.
User avatar
GuyNamedErick
Posts: 10
Joined: Sun Nov 05, 2017 9:33 pm
Location: Illinois, United States
Contact:

Re: Why aren't item statistics saved?

Post by GuyNamedErick »

Alright, I'll consider doing a pull request. As for old statfiles, I just tested a statfile dumped from GZDoom 3.4.1 with my small edit. New statistics are added without any incompatibilities to the statfile aside of the old stat info appearing "short." There are incompatibilities if using an old save file as they don't include item statistics, causing an error to the statfile, although regular play remains unaffected otherwise.

Old Statfile with new build (and new save):

Code: Select all

DOOM.E2M1 "The Shores of Hell"
{
	 1. 17.06.2018 "  30/ 730,   0/ 51,  8           " 00:00:17 3
	{
		E2M1     "   9/  54,   0/  4               " 00:00:14
		E2M2     "   0/ 115,   0/ 12               " 00:00:00
		E2M3     "   0/  86,   0/  6               " 00:00:00
		E2M4     "   0/  80,   0/ 10               " 00:00:00
		E2M5     "   0/ 138,   0/ 10               " 00:00:00
		E2M6     "   0/ 141,   0/  3               " 00:00:00
		E2M7     "   0/  95,   0/  6               " 00:00:00
		E2M8     "  21/  21,   0/  0               " 00:00:03
	}
	 2. 17.06.2018 "   1/  16,    1/  18,   0/  4,  2" 00:00:06 1
	{
		E2M1     "   0/  15,    0/  16,   0/  4    " 00:00:00
		E2M8     "   1/   1,    1/   2,   0/  0    " 00:00:06
	}
	 3. 17.06.2018 "  39/ 744,    5/ 243,   1/ 52,  9" 00:00:42 3
	{
		E2M1     "   8/  54,    1/  16,   1/  4    " 00:00:14
		E2M2     "   1/ 115,    3/  48,   0/ 12    " 00:00:04
		E2M3     "   2/  86,    0/  31,   0/  6    " 00:00:01
		E2M4     "   0/  80,    0/  46,   0/ 10    " 00:00:00
		E2M5     "   2/ 138,    0/  40,   0/ 10    " 00:00:03
		E2M6     "   3/ 141,    0/  31,   0/  3    " 00:00:03
		E2M7     "   2/  95,    0/  27,   0/  6    " 00:00:06
		E2M8     "  21/  21,    1/   2,   0/  0    " 00:00:06
		E2M9     "   0/  14,    0/   2,   0/  1    " 00:00:00
	}
}
With old save (MAP01 shows the error):

Code: Select all

DOOM2.MAP01 "Hell On Earth"
{
	 1. 17.06.2018 " 201/ 251,  346/ 191,   2/ 10,  5" 00:01:11 3
	{
		MAP01    "   6/  27,  327/ 122,   0/  5    " 00:00:19
		MAP02    "  90/  90,   14/  20,   1/  1    " 00:00:22
		MAP03    "  78/  78,    0/   9,   1/  1    " 00:00:05
		MAP04    "  26/  55,    4/  34,   0/  3    " 00:00:12
		MAP30    "   1/   1,    1/   6,   0/  0    " 00:00:09
	}
}
Using a new statfile on a copy of GZDoom that isn't my build would cause some bad errors but that's to be expected. Swapping the items and secrets statistics haven't caused any errors to the new statfile either. Other WADs were tested with the same statfile.

Stat swap (and old statfile output):

Code: Select all

DOOM.E2M1 "The Shores of Hell"
{
	 1. 17.06.2018 "  75/  75,   0/  4,    0/  18,  2" 00:00:03 3
	{
		E2M1     "  54/  54,   0/  4,    0/  16    " 00:00:00
		E2M8     "  21/  21,   0/  0,    0/   2    " 00:00:03
	}
	 2. 17.06.2018 "  75/  75,   1/  4,  2           " 00:00:14 3
	{
		E2M1     "  54/  54,   1/  4               " 00:00:11
		E2M8     "  21/  21,   0/  0               " 00:00:03
	}
	 3. 17.06.2018 "  75/  75,    0/  18,   0/  4,  2" 00:00:03 3
	{
		E2M1     "  54/  54,    0/  16,   0/  4    " 00:00:00
		E2M8     "  21/  21,    0/   2,   0/  0    " 00:00:03
	}
}

DOOM2.MAP01 "Hell On Earth"
{
	 1. 17.06.2018 "  28/ 118,   0/  6,    1/  35,  3" 00:00:17 3
	{
		MAP01    "  27/  27,   0/  5,    1/   9    " 00:00:07
		MAP02    "   0/  90,   0/  1,    0/  20    " 00:00:00
		MAP30    "   1/   1,   0/  0,    0/   6    " 00:00:10
	}
	 2. 17.06.2018 "   3/  28,    1/  15,   0/  5,  2" 00:00:12 3
	{
		MAP01    "   2/  27,    1/   9,   0/  5    " 00:00:03
		MAP30    "   1/   1,    0/   6,   0/  0    " 00:00:08
	}
}

TNT.MAP01 "TNT: Evilution"
{
	 1. 17.06.2018 "   9/ 110,    1/   8,   1/  2,  2" 00:00:32 3
	{
		MAP01    "   4/  36,    1/   6,   0/  1    " 00:00:06
		MAP30    "   5/  74,    0/   2,   1/  1    " 00:00:26
	}
}
I still haven't been able to add single-level statistics as the current file format is overly specific to the point that dumping stats for a single level would be clunky. For now item statistics will do, it's a trivial addition.

Edit: Pull request up: https://github.com/coelckers/gzdoom/pull/509
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Why aren't item statistics saved?

Post by Graf Zahl »

GuyNamedErick wrote:I still haven't been able to add single-level statistics as the current file format is overly specific to the point that dumping stats for a single level would be clunky. For now item statistics will do, it's a trivial addition.
That will probably require changing the output to something easier to parse, like JSON. Don't expect this to be high priority, though.
The format as it is now was originally designed to be easily readable, nothing more. I only tacked the parser on after I has already accumulated quite a bit of data and had to read it back.
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Why aren't item statistics saved?

Post by Gez »

Would it make sense to add the score, if it is non-zero?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Why aren't item statistics saved?

Post by Graf Zahl »

Only with a new save format. Is anyone willing to implement it? It's not really high on my list of priorities...
Post Reply

Return to “General”