Page MenuHomeWildfire Games

Petra: do not uselessly assign citizen-soldier guards
ClosedPublic

Authored by Sandarac on Mar 8 2017, 1:25 AM.

Details

Summary

This further improves Petra's handling of citizen-soldier guards, so that it does not repeatedly add guards when there are few available workers.

Test Plan

When Petra is adding guard units, it will stop if it only has 25 active workers or fewer.

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

Sandarac created this revision.Mar 8 2017, 1:25 AM
Sandarac retitled this revision from Petra: do not use uselessly assign citizen-soldier guards to Petra: do not uselessly assign citizen-soldier guards.
Vulcan added a subscriber: Vulcan.Mar 8 2017, 2:11 AM

Build is green

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

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

Sandarac updated this revision to Diff 737.Mar 8 2017, 2:33 PM

Fix silly mistake.

Vulcan added a comment.Mar 8 2017, 3:18 PM

Build is green

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

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

This revision was automatically updated to reflect the committed changes.
elexis added a subscriber: elexis.Mar 8 2017, 11:27 PM

Those numbers might be better as a global / prototype constant, so that one can change them without looking at the code, nor having to change each line

In D202#7626, @elexis wrote:

Those numbers might be better as a global / prototype constant, so that one can change them without looking at the code, nor having to change each line

Yes, these numbers could be handled like that, (f.e. this.healersPerCriticalEnt), and the exact numbers could be dependent on some AI personality trait I guess, but the current values work well for this part of the code. And I don't really see the point in adding more variables to the prototype that aren't even used in most gameTypes in the first place and likely don't really need to be varied.

(Just from a code pattern pov. They don't have to be used somewhere else, just about splitting code & data, even if it were used only one place)

mimo added a subscriber: mimo.Mar 9 2017, 7:06 PM

In fact, thinking about it, we could move these 20/25 to config.js, with a scaling factor when the maxPop is smaller than 300, as in done line 196 to 203 for other such quantities as we may want to decrease these numbers if playing with a maxPop of 100?
(to be honest, i've never tested all these numbers with a maxPop != 300, these are just raisonnable guesses).

elexis added a comment.Mar 9 2017, 7:11 PM

Also, no clue what exactly those numbers are, I just recall the regicide garrison health number cheks from rP18731 which were like < 70 and < 80, so it could become one number N and the other one N+10 or N*1.1. Having those things abstracted opens up some doors. No stress, just something to consider for the future