Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smarter ai #3193

Draft
wants to merge 4 commits into
base: Development
Choose a base branch
from
Draft

Smarter ai #3193

wants to merge 4 commits into from

Conversation

MaxDorob
Copy link
Contributor

@MaxDorob MaxDorob commented Jun 16, 2024

Additions

Describe new functionality added by your code, e.g.

  • Keep distance jobGiver. Behaviour can be changed by:
  • By enemy weapon tag (weaponTagsOfDanger)
  • By owner weapon tag (weaponTags)
  • By race (humanlike\mech)
  • By speed of enemy (doNotFleeIfFaster)
  • By owner armor (doNotFleeIfCantPenetrate)
  • By weapon type of enemy (meleeOnly)

Reasoning

Why did you choose to implement things this way, e.g.

  • Make AI smarter

Alternatives

Describe alternative implementations you have considered, e.g.

  • Snipers will fight in melee

Example

<Operation Class="PatchOperationInsert"> <!--Make human sniper and machine-gunners stay away from CQB-->
    <xpath>Defs/DutyDef/thinkNode/subNodes/li[@Class="JobGiver_AIFightEnemies" or @Class="JobGiver_AIDefendEscortee" or @Class="JobGiver_AIDefendPoint"]</xpath>
    <value>
      <li Class="CombatExtended.JobGiver_CEFlee">
        <weaponTags> <!--Applies to pawns with weapon that have these tags (if null or empty applied to all pawns)-->
          <li>Sniper</li>
          <li>LMG</li>
        </weaponTags>
        <meleeOnly>false</meleeOnly> <!--Optional, by defaul false. Should we flee from melee weaopon users only-->
        <weaponTagsOfDanger> <!--Optional, if specified flee if danger source armed with weapon, that have one of these tag, otherwise flee from all-->
          <li>Melee</li>
          <li>Shotgun</li>
          <li>Smg</li>
          <li>AR</li>
        </weaponTagsOfDanger>
        <mechs>false</mechs> <!--Optional, by default true. Should mechs use this JobGiver or not-->
        <humanlike>true</humanlike>  <!--Optional, by default true. Should humanlike use this JobGiver or not-->
        <enemyDistToFleeRange>0.9~7.9</enemyDistToFleeRange> <!--Distance to search dangerous targets-->
        <fleeDistRange>13.5~20</fleeDistRange> <!--How far should we run (pawn won't run further than weapon range)-->
        <doNotFleeIfCantPenetrate>false</doNotFleeIfCantPenetrate> <!--Optional, true by default. Do not flee if danger source can't penetrate pawn-->
        <doNotFleeIfFaster>true</doNotFleeIfFaster> <!--Optional, true by default. Do not flee if ANY danger source around faster than pawn-->
      </li>
    </value>
  </Operation>
  
    <Operation Class="PatchOperationInsert"> <!--Make AR users stay away from everybody-->
    <xpath>Defs/DutyDef/thinkNode/subNodes/li[@Class="JobGiver_AIFightEnemies" or @Class="JobGiver_AIDefendEscortee" or @Class="JobGiver_AIDefendPoint"]</xpath>
    <value>
      <li Class="CombatExtended.JobGiver_CEFlee">
        <weaponTags> <!--Applies to pawns with weapon that have these tags (if null or empty applied to all pawns)-->
          <li>AR</li>
        </weaponTags>
        <enemyDistToFleeRange>0.9~4.9</enemyDistToFleeRange> <!--Distance to search dangerous targets-->
        <fleeDistRange>7.5~14</fleeDistRange> <!--How far should we run (pawn won't run further than weapon range)-->
        <doNotFleeIfCantPenetrate>false</doNotFleeIfCantPenetrate> <!--Optional, true by default. Do not flee if danger source can't penetrate pawn-->
        <doNotFleeIfFaster>false</doNotFleeIfFaster> <!--Optional, true by default. Do not flee if ANY danger source around faster than pawn-->
      </li>
    </value>
  </Operation>

Testing

Check tests you have performed:

  • Compiles without warnings
  • Game runs without errors
  • (For compatibility patches) ...with and without patched mod loaded
  • Playtested a colony (specify how long)

Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-9538330447.zip

@github-actions github-actions bot added the Download in Comments This PR has a zipfile download available. label Jun 16, 2024
Copy link

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-9538596700.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Download in Comments This PR has a zipfile download available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants