This further improves Petra's handling of citizen-soldier guards, so that it does not repeatedly add guards when there are few available workers.
Details
- Reviewers
- None
- Commits
- rP19281: Petra: do not uselessly assign citizen-soldier guards
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
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.
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.
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)
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).
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