Statistics driver

Doom incorporates the ability to integrate with an external statistics driver: in this setup, the Doom engine is invoked by an external statistics program. At the end of each level, Doom passes statistics about the level back to the statistics program.

A statistics driver has been written by Simon "Fraggle" Howard in late 2007

Technical
The system works using the statcopy command line argument. The statistics program passes the address in memory of a structure in which to place statistics. For example, the following would instruct Doom to place statistics in the memory location "1234567":

doom -statcopy 1234567

The structures used (in C, taken from Chocolate Doom's d_player.h file) for the data is in the following format: // // INTERMISSION // Structure passed e.g. to WI_Start(wb) // typedef struct {   boolean	in;	// whether the player is in game // Player stats, kills, collected items etc.   int		skills; int		sitems; int		ssecret; int		stime; int		frags[4]; int		score;	// current score on entry, modified on return } wbplayerstruct_t;

typedef struct {   int		epsd;	// episode # (0-2)

// if true, splash the secret level boolean	didsecret; // previous and next levels, origin 0 int		last; int		next; int		maxkills; int		maxitems; int		maxsecret; int		maxfrags;

// the par time int		partime; // index of this player in game int		pnum;

wbplayerstruct_t	plyr[MAXPLAYERS];

} wbstartstruct_t;

At the start of each level, statistics are then copied into this buffer. There is no trigger activated to inform the statistics driver that this has occurred. The statistics driver would have to set up its own timer to periodically check the buffer for new information.

This system is only possible because of DOS's lack of memory protection: this kind of sharing of memory is not so easily possible in modern operating systems.