Page MenuHomeWildfire Games

Petra: Initial Capture The Relic support
ClosedPublic

Authored by Sandarac on Mar 18 2017, 8:48 PM.

Details

Summary

D152 introduces a "Capture The Relic" victory condition, where players must capture all relics on the map and keep them for a certain time.

Because AI players have access to the location of every entity on the map, there will have to be a delay set whenever Petra tries to collect a gaia-owned relic. This "searching for relics" behavior will be handled in another diff.

Test Plan

Petra will assign guards to relics and try to capture the relics of players it targets. It will move any relics it capture to its closest base.

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 18 2017, 8:48 PM
Vulcan added a subscriber: Vulcan.Mar 18 2017, 9:33 PM

Build is green

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

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

mimo requested changes to this revision.Mar 19 2017, 3:03 PM
mimo added a subscriber: mimo.

Thanks for the patch.
In addition to the inline comments, we could have some changes in the diplomacyManager (for another patch): in lastmanstanding, when turning against an ally, choose preferably the one with the max relics (and also in wonder mode, turn against the most advanced one on the wonder countdown if any)

binaries/data/mods/public/simulation/ai/petra/attackManager.js
366 ↗(On Diff #850)

would be better to initialise at 0 as the counts are >= 0

367 ↗(On Diff #850)

already done in line 332, or rename this variable enemyRelic by symmetry with enemyWonder above.

375 ↗(On Diff #850)

should be if (relicsCount > maxRelicsOwned) THEN maxRelicsOwned = relicsCount AND enemyPlayer = i
otherwise (if you keep the continue), you must test that relicsCount>0

380 ↗(On Diff #850)

as you loop only on non-gaia player, !enemyPlayer is enough (still to keep symmetry with wonder).

binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js
174 ↗(On Diff #850)

wouldn't it be more logical to also move that line in the new removeGuardsFromxxx function?

243 ↗(On Diff #850)

the test on ent should always be done, but currently not done for relics.

505 ↗(On Diff #850)

could be merged with 503 (still to keep symmetry between all game types :-)

This revision now requires changes to proceed.Mar 19 2017, 3:03 PM
Sandarac planned changes to this revision.Mar 21 2017, 6:11 AM

Thank you mimo for the comments, I will update the diff soon.

binaries/data/mods/public/simulation/ai/petra/attackManager.js
380 ↗(On Diff #850)

I was planning to set i to 0 so that gaia was included, as the AI will target the relics and then switch to targeting a different player once capturing all of the gaia relics, but I'm not sure if there might be some unintended consequences from targeting gaia like this?

In any case, I think there should be a lag time, probably dependent on difficulty, that causes the AI to capture gaia relics infrequently.

binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js
174 ↗(On Diff #850)

I assumed that there might be some case in the future where all guards have to unassigned at once while still keeping the criticalEnt in the Map, but I will change it.

505 ↗(On Diff #850)

OK, yes, I will do this :)

Sandarac updated this revision to Diff 961.Mar 27 2017, 4:28 AM
Sandarac edited edge metadata.

Apply mimo's comments.

Build is green

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

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

mimo accepted this revision.Mar 28 2017, 8:47 PM

Thanks for the changes.

binaries/data/mods/public/simulation/ai/petra/attackManager.js
374 ↗(On Diff #961)

if (relicsCount <= maxRelicsOwned) would be enough instead of this || (i will change it when committing)

This revision is now accepted and ready to land.Mar 28 2017, 8:47 PM
This revision was automatically updated to reflect the committed changes.