Sins of a Solar Empire : Real-Time Strategy. Unrivalled Scale.
© 2003-2013 Ironclad Games Corporation Vancouver, BC. All rights reserved.
© 2006-2013 Stardock Entertainment

[SotF] Improving the AI

By on December 4, 2011 3:45:33 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

ZombiesRus5

Join Date 02/2009
+230

So I've finally tackled what I think is a good foundation for modding pacts, while maybe not ideal support the goals of my mod they are within the limitations of the game's moddability.

Another goal of mine has been to improve the AI as much as possible. 

What we know is the AI is not very moddable, so we have to look at this from the constraints that are available.

So what areas do I see as potentially AI improving options...

 

Gameplay.constants:

DamagePercentBonus - Actually works pretty well currently with getting the AI to attack the right targets. Might be be some opportunities though. I've considered removing the advantage the Human player has of targetting enemy capital ships by modifying these abilities changing what is anti-capitalship.

playerAISharedDef - Something I haven't really invested any actual time in. I'm hopeful some tweaks here might prove fruitful.

playerAISharedDef

  • table-Aggressive - Focuses on ships(10)->bounty(5)->tactical(3)->research(2)-others(1)->mines(0)
  • table-Defensive - Focuses on tactical(6)->ships(5)->bounty(5)->starbase(3)->planet(3)->research(2)->mines(2)
  • table-Research - Focuses on bounty(10)->ship(5)->research(5)->tactical(3)->others(2)->mines(1)
  • table-Economic - Focuses on bounty(15*)->ship(5)->civilian(5)->population(5)->research,planet(2)->others(1)
* is 15 the highest value?
 
options available
  • BuildShip
  • BuildModuleTactical
  • BuildModuleResearch
  • UpgradeResearch
  • UpgradePlanetArtifactLevel
  • UpgardPlanetPopulation
  • UpgradePlanetInfrastructure
  • MaxBountyBidCount
  • UpgradeStarBase
  • BuildMines

I'm wonder if these can be turned into Difficulty levels as one option. Another option may be to slide these values up or down to adjust how the AI behaves. 

It would be curious to see how the AI behaved if all the values excluding mines and bounty were set to 15.

I may also try some variations that slide values up or down based on AI behavior. For example, I dislike seeing un-upgraded starbases.

aiRetreatThreshold - from what I've gathered reading other posts this is a strength test with lower values resulting in longer battles and higher values resulting in a quicker retreat. 

 

Abilities

There are lots of possibilities to improve the AI here in my opinion. Here's a few of the issues that can potentially be resolved with rebalancing or coding changes.

  • Synchronized targeting, specifically single target synchronized abilities like Suppression
  • Default aiUseTimes not taking advantage of new better conditions
  • Default aiUseTargetCondition not taking advantage of new or better conditions
  • Antimatter costs canceling out 2nd or 3rd abilities from being cast
  • Ultimates never executed by the AI (Example Resurrection)
  • Abilities never executed by the AI (Example Resource Focus)

Single Target Synchronized abilities

I actually have a fix for this that's already in SotF. To make the AI and by extension the player more effective with this ability I changed it from ApplyTargettedBuffToSelf to ApplyBuffToTarget. The synchronizing still occurs but is cast via a callback from the affected target. I still have some more to change for the custom races in my mod.

So far I've changed Suppression, DisableImmune, TransferAntiMatter, DesignateTarget

Default aiUseTimes

A lot of abilities could be improved for ai casts by tweaking the aiUseTime on abilities. 

Here's a link to the valid list of aiUseTime's

Default aiUseTargetCondition

While not as many options as aiUseTime there are some useful aiUseTargetCondition's that might be put on abilities with the goal of improving the AI. 

One condition that pops out is the isCapitalShipOrStarbase condition. This might be extremely useful for the AI on abilities like DetonateAntimatter or NanoDissasembler. This condition won't stop a player from manually targetting a frigate, but it will cause the AI to choose to target capitals or starbases.

Another possibility for DetonateAntimatter is the AntimatterExceedsAmount condition as this ability only causes damage when there is decent amount of antimatter reserve.

The main point will be review each Ability's aiUseTime and aiUseTargetCondition especially for those that are the Any types and see if any potential improvement can be made.

Antimatter costs canceling out 2nd or 3rd abilities from being cast

This one bugs me a bit with the AI as typically AM reserves and cooldowns work out to the same ability being cast over and over when the better ability remains unused.

A couple of options present them self to help resolve this.

  • Rebalance AM, ai use/target conditions and cooldowns to ensure both abilities have a change to fire if appropriate. For example the Guass Blast and Flak Burst end up with Flak Burst rarely being cast during extended battles as the AM is chewed up by Guass Blast. In this scenario FlakBurst could be rebalanced to have a lower AM cost than GuassBlast but an aiUseTime of OnlyWhenManyTargetsInRange. This may require some rebalance to effect of the ability but will create a more dynamic AI.
  • Convert an AM using ability to a Passive. Again picking on the Kol..., The AdaptiveShield is a good opportunity for this type of conversion.
  • The onlyAutoCastWhenDamageTakenExceedsPerc could also be coupled with the rebalanced AM ai use/target conditions in the first bullet... For example AdaptiveShield could have a higher priority to fire based on AM, but only when it's exceeded a certain damage threshold.

Ultimates never executed by the AI (Example Resurrection)

While resurrection is the biggest example I'd like the AI to have more opportunity to execute Ultimate abilities.

  • For resurrection I intend to change this into an ability the AI will use. Basically any capital ship will have Resurrection applied to it once. It won't recast on a ship that's already been resurrected so only newly built ships will get the affect. Human players can still control this BAU.
  • For other ultimate abilities I'm thinking about dramatically reducing their AM costs and increasing cooldowns as I want the AI to prioritize using them. As it currently stands the AI will never disable it's other abilities like Radiation Bomb to store AM for Missile Barrage. By decreasing AM below normal abilities all level 6 capitals become dangerous even in extended battles.
  • I'll still look at the previous changes to help the AI make better decisions about when to cast ultimate abilities.

Abilities never executed by the AI (Example Resource Focus)

This bugs me too and considering resource focus isn't that big of an impact I'm considering making it a passive ability and possibly reblancing it some to compensate.

I guess I should add one more thing to the mix... Abilities that activate too much. Sorry, but the phase out hull on Vasari structures is going to get changed to an AM based ability. This one just bugs the shit out me trying to take down Vasari structures

 

Star Bases

The AI never does anything cool with these!

Why? Because it put's all it's upgrade points into Weapons/Toughness/Strikecraft before it even thinks about a different upgrade type.

This results in fairly boring usage of Star bases by the AI...

Solutions?

  1. Decrease the amount of upgrades available for Weapons/Toughness/Strikecraft
  2. Increase the amount of upgrades allowed for a Star Base from 8 to ?
  3. Add instant low level access for all star base upgrades
 

Decrease the amount of upgrades available for Weapons/Toughness/Strikecraft

In essence this would simply make additional upgrades available for Trade, Block Colonize or other special abilities

Increase the amount of upgrades allowed for a Star Base from 8 to ?

Simple enough increase from 8 to whatever. Downside is a lot more resources are needed to upgrade the starbase.

Add instant low level access for all star base upgrades

This one is intriguing. Essentially you could make up for the lack of dynamic behavior on the AI by forcing it to have upgrades that a human would most likely get anyway. Downside is the human gets these as well.

 

Generic Stuff

Spamming of mines by Advent drone hosts

Ok, I actually fixed this in my mod by removing mines from the carrier and creating a separate mine host similar to the Vasari mine layer.

m_weaponIndexForRange

I can't recall on this one but if I change the m_weaponIndexForRange to 1 for the Vasari Starbase will that prevent the other weapons from firing until it's in range of the antimodule weapons. I want the Vasari starbase to engage all it's weapons instead of staying out of range with it's anti-module. If this does cause issues I'm going to rework weapon ranges to ships and star bases with multiple weapons to be more effective.

 

maybe some other stuff I haven't considered yet...

134 Replies
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
December 29, 2011 3:23:40 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

It's an intuitive hunch derived from observation but I am thinking the actions of an allied human player also effect what an AI builds/researches/does.  If you go on the warpath, it creates a fleet to accompany you and drops other things.

Reason for Karma (Optional)
Successfully updated karma reason!
January 23, 2012 7:22:01 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

I've managed somehow to kill the AI's ability to construct ANY star bases for that faction with one of my attempts to give them AI specific star bases. I'm not sure what it was exactly about my changes as I have another race with multiple star bases that is able to construct them. I double checked all the ability references, entities, etc where setup correctly so something going on with the multiple types of star bases and constructors possibly.

I backed out my changes and am going to slowly add back in to see if there is some restriction I can identify as I know a race with multiple star bases will function with the AI (Hypercorp has this).

 

On a positive note though, the research prompters seem to be working as designed.

Still evaulating how the AI is working with some of the other changes I'm trying like Ultimates cost changes and other ability cost restructuring.

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 1:32:25 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

So, any definitive progress and results?

I'm just going to try a position 20, 0 tier-0 item that doubles research rate and drops cost by 75%.  If really cheap, the AI might do a lot of research.

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 2:17:24 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting SemazRalan,
I'm just going to try a position 20, 0 tier-0 item that doubles research rate and drops cost by 75%. If really cheap, the AI might do a lot of research.

It my experience cost is the main thing that keeps the AI from research stuff. The higher level AI will research stuff quite quickly if they maxed their current fleet supply and thus can't throw any more money at suiciding ships. One interesting idea might be to increase the cost of fleet supply techs, but that just might cause the AI to stop everything and save until it has enough resources. Or tie in a prerequisite you want to research on every fleet supply upgrade, that might be fun.

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 3:11:25 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Even with the AI Cheater item in and researched by 4 of the AI with big research trees, the AI after an hour and a half was still very limited in what it has researched (and they were hard researcher AI).  AI had 8/8 labs built, they were just more interested in building ships than upgrading their research (upgrade research was 15 in gameplay.constants). 

I really think the priority system of 0 and 1 needs some love.  perhaps priority of 0 to 10 (10 being greatest priority), but meh... who knows.

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 9:54:10 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting SemazRalan,
So, any definitive progress and results?

I have made the AI research all techs on the tech tree, with time, and also made the AI much tougher. I also made research cost absolutely nothing for the AI, in addition to increasing their research speed, which has made them far more efficient. I also had the tech have a minor supply and capital ship crew boost, which ensures that the AI will always research the tech within the first 5-15 minutes of gameplay. In addition to the tech's benefits, it also costs negative credits, metal, and crystal which in effect gives the AI a one-time resource boost.

The AI focuses on researching ships, structures, and colonization techs, more so than anything else; the priority system is meaningless.

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 10:28:28 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

so slipping something like this into the middle of a chain of research about halfway might get the AI to drive through the chain towards it?

researchModifier
    modifierType "ShipMaxSlots"
    baseValue 0.000000
    perLevelValue 5.000000

or -since 7DS has some research that unlocks capitals

researchModifier
    modifierType "CapitalShipMaxSlotLevel"
    baseValue 0.000000
    perLevelValue 1.000000

 

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 11:06:32 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Forcing the AI to research techs is an entirely different thing from giving them an early game boost. Here's an example of how a chain works:

The bottom most row represents the actual techs on the tech tree you want the AI to research. All the other rows (1, 2, 3, 4) are just there in order to lead up to the "final" research item, 5_A, which unlocks a NotOnPage frigate. All of these filler techs cost 0 time and money to research, and the AI will work it's way up to that shiny "new" ship it has the hots for. Plus, as all of the items are off the research page, they won't be noticeable by the player. This is by no means a quick job; it takes time to calculate how many new items you'll need to make, making them, and then putting them in.

However, the results are present and is something I have seen concrete results of. This, in combination with making research cost nothing, will make the AI into a research whore. I would also suggest increasing the UpgradeResearch amount for all the non-research AIs to match the research in Gameplay.constants or else the research AI will dominate. As the research AI still has proportionally "more points" on research than the other sections, it will still research more than the other AI types, even if they all have the same UpgradeResearch value, or so I assume, I still gotta test this out.

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 11:18:38 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

that "notonpage" frigate... will they build it?  If I just make the ship a copy of the scout ship they already build, but put it in with the constructor, trade/refinery ship... will it somehow build it or just race frantically for it?

Reason for Karma (Optional)
Successfully updated karma reason!
May 19, 2012 11:51:46 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

The AI is actually capable of building NotOnPage frigates.  If they're identical to frigates that have a page then it shouldn't be an issue.  You can also make the NotOnPage frigate suck compared to an on-page frigate so the AI won't build it.

Reason for Karma (Optional)
Successfully updated karma reason!
May 20, 2012 12:16:13 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting SpardaSon21,
You can also make the NotOnPage frigate suck compared to an on-page frigate so the AI won't build it.

 

Is this confirmed for all AI types?

Reason for Karma (Optional)
Successfully updated karma reason!
May 20, 2012 12:32:36 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting SpardaSon21,
The AI is actually capable of building NotOnPage frigates.  If they're identical to frigates that have a page then it shouldn't be an issue. 

This is what I've done.

Reason for Karma (Optional)
Successfully updated karma reason!
May 20, 2012 4:05:30 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

So something like this where the end chains are the frigate -1 for civ, 1 for military? 

Reason for Karma (Optional)
Successfully updated karma reason!
May 20, 2012 4:18:26 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting SemazRalan,
So something like this where the end chains are the frigate -1 for civ, 1 for military?

Yup, exactly.

Reason for Karma (Optional)
Successfully updated karma reason!
May 28, 2012 6:31:01 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting SemazRalan,
sorry, I'm not redoing the tech-trees for 12 races so the idiot AI will research up to tier 4 of wtfever.  StarClad put in priority levels that don't seem to do much since it is 0 or 1 instead of having the AI research through military, civilian, defense, fleet starting with the top left and working it's way down, then to Tier 1 and down the list, and so on.  or at least the priority system being a bit more than 0 and 1 so modders could set research priorities that the Ai worked toward.

/Rant Off.  just rather disappointing

Priority means dick so why the hell is it there at all?

I've taken the advice here and given each 7DS race 4 "A-Level AI Drivers" which require 1 or 2 end-of-chain items.  These 4 lead to 2 "B-Level AI Drivers", which are prerequisites for a notonpage ship.  Civ and Mil each have 1 ship at the end of the chain.

Already saw after 1.5 hour game the Altantian AI had actually kept pace with my research pace.  One thing I'm putting in is a [ 11 , 0 ] tier 0 item that reduces research cost by 25% just so the AI can efficiently research.

Kzer'Za Mil Tree with Lavo2/GoaFan/All "AI-Drivers".  Escalation and Survival all link to "A-Level AI Drivers".  Enforcement is all ships and abilities, which the AI goes for already.

Kzer'Za Civ Tree with Lavo2/GoaFan/All "AI-Drivers".  Some Thrall Management and Preservation to the four "A-Level AI-Drivers".  The one item before the feeders is the 25% research cost reduction item.

 

Again, many thanks to everyone in this thread. 

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 3:12:02 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Since this was linked on the other current thread (thanks Lavo) and I'd love to see a collaboration of the wise here produce a usable public mod...how is it going in this area?  

Have you guys considered actually producing something shareable in this area?

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 3:41:54 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Not sure what you mean by sharable, if you mean something people can look at files wise, SoGE already has that in and iirc the latest version of 7DS does as well. If you mean something for vanilla Sins, that's another story.

 

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 3:51:56 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

You can force the ai to bild more support-ships:

########

typeCount 2
-->frigateRoleType "Heavy"
frigateRoleType "Support"

########

I also added an AI-Supportship with more hull and shield. It works good so far.

I also give the AI some advantages through an AI-ResearchSubject:

########

onlyWorksIfTierLabsExist TRUE
MaxNumResearchLevels 1
priority 0.000000
researchBoolModifiers 0
researchFloatModifiers 4
researchModifier
    modifierType "SalvageWreckagePercent"
    baseValue 0.000000
    perLevelValue 0.150000
researchModifier
    modifierType "CreditCostAdjustment"
    baseValue 0.000000
    perLevelValue 0.250000
researchModifier
    modifierType "HullPointsMaxAdjustment"
    baseValue 0.000000
    perLevelValue 0.22000
researchModifier
    modifierType "PopulationTaxRateAdjustment"
    baseValue 0.000000
    perLevelValue 0.10000
artifactPicture ""

########

 



 

 

 

 

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 7:24:51 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting Lavo_2,
Not sure what you mean by sharable, if you mean something people can look at files wise, SoGE already has that in and iirc the latest version of 7DS does as well. If you mean something for vanilla Sins, that's another story.

 

I mean a "just the AI" sort of mod.

 

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 8:26:25 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting Sinperium,

Quoting Lavo_2, reply 118Not sure what you mean by sharable, if you mean something people can look at files wise, SoGE already has that in and iirc the latest version of 7DS does as well. If you mean something for vanilla Sins, that's another story.

 

I mean a "just the AI" sort of mod.

 

Probably not Sin. My mod's probably the closest to this for the vanilla factions as I've mainly only added AI improvements to TEC, Advent and Vasari. 

You'll have to skim through each mod to find things you'd like to include in yours as we are all doing it a bit differently but with similar strategies.

 

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 9:09:04 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Yeah.  Still very cool.  Way out of my league but I think improving the solitaire game this way has a lot of value.

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 12:31:46 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Will this still work if you utilize the FactionID tags?

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 6:20:16 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting boshimi336,
Will this still work if you utilize the FactionID tags?

I don't see why not.

Reason for Karma (Optional)
Successfully updated karma reason!
August 14, 2012 11:15:33 PM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Wow great reads!

Does the vanilla AI described here still apply for Rebellion?  My feeling is that the AI is not that eager to research ships, and Advent for example often queue up a large amount of weapon/shield upgrades.

Reason for Karma (Optional)
Successfully updated karma reason!
August 15, 2012 2:29:36 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

Quoting Valpheus,
Does the vanilla AI described here still apply for Rebellion? My feeling is that the AI is not that eager to research ships, and Advent for example often queue up a large amount of weapon/shield upgrades

It should, but wow, that is the exact opposite that our AI findings have discovered. Usually the AI beelines for techs that unlock units and abilities and ignore stat upgrades until they max out their fleet supply or otherwise cannot build additional ships.

If you are doing a total conversion, make sure all your ships have proper stat types.

Quoting Sinperium,
Since this was linked on the other current thread (thanks Lavo) and I'd love to see a collaboration of the wise here produce a usable public mod...how is it going in this area?  

Have you guys considered actually producing something shareable in this area?
'

Probably will never happen. E4X, SoGE, SotF, 7DS etc. have all done different things using the stuff discuses here to push the AI to react better to their changes. I wouldn't be surprised if some of them were contradictory, and at this point we are all too busy with our own projects.

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108434  walnut1   Server Load Time: 00:00:00.0001125   Page Render Time: