Opened 9 years ago

Last modified 7 years ago

#3403 closed enhancement

[PATCH] Show graphs in the summary screen — at Version 9

Reported by: elexis Owned by:
Priority: Should Have Milestone: Alpha 22
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by elexis)

Concept We should have some charts in the summary screen, so that the advancement of the game can be understood. The particular score should be plotted on the Y-axis with time on the X-axis. We should show the same categories that we already display for the end of the game. Implementation Saving stats over time: As seen in leaveGame() in session.js, we would only need to capture Engine.GuiInterfaceCall("GetExtendedSimulationState").players every N minutes and pass it to the summary screen. It currently contains the following data per player:

{
    "unitsTrained": {
        "Infantry": 0,
        "Worker": 0,
        "Female": 0,
        "Cavalry": 0,
        "Champion": 0,
        "Hero": 0,
        "Ship": 0,
        "Trader": 0,
        "total": 0
    },
    "unitsLost": {
        "Infantry": 0,
        "Worker": 0,
        "Female": 0,
        "Cavalry": 0,
        "Champion": 0,
        "Hero": 0,
        "Ship": 0,
        "Trader": 0,
        "total": 0
    },
    "unitsLostValue": 0,
    "enemyUnitsKilled": {
        "Infantry": 0,
        "Worker": 0,
        "Female": 0,
        "Cavalry": 0,
        "Champion": 0,
        "Hero": 0,
        "Ship": 0,
        "Trader": 0,
        "total": 0
    },
    "enemyUnitsKilledValue": 0,
    "buildingsConstructed": {
        "House": 0,
        "Economic": 0,
        "Outpost": 0,
        "Military": 0,
        "Fortress": 0,
        "CivCentre": 0,
        "Wonder": 0,
        "total": 0
    },
    "buildingsLost": {
        "House": 0,
        "Economic": 0,
        "Outpost": 0,
        "Military": 0,
        "Fortress": 0,
        "CivCentre": 0,
        "Wonder": 0,
        "total": 0
    },
    "buildingsLostValue": 0,
    "enemyBuildingsDestroyed": {
        "House": 0,
        "Economic": 0,
        "Outpost": 0,
        "Military": 0,
        "Fortress": 0,
        "CivCentre": 0,
        "Wonder": 0,
        "total": 0
    },
    "enemyBuildingsDestroyedValue": 0,
    "resourcesGathered": {
        "food": 0,
        "wood": 0,
        "metal": 0,
        "stone": 0,
        "vegetarianFood": 0
    },
    "resourcesUsed": {
        "food": 0,
        "wood": 0,
        "metal": 0,
        "stone": 0
    },
    "resourcesSold": {
        "food": 0,
        "wood": 0,
        "metal": 0,
        "stone": 0
    },
    "resourcesBought": {
        "food": 0,
        "wood": 0,
        "metal": 0,
        "stone": 0
    },
    "tributesSent": 0,
    "tributesReceived": 0,
    "tradeIncome": 0,
    "treasuresCollected": 0,
    "lootCollected": 0,
    "percentMapExplored": 16,
    "teamPercentMapExplored": 16,
    "percentMapControlled": 12,
    "teamPercentMapControlled": 12,
    "peakPercentMapControlled": 0,
    "teamPeakPercentMapControlled": 0
}

This takes about 10kb space for 8 players. So saving a state every minute would cost roughly 1MB memory every 2 hours. In case #3258 will be implemented, it should save those states using zip compression, reducing the file size by maybe 90%. Displaying the charts: We could have a checkbox somewhere (for example besides the button) to toggle between charts and numbers. This way you can switch between tabs and correlate the graphs of the different tabs.

Change History (10)

comment:1 by elexis, 9 years ago

There has been a charts mod out there, see: http://wildfiregames.com/forum/index.php?showtopic=18763&page=2 (version 17 & 18) https://github.com/agentx-cgn/Mod-Chart (version 17)

But it has some flaws:

  • outdated (r15952)
  • it renders the graphs by printing png images containing colored dots - I hope we can render actual lines.
  • it only tracks buildings, units and resources.

comment:2 by s0600204, 9 years ago

I've taken the liberty of forking and updating the charts-mod elexis mentioned so it now works with the current SVN state. The updated mod may be acquired from https://github.com/0ADMods/summary-charts.

It would be nice to have a better way of doing the GUI stuff however, and perhaps some thought could be given as to specifics after A19 ships.

comment:3 by Stan, 9 years ago

Keywords: patch review added
Owner: set to Stan
Status: newassigned
Summary: Show graphs in the summary screen[PATCH] Show graphs in the summary screen

The following patch was made by AgentX and modified by s0600204 to be compatible, I just made the patch. Note that you will probably have to copy the png files as the patch don't support binary well.

by Stan, 9 years ago

Attachment: 3403.patch added

comment:4 by Stan, 9 years ago

Owner: Stan removed
Status: assignednew

comment:5 by elexis, 9 years ago

Milestone: BacklogAlpha 20

Interested.

The c++ GUI part might become somewhat tedious.

comment:6 by leper, 8 years ago

Keywords: review removed
Milestone: Alpha 20Backlog

Given that the original mod isn't under any specified license and the modifications do not change that (how could they), this cannot be included as it is.

Also unless there is some work on having the actual graph drawing done in C++ (or at least not by using a hack on top of the gui repeat code) this is unlikely to be included.

comment:7 by Stan, 8 years ago

I'm going to ask AgentX about the license.

comment:8 by Stan, 8 years ago

AgentX is going to put it under the M.I.T. License.

About the hack he replied that's how he was told to do it on the forums when he started it.

comment:9 by elexis, 8 years ago

Description: modified (diff)
Priority: Nice to HaveShould Have
Note: See TracTickets for help on using tickets.