Page MenuHomeWildfire Games

Armour.Invincibility template for AI compatibility, use it in Survival of the Fittest
AbandonedPublic

Authored by elexis on Mar 17 2017, 5:17 PM.

Details

Reviewers
Sandarac
Summary

The invulnerability had solely been used for the cheering / promotion state before
until it was used in survival of the fittest for the treasure seeking woman.

Since D215 is now available,
we can use a special filter template that makes units undeletable and invulnerable
without adding one template for each unit template that should have these properties
instead of setting the invulnerability at runtime from the simulation,
thus allowing the AI to recognize the invulnerability and adapting to it.

The new template property should also be used for the relics in D152,
so that the AI doesn't attempt to destroy the entities.

Test Plan
  1. Test: Start survival of the fittest and notice that the treasure seeker woman can't be deleted nor hurt, while newly trained females can.
  2. Test: Add multiple "indestructable|" to the survival code to confirm that multiple template transformations are transfered correctly when doing the skirmisher replacement.
  3. Start a 2 player match on a different map, open the developer with Alt+D, run with a promotable unit into the enemy CC, promote the unit while it's under attack to confirm that the invincibility is applied a$
  4. Read Transform.js and determine whether an entry for Health.Undeletable and Armour.Invincibility is missing, whether it should use the JS simulation code to set these properties or whether to use a special filter transformation.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 793
Build 1252: Vulcan BuildJenkins
Build 1251: arc lint + arc unit

Event Timeline

elexis created this revision.Mar 17 2017, 5:17 PM
Vulcan added a subscriber: Vulcan.Mar 17 2017, 6:02 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/538/ for more details.

Sandarac requested changes to this revision.Mar 17 2017, 9:58 PM
Sandarac added a subscriber: Sandarac.

This diff is broken for the AI, likely changes to entity.js will be needed.

This revision now requires changes to proceed.Mar 17 2017, 9:58 PM
Sandarac added inline comments.Mar 17 2017, 10:20 PM
binaries/data/mods/public/simulation/templates/special_filter/indestructable.xml
10

Extra newline.

mimo added a subscriber: mimo.Mar 17 2017, 10:48 PM
In D230#8582, @Sandarac wrote:

This diff is broken for the AI, likely changes to entity.js will be needed.

I suppose it's a problem with "derived templates" (see SharedScript.GetTemplate) which are not transfered from the simu, but rebuilt. This internal rebuild (there since the first AIs) should be removed , and the derived templates transfered like the normal ones, or this GetTemplate could call a globalScripts function.

elexis abandoned this revision.Mar 24 2017, 6:19 PM

Can be picked up by anyone familiar with the AI code.

fatherbushido also suggested to construct a dummy armour component that doesn't do anything but is registered as the damage receiver. See last line of Armour.js

In D230#9897, @elexis wrote:

fatherbushido also suggested to construct a dummy armour component that doesn't do anything but is registered as the damage receiver. See last line of Armour.js

Someone not in favor of dummy components https://code.wildfiregames.com/rP19345#20080

What we should really do is disabling the damage receiver altogether if we go with this special filter template

In D230#8594, @mimo wrote:
In D230#8582, @Sandarac wrote:

This diff is broken for the AI, likely changes to entity.js will be needed.

I suppose it's a problem with "derived templates" (see SharedScript.GetTemplate) which are not transfered from the simu, but rebuilt. This internal rebuild (there since the first AIs) should be removed , and the derived templates transfered like the normal ones, or this GetTemplate could call a globalScripts function.

The error is: ERROR: JavaScript error: simulation/ai/common-api/entity.js line 29 TypeError: value is null

It sounds like the units should have their Health and Armour component removed altogether instead of setting Invincibility on the DamageReceiver, see D341.