Page 1 of 1

Request: Dump printstats to file after each map

Posted: Sat Dec 20, 2014 6:25
by eLim
Greetings.
I'm currently developing a program for PrBoom+ (and probably CNDoom) which can show the progress of a speedrun automatically. This is useful for people who stream Doom.
PrBoom+ has a parameter -levelstat which dumps the run information thus far at the end of each map completion. My program simply checks this file periodically for updates and displays the results.
I have noticed that your console command "printstats" contains exactly the information I need for this. I've not found a way to dump this information periodically to a file which can be read externally. If possible, could you please add this as a parameter or an option within the config file?

Let me know if I've missed something or if I'm being hard to understand.
Thanks.

Re: Request: Dump printstats to file after each map

Posted: Sat Dec 20, 2014 9:58
by Gez

Re: Request: Dump printstats to file after each map

Posted: Sat Dec 20, 2014 13:15
by Graf Zahl
The only thing to remember is that these only save after completing a game, but aside from that should do what you need.

Re: Request: Dump printstats to file after each map

Posted: Sat Dec 20, 2014 23:43
by eLim
Hi thanks for the response.
I can't seem to get savestatistics to produce a file under any circumstances. I have altered savestatistics to 1 in the config file. However, playing the game and completing a few levels then exiting the game does not produce a statfile. Am I missing something obvious here?
You mention that the file saves "after completing a game". Does this refer to the entire game being completed? My program wants to update after every map completion. That way if you're speedrunning a mapset, the stream viewers can see how long it took you to complete each map in doom-time, rather than relying on real-time program like livesplit. I compare these times against a user-inputted file (such as the current world record times for the mapset) and generate on-the-fly time differences.

Re: Request: Dump printstats to file after each map

Posted: Sat Jan 30, 2016 0:28
by hobomaster22
Hi,

I figured I would bump this thread because this has been driving me nuts and I could not find anything else on the subject. I checked the source in STAT_ChangeLevel and it looks the file will only be written at the end of the game/episode.

There is a comment for // todo: handle single level statistics, if savestatistics is 2. Like the OP, I also cannot get the statfile to be written, even at the end of the game/episode. I currently am unable to get the source to compile to debug further.

Re: Request: Dump printstats to file after each map

Posted: Sun Jan 31, 2016 14:59
by hobomaster22
OK, I finally got everything installed in order to debug. unfortunately this feature is overly specific to the point that is almost useless. As the very least, the savestatistics command documentation should be updated. It only works if you start a new game through the menu. Warping or using the map command does not set the StartEpisode variable which will stop this from working. The main reason I was looking into this because I wanted to add a feature in my launcher to parse the statistics. They would need to dumped every map, which is not the case.

However, I did find that the statistics are being written to save games (SerializeStatistics in statistics.cpp) so I'm working to parse that out. It's much more painful to parse binary but it works.

Re: Request: Dump printstats to file after each map

Posted: Sun Jan 31, 2016 16:16
by Graf Zahl
hobomaster22 wrote:OK, I finally got everything installed in order to debug. unfortunately this feature is overly specific to the point that is almost useless.

Don't tell me.
It was originally meant for private use, someone requested something along these lines so I just added it as-is. There's certainly lots of room for improvement here, just nobody with any serious interest in expanding it.

Re: Request: Dump printstats to file after each map

Posted: Sun Jan 31, 2016 16:39
by hobomaster22
I understand. Thanks for the reply :)

I was originally happy with using the stats in the save game. Until I figured out this method won't work with the last level...

There is a lot of work in the code so it's very easily updated to write each level's stats at the end of each level. I've already done it because I couldn't help but play it with it.