Here is a Charting Function for showing game statistics during the game. Instructions for Installation:
Insert the Chartinit() command in the LevelSetup AFTER the map has been seeded.
Insert the Chart() command in the ScreenDraw function. If the map does not have a ScreenDraw function you will have to create one.
Place the function Chartinit() and the function Chart() anywhere you choose.Instructions for Use:
When the game starts and the map is seeded, the Chart function will begin recording each Empire's number of asteroids owned and also total seedlings at regular intervals.
Once two data points are recorded, a red Divider-marker will appear on the left edge of the screen. You can now activate the charts by placing the mouse cursor on the left side of the screen.
Placing the cursor in the top half will display Asteroids owned. Placing the cursor in the bottom half will dispay total seedlings.
The Player's Stats will be GREEN- Empire number One.
As more data points are accumulated, the chart will compress horizontally and vertically to fill the bottom half of the screen.
On the right of the screen are tick-marks. For the Asteroid Stats, each tick mark is an asteroid. For the Seedling Chart, each tick is an active Faction.
At the top left of the screen is a graphical representation of the current Factions who own at least one Asteroid, placed sequentially from left to right (0 to 11).
Unfortunately, the Faction colors in the game will only match the chart colors by coincidence, i.e. when pigs fly!However, if an Empire appears anywhere on screen, the Empire Icon will be underlined and highlighted. This will enable you to correlate the Graph colors with the factions in the game.
Displaying the charts will significantly slow down the framerate, but otherwise will not affect game play.Notes:
The default settings are 250 data points at 40 second/cycle intervals. This should be more than sufficient for most games. By adjusting these numbers you can increase the frequency resolution or extend the recording time (see code). I like using 20 second intervals but some longer games will then require more data points to complete. Sixty second intervals should be enough for practically any game! I am not sure how much CPU drain the data recording and other codes entail, but I haven't noticed any changes on my computer. However, activating and drawing the charts will significantly slow the framerate.
I have not encountered any maps that would not work with this function, and find it makes older maps I no longer play interesting again.Updated Version 1.1: Empire Icons will now only appear when charts are activated. If a given Empire appears on screen, the Icon will brighten and be underlined. Those Empires on screen will also be highlighted in the Graphing area, making it easier to identify individual Factions
.Updated Version 1.2: Found a small error where tickmarks were not displaying properly in the Seedling Graph. Faction total was doubling. Removed offending line of code.
Any problems to report, glitches, suggestions, or comments are welcome!