HomeWildfire Games

Count Trained Cattle as resource and not as unit. Also only count the net…
Concern RaisedrP20543

Description

Count Trained Cattle as resource and not as unit. Also only count the net amount of gathered/used food for cattle.

Reviewed by: temple
Fixes: #3948
Differential Revision: https://code.wildfiregames.com/D1052

Event Timeline

elexis raised a concern with this commit.Sun, Oct 20, 3:03 PM
elexis added a subscriber: elexis.

See inline comment.

Secondly this says that the trac ticket is fixed, but in the trac ticket I stated

Also as pointed out by causative, calculateEconomyScore should at least get a comment that it takes the vegetarianFood into account twice.

Because this is also more a bug than a feature, even if you say that its a good bug (because it adjusts statistics in some desirable way).

It's in fact not a good, because its just coincidence how the most recent sheep balance is, that shouldn't be hardcoded in the StatisticsTracker code.

It is in fact undesirable that vegetarian food is counted twice.
The consequence should not be that meat is counted twice too.
It means that wood/metal/stone is valued half as much as food.

Gathered resources should be gathered resources.
Economy score can do more arbitrary valuing.

/ps/trunk/binaries/data/mods/public/simulation/components/StatisticsTracker.js
276

(Runs cmpUnitEntityIdentity.HasClass("Domestic") needlessly twice (performance))

284

Im not sure if this was a good idea.

It changes history, once a resource was gathered, it will remain true that the resource was gathered.
Therefore the number of resources gathered should be monotonically increasing.

Since the economy score is also the number of resources gathered divided by 10, it equally becomes possible to reduce the score over time.
Even possible to get negative score by starting the match, training some sheep and not gathering them.

This commit now has outstanding concerns.Sun, Oct 20, 3:03 PM

Also as pointed out by causative, calculateEconomyScore should at least get a comment that it takes the vegetarianFood into account twice.

This was addressed in rP19584, but only for counters.js, not for the copy in session.js in reportGame:

-		for (let type in player.sequences.resourcesGathered)
-			total += player.sequences.resourcesGathered[type][maxIndex];