Page MenuHomeWildfire Games

Fix economy and military score
ClosedPublic

Authored by Imarok on May 14 2017, 12:43 AM.

Details

Summary

Economy score should be the sum of all gathered resources divided by 10, but since rP14703 the economy score is the sum of all gathered resources + the gathered vegetarian food divided by ten.
Military score should also contain the value of captured units.

Test Plan

The economy score should be a tenth of the total gathered resources minus the costs for training of corral animals.
The military score should contain the value of captured units.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Imarok created this revision.May 14 2017, 12:43 AM
Imarok retitled this revision from FIx economyScore to Fix economyScore.

The purpose of adding vegetarian food is so that corral users don't get double the food score of farmers - corral users should subtract the cost of sheep, from the food they produce. If you exclude vegetarian food entirely as in this patch, corrals would be overcounted in the score.

Prior to this patch, the problem is that it counts food twice, compared to the other resources. To fix that, in this patch it should instead add 50% of the food score to 50% of vegetarian food, plus the other resources, and divide by 10. Unless you want to do it perfectly by subtracting the cost of sheep/goats/pigs from the economy score, which is more difficult.

causative requested changes to this revision.EditedMay 14 2017, 1:14 AM

In more detail, what matters is the net food you're getting out of the corrals after the cost of the sheep; that's the figure that should be compared to field food. If your corrals are giving you X food/sec neglecting the cost of the sheep, and another player's farms are giving them X/2 food/sec, then you are both able to sustain the same army production with respect to food. If carnivore food is counted the same as vegetarian food, then over a long game, a given economy size using corrals would get an inflated score compared to a field economy.

Counting carnivore food as 50% relative to vegetarian food is how it worked before, and though it's buggy, there is a justification for doing it that way - solving that bug by creating a new one, where corral users get inflated economy scores, is worse imo. Over a longer game, counting carnivore food as 50% is closer to the perfect solution of subtracting sheep.

This revision now requires changes to proceed.May 14 2017, 1:14 AM
elexis added a subscriber: elexis.May 14 2017, 1:17 AM

A comment might be added to the code if that design decision is accepted, so that other devs don't assume its a bug either.
We might want to write a ticket to count the sheep-food differently explicitly (so that fishing and hunting is still counted correctly)

Vulcan added a subscriber: Vulcan.May 14 2017, 3:07 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1190/ for more details.

Imarok updated this revision to Diff 1916.May 14 2017, 12:25 PM
Imarok edited edge metadata.

Subtract cost of goats/sheep/pigs. Also add the trading income to economy score.

Imarok updated this revision to Diff 1917.May 14 2017, 12:39 PM

Add capturedUnitValue to military score.

Imarok retitled this revision from Fix economyScore to Fix economy and military score.May 14 2017, 12:41 PM
Imarok edited the summary of this revision. (Show Details)
Imarok edited the test plan for this revision. (Show Details)

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1194/ for more details.

In more detail, what matters is the net food you're getting out of the corrals after the cost of the sheep

So if we count in trade, wouldn't it be more consistent to subtract the cost to train trade carts as well?

binaries/data/mods/public/gui/summary/counters.js
106 ↗(On Diff #1917)

That comment should be self-evident mostly, but you could mention the reasoning behind it (that we only count the net gain.

binaries/data/mods/public/simulation/components/StatisticsTracker.js
255 ↗(On Diff #1917)

&&

In D494#19890, @elexis wrote:

In more detail, what matters is the net food you're getting out of the corrals after the cost of the sheep

So if we count in trade, wouldn't it be more consistent to subtract the cost to train trade carts as well?

No, as you buy a sheep and then kill it to get resources. You don't buy trade carts to kill them for resources, but you let them work for you...

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1195/ for more details.

Imarok updated this revision to Diff 1921.May 14 2017, 2:32 PM

Comment change and &&

In D494#19902, @Imarok wrote:
In D494#19890, @elexis wrote:

In more detail, what matters is the net food you're getting out of the corrals after the cost of the sheep

So if we count in trade, wouldn't it be more consistent to subtract the cost to train trade carts as well?

No, as you buy a sheep and then kill it to get resources. You don't buy trade carts to kill them for resources, but you let them work for you...

The argument given was that the net gain has to be considered, i.e. excluding the cost from gained resources. So the same argument could be applied to trade carts or even women on fields.
F.e. assume a game where the players have only one metal mine each, one of them is using it to build up trade, the other one to train champions. The economy score will show that the trader had a much better economy, but since he invested everything into a tradeline, he had zero net gain.

IMO it would be more consistent to only count the income. It's the decision of the player what to use the resources for and instead of training more sheep he could also stop the sheep production.
If all of the food income was used to train more sheep, the food was still gathered, so don't see why that economy score would be zero then. The military and trained unit score will show that it wasn't a good idea.

If you want to show whether the economy was effective, you could add an economy surplus field (i.e. total income minus total outcome) which would be ideally zero for every player (every resource gathered is also invested), negative for players with bad economy (relied on tributes) and positive for slingers (people who gather resources for their teammates)

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1197/ for more details.

I don't mind removing the sheep subtraction...
I am not fully convinced of that either.
(Though I find it more reasonable than subtracting sheep and trading carts costs...)

Imarok updated this revision to Diff 1929.May 14 2017, 7:20 PM

Don't subtract sheep/goat/pig costs

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1201/ for more details.

Sheep are not an investment, they're a consumable good. Farmers and traders are an investment, that keep working for you over time, so they are different.

Technically what you really should subtract is the value of sheep when you butcher them, rather than when you create them - you destroyed your own asset (the sheep) and this loss should be deducted from the balance sheet. You aren't destroying your farmers and traders. The difference is irrelevant in practice, though, since the long-term sheep butchering rate roughly equals the sheep production rate.

Hypothetically, imagine you had a "vineyard" structure that gave 5 food/sec, but also cost 4 food/sec (in fertilizer, for instance). Would you want to record this as 5 food/sec on your economy score, or as 1 food/sec?

I don't really care, if we subtract sheep costs or not. (I understand the motivation behind both approaches)

The difference to a field which needs fertilizer is that you don't have a choice and that noone will likely implement a simultaneous +5 and -4 income. With sheep you can still abort the production after having trained 100 of them simultaneously and then take full advantage of them.
But I see your point too, just tried to avoid those hardcodings which are often bound to fail conceptually if some assumption changes.
Pick the one you prefer, the last two patches both looked okay.

Imarok updated this revision to Diff 1948.May 15 2017, 8:37 PM

Readd the sheep subtraction

causative accepted this revision.May 15 2017, 8:40 PM

Looks good, works.

This revision is now accepted and ready to land.May 15 2017, 8:40 PM
This revision was automatically updated to reflect the committed changes.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1217/ for more details.