Delnar_Ersike Delnar_Ersike

Artificial Unintelligence (Mod v0.62 + AI info)

Artificial Unintelligence (Mod v0.62 + AI info)

Improving the AI one parameter at a time

Let's face it: we all know that Sins of a Solar Empire's AI is stupid. Unfortunately, their most fundamental parts are locked into an exe or dll file, their source code most likely never to be released for modders to examine, alter, and fix. However, there are still ways to push the AI, however dumb it may be, to still put up a fight without resorting to ludicrous resource or stat bonuses. This post contains the following: my attempt at an AI-improvement mod for vanilla Sins of a Solar Empire, observations for players and modders about various in-game AI settings, and observations for modders about various moddable settings and a trick or two that influence how the AI behaves.

Even though my notes may seem thorough, both the research and the mod are very much a work-in-progress: as I continue to expand and double-check my notes, others will undoubtedly also start reporting their own observations, which I will try to aggregate and verify as much as possible. If I am missing something or you think a certain observation/conjecture is incorrect, let me know and I'll see what I can do.

Quick links:

Section 1: The Mod
Section 2: In-Game AI Info
General Info Presets Factions
Section 3: Modding the AI
Missions gameplay.constants Abilities
Planet Modules and Ships Fleets and Army Management Production and Resources
Research
 
Word of Warning: There is a lot of text. If reading white font on a dark background tires your eyes, just copy-paste the thing into Notepad or a word document. You won't get fancy formatting, but at least your eyes won't bleed.



Section 1: Artificial Unintelligence (mod v0.62 for Rebellion v1.82)

This mod takes advantage of the settings and tricks mentioned in Section 3 to make the vanilla Sins of a Solar Empire AI more competent; every single parameter mentioned has been altered, and every single trick mentioned has been used to some extent. The mod also has two gameplay-altering addons that help the AI (they are optional because they actually change gameplay) as well as a standalone addon that changes the way it behaves:
The Quick Start modification addon adds a Culture Center to the Quick Start buildings. This was added to make it harder to quickly steal planets near an enemy capitol early in the game, something that the AI is very vulnerable to, and also because AIs will start building culture buildings much quicker if an opponent has already built one, so the Quick Start modification also enables them to get into the culture game faster. Ideally, I would have made the Home Planet improvement add flat culture in addition to its regular bonuses, but I have not found a way to do this, so for now, the Culture Center Quick Start is my best solution.
The Kostura modification addon makes Kostura Prototype (the research that unlocks the Kostura Cannon) require 2 levels of NME Warheads. This not only brings the Kostura more in line with TEC and Advent superweapons in terms of how much research is required to unlock it (eg. you can't just build a ton of military labs and rush it, only TEC Loyalists can do that now), but also makes the AI more likely to research phase missile upgrades, since it is hardcoded to prioritize techs that eventually unlock new ships or buildings.
The Rabid AI addon forces the AI to use some fallback, faction-generic routines for vanilla Sins factions instead of the usual, faction-specific ones. It is called "rabid" because these routines make the AI both a lot more aggressive and a lot more illogical, as well as introducing bugs into its handling of capital ships. Ship production, tactical structure production, and fleet management are all governed by fallback routines, while faction-specific routines still govern all other aspects (eg. research, starbases, logistical structures). This addon functions independently of other parts of the mod, including the main mod. Enable this addon at your own peril.

Sins Artificial Unintelligence v0.62 [for Rebellion v1.82] can be downloaded here (mirror).

Changes since the last version (v0.60):

  • Increased possible pirate upgrades per raid from 2 to 4; this allow pirates to make better use of high bounties and maps with multiple pirate bases.
  • The AI will now only wait a minimum of 1 minute (from 5) before offering a player (human or AI) new quests or new treaties/pacts. This allows AI players to team up with each other much more quickly and not be forced to wait forever to make pacts with each other.
  • With the exception of disciple vessels, all factions' antifighter frigates, long-range frigates, carriers, heavy frigates, and light frigates have been given the AntiMine frigateRoleType due to the AI not knowing how to use anti-mine abilities, but still building AntiMine frigates when going up against a large amount of mines. Disciple vessels were skipped because their transfer antimatter ability's autocast targetting depends on other ships not sharing frigateRoleTypes with the disciple vessel.

Known issues:

  • For the Kostura modification addon, the arrow in the Vasari Warfare tech tree indicating that Kostura Prototype requires NME Warheads is bugged and points to a blank spot instead of extending to the Kostura Prototype button.
  • The AI-only ability used to force capital ships to retreat is still visible as "Explore" under capital ships' tooltips and under the level up menu.


 

Section 2: In-Game AI Info

In the absence of any official information on how the AI's operate, all info had to be acquired through weeks of running test games in various configurations.

 

General:

  • Quick Start:
    If you are playing solo, it is recommended you enable Quick Start. The main reason is that the AI almost never upgrades their capitol population immediately, so they start at a huge disadvantage income-wise. Since Quick Start starts everyone off with maxed population at their capitol, this helps the AI a metric ton in singleplayer games without giving it an unfair advantage. Note that playing on a higher difficulty level with Quick Start disabled is also viable, since the AI's income advantage earlygame is mitigated by it delaying its capitol population upgrade.
  • Pirates:
    The AI's handling of pirates are a mixed big. A single pirate raid can be a death sentence for a Normal Economist or Researcher AI earlygame, but they are not much to Aggressor AIs. Lategame, the AI's will never give the Pirate faction missions, even though they have the necessary research unlocked, resorting to still do bounty races. However, pirates can spice the game up a lot, and they are especially handy for leveling your capital ships. I tend to turn pirates off in my games, though you might still consider keeping them turned on.
  • Victory Conditions:
    The AI is often oblivious to victory conditions. Left to their own devices, AIs ignore occupation planets almost entirely (save for scouting). Though AIs recognize when flagship victory is enabled, they are incredibly stupid at handling flagships: they will treat enemy flagships as top priority ships even if their army wouldn't be able to defeat it (leading to them sacrificing fleets), while they are incredibly cowardly with their own flagships and will never actually take advantage of its offensive capabilities. The AI will never actively pursue a diplomatic victory, but they can still inadvertently win one. The AI will occasionally start off a research victory, but if they do, the other AIs will not respond, happily leaving their opponent to win a research victory; they will behave in a similar fashion towards human players progressing towards a research victory. Capitol victory is the only special victory condition that the AI truly understands: it will place a huge emphasis on eradicating opponents' capitols and will immediately rush their fleets to defend their own capitol if threatened. If Allied Victory is turned off, AIs will be just as inclined to form alliances; the only difference in their behavior is that they will automatically unally a player if the player is nearing a non-research victory or starting a research victory, and if an AI has no opponents, they will automatically unally the player with whom they have the lowest standing.
  • AI Advantages:
    The AI will always enjoy some advantages over human players, even at lower difficulty levels. They can start researching techs even before they have labs built, as they only need to initiate the construction to start the research; however, the effects of techs researched in this way will only trigger once the labs are complete (eg. if an AI queues up a military lab at the beginning of the game, it can have the first damage upgrade techs researched within the first 30 seconds of the game, but the actual damage increase only takes place once the first military lab is built). They can also see all phase jumping ships in the game even without the phase jump detection researches, though their algorithms only ever pay attention to jumps up to 2 planets away (like the maxed TEC or Advent phase detection techs). The AI can send and receive both missions and resources without unlocking the necessary techs. Finally, the AI can buy upgrades for its capital ships past the upgrade limit of level 3 (4 with tech), though they will only do so once all their capital ships have reached the upgrade limit (thanks Lavo_2!); the amount of levels they will buy depends on their difficulty level, with Vicious AIs buying up to level 7.
  • Unlimited Starbase Capacity:
    With enough resources, the AI can go way beyond starbases' module limit. AIs spend resources on starbase upgrades in spurts: they will queue up all the upgrades they want and can afford in an instant, just like how they increase bounties in spending spurts. The problem is the game only checks if a starbase has maxed its upgrade capacity after the AI has done its spurt, meaning that if the AI has enough resources, it can queue up more upgrades than the starbase's capacity would allow. As a result, it's quite common for AI starbases to have 10-14 upgrades.
  • Multi-star Maps:
    The AI is usually terrible at multi-star maps. This is mainly because when the AI determines targets for its missions (see Missions subsection of Section 3), map distance is the only factor it will consider; other factors, such as fleet comparison or diplomatic missions, are only used to alter existing missions' priorities. Since planets in other solar systems are much further away than those in an AI's home system, the AI will almost always only attack or colonize extrasolar planets once it has completely conquered its home system. Even when the AI does expand into other systems, it will prioritize poorer systems that are close to its home system over richer systems that are further away. If you do plan on playing on a multi-star map against AI opponents, pick maps where each AI begins in their own system (eg. Voruk's Labyrinth) over ones where systems are occupied by multiple players. Note that if you are a modder, you can make the AI slightly more competent at multi-star maps by making interstellar travel time instantaneous: AIs are very reactionary and might often need to redirect fleets from their original goals. Since unmodded interstellar travel can often take minutes, AIs are left very vulnerable when they commit their fleets to interstellar travel; making it all instantaneous removes this commitment, awarding the AIs much need flexibility for handling their fleets.
  • Jump-in, jump-out Looping:
    AIs often exhibit a loop whereby they will send parts of their fleet back and forth between an safe and an unsafe gravity well. This is caused by unsafe pathfinding. After retreating from a fight, the AI will give new move orders to the just-retreated fleets. Often it will tell those fleets to move to a target gravity well to which the shortest path requires moving through the gravity well the fleet had just retreated from. Instead of finding a safe way around or choosing a different target, the AI will blissfully send its fleets back into the danger zone, only to have them order a retreat the moment the fleet completes its jump... back to their starting gravity well, where the AI once again orders the fleet to move through the enemy-filled gravity well. This will repeat ad infinitum until the AI chooses a different target planet or the enemy fleet moves to a different gravity well.


Behavior Presets:

Keep in mind that these descriptions only fit well on lower difficulty levels: at higher difficulty levels, the fact that one preset is better or worse at building their economy is made pointless by the fact that they're showered with resources anyway. When I mention "economy upgrading", I mean building, researching, or upgrading anything that increases income or decreases ship/module cost.

  • Aggressor:
    These AIs are situational. They expand rather quickly and spend most of their income on building ships; however, this means that they don't tend to upgrade their planets or their economy, so even though they focus on building ships, they tend to lag behind AI presets that do focus a bit more on economy upgrading. They are actually worse than Economist AIs with the vanilla Gameplay.constants settings, but with a few tweaked settings, the situation improves greatly, though they still lose to the Fortifier preset 80% of the time. I would only recommend using them on tiny or small maps (or medium maps with pirates turned on) where their quick expansion and larger earlygame fleet size is the most important. The disadvantage of not having a properly upgraded economy also slowly fades away as you increase the difficulty level, so they are just as viable on larger maps at Cruel or Vicious.
  • Fortifier:
    These AIs are your Aggressors that are still capable late-game. Contrary to their name, they are actually quite aggressive with their expansion (they expand just as fast as the Aggressor preset) and don't focus nearly as much on tactical structures as the Aggressor preset, and although their planets are more easily taken earlygame since they don't concentrate as much on building ships either, they are much more able in the lategame due to their economic upgrades, and are much harder to defeat due to their use of upgraded Starbases (other AI presets don't tend to upgrade Starbases nearly as much as the Fortifier preset). They are more research-focused than Aggressors, and although they are generally less research-focused than the Researcher preset, the economic advantage that comes with early expansion can get them to end up having more techs unlocked than the Researcher preset. In short, they are like a hybrid between the Aggressor and the Researcher presets, with an extra emphasis on starbases and mines. I would recommend using them on medium or larger maps.
  • Researcher:
    These AIs are useless without any modding, but with modding, they are much more powerful and behave like your typical late-game Boomers. They are not as fast with their expansion as Aggressor or Fortifier presets, but still a bit faster than the Economist preset. Unmodded, their fleet sizes are laughable and they are easily taken out by other presets, but with some modification, they can hold their own against other AIs earlygame while they build up their prowess. They make up for their lack of units by concentrating a lot on research: it is not uncommon for Researcher AIs to have twice the amount of total researches as Aggressor or Economist presets in the first 15-90 minutes of the game (depending on map size), especially if they're Advent. In some cases, this advantage makes them snowball when factions start fielding larger fleets, and at normal difficulty levels, they are often the only AI preset that can stand toe-to-toe with a human player's offense. Their research and their upgrades will push their economy to levels where they will usually have the largest fleets out of all the AI presets after the first hour or so. However, their slow expansion makes them vulnerable to a containment strategy on smaller maps, especially without any modifications to Gameplay.constants, so once again, I would recommend using them on medium or larger maps.
  • Economist:
    These AIs are OK without any modding, but they improve the least from modding, causing them to perform the worst out of all four presets after they have all been tweaked. They are generally on par with the Aggressor AI in terms of fleet size, but lack in economy compared to Fortifier and lack in research compared to Researcher. The "Economist" part of their name only applies to their earlygame income, which they spend on ships anyway. In all other aspects, other presets tend to have a much better economy. Economists tend to either be very passive and defensive or overly aggressive to the point of sending their earlygame fleet to harass an enemy's capital instead of taking neutral planets. They expand incredibly slowly and spend most of their income on building ships and tactical structures; if the Researcher preset has been modified to not be such a wuss, Economists tend to be the first to get wiped out in AI FFA's due to their ridiculously slow expansion and suicide mission antics. I recommend you only use this preset sparingly.


Factions:

The AI has a lot of faction-specific behaviors associated with it; not only do AIs of the three/six vanilla factions behave differently based on the factions themselves, but they follow different routines as well. However, if the AI cannot determine which faction it is controlling (eg. as a result of controlling a non-vanilla faction or extensive modding of a vanilla faction), it will instead resort to fallback, faction-generic routines that make it completely differently, to the point of being considered its own "faction" entirely. Note that the AI will not always switch 100% to fallback routines: in some cases, only certain fallback routines will be used, while faction-specific ones will still govern other parts of the AI.

  • TEC Loyalist:
    AIs are a beast when playing this faction. Not only do they have the economy advantage inherit from being TEC, but they also take advantage of it much more quickly than TEC Rebels (eg. building Trade Ports, conquering neutral planets), since they don't get distracted as easily. Though they don't attack as often as TEC Rebels, when they do, they attack with a massively greater force, especially due to them spending more of their income on bolstering their economy. Their bonuses are also used a lot easier by the AI: it knows how to rush Novalith Cannons and research survivability-boosting techs (I haven't really seen multiple starbases though), and since the AI is very reactionary in its behavior, it will take advantage of the "if enemies in gravity well" bonuses as well. In fact, their only real downside compared to TEC Rebels is that because their cannons don't need missile tech, they won't upgrade missile tech as much in the unmodded game as TEC Rebels. TEC Loyalists is the best AI faction in vanilla Sins, period. I recommend using them with the Fortifier or Researcher presets, though they are so good at bolstering their economy that even the Aggressor and Economist presets are viable.
  • TEC Rebel:
    AIs playing as this faction are usually incredibly aggressive, sometimes overly so: when presented with the opportunity, they are much more likely to start harassing enemy planets, even if they have no siege ships, than to conquer neutral planets. If they start near an opponent, they are much less likely to bolster their economy as TEC Loyalists, plus they don't take advantage of their specialties nearly as much, either (since most, like Truce Among Rogues and Pirate Mercenaries, require tactics that aren't implemented into the AI). I do not recommend you use them on smaller maps, since they are much more likely to send suicide missions to other players' capitols instead of capturing neutral planets while there are still neutral planets to capture. On larger maps, they can get quite formidable, especially if they don't suicide their entire fleet halfway through the game; TEC Loyalists are still better overall though. If you do use TEC Rebels, I recommend the Aggressor or Researcher presets.
  • Advent Loyalist:
    The AI suffers from the fact that it cannot recognize how Advent units' abilities work together, so it will play Advent significantly worse than any competent human player.  This goes both ways however, as enemy AIs are also unable to recognize which ships should be killed first. Unmodded, Advent AIs also field poor unit composition, delaying Illuminator deployment and spamming Solarises instead of carriers with bombers. Despite all this, as long as the Advent AI plays against only other AIs, it should be fine. AIs playing as Loyalists, due to the faction's reliance on lategame techs for their economy, are often handicapped even more unless they are the Researcher preset; the lack of unlockables tied to economic techs is also a huge problem in unmodded Sins, since this means the AI will tend to research useless techs instead of economy-improving ones. If you do want to use Advent Loyalists, I recommend the Fortifier or Researcher presets due to the importance of lategame techs, but both Aggressor and Economist presets are viable on smaller maps due to Disciple Vessels' cost-efficiency and said presets' tendency to spam them.
  • Advent Rebel:
    The AI suffers from the fact that it cannot recognize how Advent units' abilities work together, so it will play Advent significantly worse than any competent human player. This goes both ways however, as enemy AIs are also unable to recognize which ships should be killed first. Unmodded, Advent AIs also field poor unit composition, delaying Illuminator deployment and spamming Solarises instead of carriers with bombers. Despite all this, as long as the Advent AI plays against only other AIs, it should be fine. I tend to find that Advent Rebels perform much better than Advent Loyalists, sometimes better than even TEC Rebels or Vasari Rebels, due to their unique techs being both mostly unlockable earlygame, requiring a lot less specialized tactics than the Advent Loyalist techs, and synergizing quite nicely with the whole Disciple-vessel-spam tactic Advent AIs usually employ at the beginning of the game. The fact that said techs generally help Advent players' economies earlygame adds to this advantage on lower difficulty levels. I tend to find that for Advent Rebels, the Fortifier preset concentrates the most on overall research while still properly expanding and maintaining a fleet (the Economist preset concentrates on Civilian Research, while the Researcher preset concentrates on Military Research, but both are eventually beaten in their focused categories by the Fortifier preset), so I would highly recommend using the Fortifier preset.
  • Vasari Loyalist:
    This faction comes in a close second to TEC Loyalists in terms of AI performance, and for similar reasons. Except for the whole mobile labs/planet stripping thing, none of their unique techs really require any "specialized" tactics to use; they even provide a tiny economic benefit by getting credit income from capital ships. This is in addition to how powerful Kosturas are compared to other superweapons and how Vasari don't need to send out colony ships to capture neutral extractors (it's not that this ability is so powerful, it's that the AI knows what to do with scouts more than it does with colony ships); since the AI tends to build colony ships instead of getting a colony capital ship, the fact that Vasari use colony ships for starbase construction only makes things easier for Vasari AI compared to other factions' AIs. However, in longer games, Vasari Loyalist AIs lose out to AIs from other factions due to not upgrading their economy well enough to maintain proper fleets and Vasari ships in general being the least economically efficient. It should be noted that Vasari AIs also do not know how to use starbases for offensive purposes, giving them a fairly large handicap against human players. Similarly to TEC Loyalists, Vasari Loyalist AI is good with any preset, though it is still generally better with the Fortifier and Researcher presets.
  • Vasari Rebel:
    AIs playing as this faction are either as capable as Vasari Loyalist AIs or worse than TEC Rebel AIs, depending on whether they have allies or not. Though they don't know how to use Starbase mobilization, arguably the most overpowered tech in the entire game, they know how to use all their other special techs, especially since AIs are usually quite eager to join allies in battle, and they move between phase lanes quite a lot. Of course, Vasari Rebel AIs still have all the advantages of being Vasari for AI (Kosturas, scouts capture extractors, one tech improves both metal and crystal extraction, etc.). Without allies though, a lot of the special techs that the AI knows how to use are worthless, hence why they perform worse than TEC Rebels in those cases. It should be noted that Vasari AIs also do not know how to use starbases for offensive purposes, giving them a fairly large handicap against human players. I recommend using the Fortifier or Researcher presets for reasons similar to Advent Rebels.
  • Fallback (faction-generic) AI:
    Fallback routines result in an odd AI behavior; the best word I can use to describe it is "rabid". The routines make the AI both extremely aggressive and incredibly irrational. Though fallback AIs still follow the behavior of their presets somewhat, they usually concentrate more on building ships and attacking enemy planets. The extent of "rabidness" depends on how much different parts of a faction were modded: for example, if the AI cannot find its faction-specific tactical structure, it will resort to fallback routines for ship production, tactical structure production, and fleet management, but it may still use faction-specific routines for things like research and starbases. When the fallback AI controls fleet management, attacks on enemy capitols within the first 10 minutes of a game are not uncommon. Fallback AIs maintain much fewer scouts than faction-specific AIs and are very buggy when handling capital ships: in the best case, the AI will usually idle capital ships around neutral planets until they are colonized, but in the worst case, capital ships might stand idly in the AI's capitol until they die (reported by GoaFan77).


 

Section 3: Modding AI Info

Since I do not have access to the AI's source code, all statements are based either on in-game observations from tweaking various values and/or on experimentally verifiable observations made by other players and modders.

As a modder trying to get into the AI's head, the Player Info menu ([d] inside the dev menu) is your friend: the four items [a] Show Mission Queue, [b] Show Fleet Comparison, [e] Show Spending, and [f] Show Build Lists are invaluable in relaying what the AI is thinking at any given time.

The AI operates using AI ticks: all AI orders are given out at regular time intervals. To clarify, this means all orders, from selecting techs to retreating fleets, are all given out at the same time, and the AI will wait a few seconds afterwards before giving out its next batch of orders. AI ticks happen roughly once every 10 seconds (9 to 11 income ticks), but they are out of sync between different AI players. To my knowledge, the time interval cannot be modded. 


Missions:

The AI gives orders to its ships based on missions the AI creates for itself to complete: it will populate its mission queue with missions, then produce and assign ships based on its current mission queue, rated by priority. Modders can view an AI's mission queue via [d] Player Info > [a] Show Mission Queue from within the dev menu, then selecting a unit, module, or planet belonging to the AI in question. Scout frigateRoleTypes will be sent on Explore missions with targets on enemy, neutral, or undiscovered gravity wells, Colony frigateRoleTypes will be sent on Colonize missions to nearby neutral, colonizable planets, combat ships might be sent on ClearOrbitForColonize missions to nearby colonizable, neutral planets with hostiles in orbit, etc. Note that the AI will never remove missions, only alter their priority; this is why AIs tend to be more and more schizophrenic the longer a game lasts, as their mission queue expands to sizes it can no longer handle properly. The only way for a mission to be removed from an AI's mission queue is if it is completed or if its objective is no longer valid (eg. attack a planet that is now allied, clear orbit for colonization of a planet that was just colonized by an enemy).

Mission .entity Files:
Some missions have their own .entity files, allowing modders a limited amount of control over them. Each mission has its own entityType, but all mission entityTypes have only one parameter, missionType. For the game to recognize a mission, its name must match its entityType, so multiple entities corresponding to the same mission are not possible. The missionType parameter is used to direct the AI to the appropriate algorithms. The framework means that, in theory, modders could redirect AI missions. For example, having the MissionAttackPlanet entity have a missionType of Explore would redirect the AI to its Explore routine whenever it wants to attack a planet. In practice however, the different mission types use different internal arguments, so redirects often cause the AI to lock up in the best case (eg. when redirecting MissionAttackPlanet to MissionFosterRelations) or the game to minidump in the worst case (eg. when redirecting MissionBuildMines to MissionBuildStarbase).

 

Gameplay.constants:

  • aiRetreatThreshold:
    Represents how quickly the AI will retreat: a lower value makes it retreat less often and a higher value will make it retreat more often.
    More precisely, it is the ratio of total allied time-to-kill to total enemy time-to-kill below which the AI will order a full retreat. Zero or less will mean the AI never retreats, while values higher than one make the AI retreat even when it faces a weaker force.
    Actual time-to-kill calculations are highly flawed: for example, things not taken into account include hit chance, miss chance, regeneration, squadron movement between attacks, weapons being on separate banks (this is mainly why AIs overvalue capital ships and Titans), and allied tactical modules. Decreasing this value does make the AI more consistent and reckless, willing to keep fighting even when it would be better to just cut losses and regroup. Increasing the value makes the AI preserve its ships a lot more, but it also makes its attacks more inconsistent; it is also more likely to get into jump-in, jump-out loops. As side effects, increasing this value also slightly slows down AI expansion rates, but simultaneously increases AI Capital Ship longevity and overall fleet sizes. Lower values are generally better on smaller maps, while higher values are generally better on larger ones.
    The AI will never retreat individual units: retreats are always full retreats, hence why the AI tends to lose its capital ships so often. Possible ways to get around this include exploiting Explore-type abilities.
  • pirateRaidDef:
    All settings here control the way pirates work, from the amount and types of ships they get to how often they go out on raids. For the purposes of this guide, I will only highlight the two entries that control planet targeting and upgrades; all other parameters control fleet composition, fleet size, and various cooldown times.
    • maxNumUpgradesPerRaid:
      Pirates have techs, just like all factions. This parameter controls the maximum amount of techs the pirate AI will unlock between raids, including levels within techs. Techs still require credits to be spent though, and the pirate AI will spend credits to build a properly sized raid fleet before it starts spending on research. The default value for this parameter is 2, possibly causing a significant bottleneck when pirates gain access to a lot of credits early on (either through multiple pirate bases or through high bounties).
    • juicyPlanetModuleThreshold:
      The pirate AI has deterministic when choosing what planet to raid: from the target player's owned planets, it will choose the one that is the least amount of phase jumps from a pirate base. However, if there is more than one planet that is closest to a pirate base in phase jumps, the pirate AI chooses one randomly, but it will always choose "juicy" planets over non-"juicy" planets. A planet is deemed "juicy" if it has at least as many modules built (both tactical and logistical count, as do extractors) as the value set by juicyPlanetModuleThreshold.
  • PlayerAITable: (under playerAISharedDef)
    These are a list of four tables used by the four different AI presets for various stuff. All parameters except for MaxBountyBidCount work in a similar fashion.
    • All values except MaxBountyBidCount: (eg. BuildShip, BuildModuleTactical, etc.)
      Most likely update frequency values: the higher a parameter's value, the more often the AI checks if it can/should perform that action. This process is independent of actually giving out orders; even if the AI checks whether it wants to build ships twice every second, it will still only give orders to build ships every AI tick (roughly 10 seconds). The higher these values go, the less of a difference you will see between them. For example, there is little observable difference between 4 digit values, since they indicate time intervals faster than once every second.
      All parameters are rather self-evident in what they control (BuildModuleTactical controls building tactical structures, BuildModuleResearch controls building labs, UpgradePlanetInfrastructure controls building bombing defenses, etc.), but BuildShip only affects military Frigates, Corvettes, and Cruisers and does not affect capital ships or civilian ships. Values zero or less makes the AI never perform the given action.
      These values also affect the maximum size of AI build lists (see Black Market and Resource Allocation subsection); when a build list can contain items from different categories (eg. the build list for planet improvements), these values also affect item priorities within the build list.
    • MaxBountyBidCount:
      The amount of "bidding spurts" the AI is willing to do between an immanent pirate attack and a launched pirate attack; the AI will only spend on bounties during this time. Changing the value to a different non-zero value will not change the amount of money the AI is willing to spend on bounties, only the number of times it is willing to overtake the existing bounty leader. Setting the parameter to zero or less will have the AI never spend money on bounties. Since the AI only gives out orders every AI tick, setting MaxBountyBidCount too high is pointless, since the bidding window will close before the AI can take advantage of the large amount of times it could potentially bid.
  • PlayerDiplomacyAIDef
    This section is filled with various settings related to diplomacy and the AI. For the purposes of this guide, I will only highlight the entries that do not affect human players, only AI players.
    • breakRelationshipThreshold:
      This determines the value at which pacts or treaties will automatically be revoked; each pact/treaty has its own value. Though this affects both human and AI players alike, the reason I am mentioning this value is because the AI will never revoke a pact or treaty, only if it would automatically happen by passing below breakRelationshipThreshold.
    • aiDiplomaticPointBonusScalar:
      This gives a bonus to the AI's accumulated diplomatic points depending on the AI's difficulty level; the bonus at each level can be set manually. The regular amount of diplomatic victory points received is multiplied by (1 + bonus) to get the actual value visible in-game.
    • timeBetweenTreatyOffers:
      The amount of time, in seconds, an AI player will wait before offering a player a treaty or a pact after a previous offer. Note that in the case of AI-AI alliances, this is usually the cause of AIs taking so long to make pacts with one another even though they have the necessary techs unlocked and are at a high enough relationship level.
    • timeBetweenQuests:
      The amount of time, in seconds, an AI player will wait before offering a player a quest after a previous offer. Note that this is based on when the quest was offered, not when it was completed.
    • aggressivenessModifierMin, aggressivenessModifierMax, aggressivenessModifierIncrement:
      Whenever an AI player is spawned, it will randomly get assigned an aggressiveness modifier. The aggressiveness modifier will be added to all of the AI player's relations with other players and will show up in the UI as "diplomatic inclination". Aggressiveness modifiers can range from aggressivenessModifierMin to aggressivenessModifierMax in increments of aggressivenessModifierIncrement; remember that because the modifier is added to relationships, a lower modifier equals more aggressiveness. An AI's aggressiveness modifier is independent of its preset: an aggressor preset is just as likely to have the highest modifier possible as an economist preset having the lowest modifier possible.
    • aiBonusMax:
      AI players will get a small relationship bonus with other AI players; the bonus starts out at 0 and increases over time until it reaches the value set by this parameter. Rate depends on the value set by aiBonusRate.
    • aiBonusRate:
      AI players will get a small relationship bonus with other AI players; the bonus starts out at 0 and increases by the amount set by this parameter every AI tick (about 10 seconds) until it reaches the value set by aiBonusMax.


Abilities:

The AI will automatically enable autocast and use certain abilities on ships and buildings of certain roleTypes. For example, abilities will automatically have autocast enabled for CANNON planetModuleRoleTypes. Scout frigateRoleTypes will automatically be assigned to Explore missions (see Missions subsection), even if they lack an Explore-type ability. Colony frigateRoleTypes (and possibly capital ships with the COLONY roleType) will automatically use Colonize-type abilities for Colonize missions. Otherwise however, if an ability does not have autocast turned on by default, the AI will never use it.

  • aiUseTime:
    Controls when an ability is autocast. There are multiple values it can take, you can read up on them in Zombie's soaseplugin wiki here; the situation each value represents is self-evident from its name. "Invalid" is only used if the ability cannot be autocast, while "NoEnemyShipsInGravityWell" will occasionally get bugged and still trigger if the enemies are militia or civilian ships.
  • aiUseTargetCondition:
    Controls under what conditions the ability is autocast, provided the aiUseTime condition is also met. There are multiple values it can take, you can read up on them in Zombie's soaseplugin wiki here; the situation each value represents is self-evident from its name. "Invalid" is only used if the ability cannot be autocast and "IsDifferentRoleType" will choose a target that has no common *RoleType (eg. frigateRoleType, planetModuleRoleType) values with the caster entity. Keep in mind that as of now, there is no way to logically manipulate aiUseTargetCondition parameters (ie. use "and", "or", "not", etc.), so you must choose only one, pre-defined value and work with that.
  • isAutoCastAvailable:
    Enables or disables autocasting. If set to FALSE, autocasting is disabled, and both aiUseTime and aiUseTargetCondition must be set to "Invalid". By default, the game only really sets this to FALSE for passive abilities, even for abilities with bugged autocasting (eg. Advent's Resource Focus).
  • isAutoCastOnByDefault:
    Controls whether the ability has autocasting turned on by default. The only reason I am mentioning this is that the AI will automatically use and enable autocast for abilities on ships and buildings of certain roleTypes (eg. Cannon, Scout, Colonizer) regardless of whether this parameter is set to TRUE or FALSE; otherwise however, if an ability does not have autocast turned on by default, the AI will never use it (thanks GoaFan and Seleuceia!).
  • ignoreNonCombatShipsForAutoCastTarget:
    Controls whether the ability ignores civilian ships (Construction Frigates, Trade Ships, Refinery Ships, Colony Frigates, Envoys, and Starbase Constructors) for autocast targetting.
  • onlyAutoCastWhenDamageTakenExceedsPerc:
    Decimal parameter that controls when an ability is autocast depending on the hull damage the caster has taken as a fraction of its total hull. Only hull damage is taken into consideration. Values zero or less will disable this parameter, while values one or greater will make the ability never autocast (the caster will be destoyed before the ability is cast).

Leveling Capital Ships and Titans:
The AI will choose a random ability from its unlocked abilities that are at the lowest level, unlocking new abilities only if it cannot do anything else. Abilities with isUltimateAbility set to TRUE will be prioritized over those that are not. As a result, AI capital ships in the base game will always end with two random abilities and their ultimate maxed and will never have a non-ultimate ability more than one level higher than their other unlocked abilties. The same logic appears to govern the way Titans are leveled.

 

Planet Modules and Ships:

AIs strongly depend on frigateRoleType, planetModuleRoleType, roleType, and role values assigned to ships and planet modules. "Strength" calculations are never done when the AI is deciding what to build. Modifying these values will affect what ships/buildings the AI will create, also influencing its army composition. For example, setting the culture module's planetModuleRoleType to "REPAIRPLATFORM" should have the AI building it as if it were an orbital repair platform, while adding the frigateRoleType "AntiModule" to carriers will have the AI building carriers to try to counter starbases and static defense in addition to actual antimodule frigates like the Ogrev. Keep in mind though that altering these values may have other gameplay effects, notably on autocasting when the "IsDifferentRoleType" aiUseTargetCondition value is used; ships with the "AntiModule" frigateRoleType can only attack structures, so use it only sparingly, even if the AI does love it. For strike craft, the "role" value for the strike craft's squad is used, while the roleType value for capital ships is barely used outside of determining which capital ships can colonize.
Note that messing around with modules' planetModuleRoleType is a lot more risky than messing around with frigates' and capital ships' roleTypes: the game seems to be very particular about certain roleTypes, and will crash if modules of a certain planetModuleRoleType do not comply with its expectations. For example, structures with the WEAPONDEFENSE planetModuleRoleType must have a weapon, otherwise the game will crash when the AI wants to build one.

Frigates with Bombing Damage:
The AI handles these in an odd fashion: if a frigate can deal damage to enemy planets, the AI will order them to attack the planet upon entering the gravity well, even if they don't have the "Siege" frigateRoleType and/or there are high priority targets (ie. Colony Ships) nearby (thanks Seleuceia!). The game will crash if an AI is playing a faction with no frigates that have a particular frigateRoleType, such as "ResourceCollector" (thanks Seleuceia!); this is likely due to it searching for particular frigateRoleType ships when queuing possible missions (see Missions subsection).

Building Capital Ships:
The AI is quite straightforward with building capital ships: if it has no capital ships or its lowest level capital ship is level 3 or higher, it will queue up a random capital ship at its home planet (thanks Lavo_2!). This queue is not the same as the in-game build queue, and the capital ship type will randomly change every AI tick until it actually gets queued in-game. In-game stats have so far shown that capital ship choice is truly random, both for the first capital ship built and for any subsequent capital ships. Giving the AI the means to reach capital ship level 3 quickly, eg. by making the XP cost of the first two levels 0 via gameplay.constants, will force the AI to spam capital ships. Note that if the AI has no capital ship factories, it is hardcoded to prioritize a new capital ship factory in a similar manner; the implementation is a bit buggy though, see the Build List Bugs subsection under Overall Production and Resources.

Building Titans:
The AI is prioritized to research titan-unlocking techs; however, it will only actually start construction of a titan once it has enough capital ship slots. Since the AI only upgrades its capital ship slots if it currently has 0 slots, Titan construction is only possible once the AI has researched the first capital ship supply tech that gives 2 capital ship supply, or if it loses a capital ship while having the necessary techs unlocked. By default, this is capital ship supply tech 4, meaning the AI must either lose a capital ship after all titan-unlock techs have been researched or have at least 3 capital ships level 3 or higher before it will even consider titan construction. Once a titan is in a build list, it is hardcoded to have a higher priority than even capital ships, so gathering enough resources for it usually is not a problem for the AI.

 

Fleets and Army Management:

When managing armies, AIs make constant use of fleets. Though AIs can manage individual ships just as well as fleet groups, fleets will be an AI's smallest army element 99% of the time, so AIs will usually move to target planets as a fleet, retreat as a fleet, and move to locations within gravity wells as a fleet (attacking is a bit different). All AI fleets will adopt a cohesion range of All Standard, regardless of what is set as defaultCohesionRange in Fleet.entity. AI ships will organize into fleets regardless of whether or not autoJoinFleetDefault is set to TRUE or FALSE. However, AI ships that only have certain frigateRoleTypes will never make or join fleets, even if autoJoinFleetDefault is set to TRUE: these frigateRoleTypes are Scout, Colony, ResourceCapturer, ModuleConstructor, Cargo, Envoy, and StarBaseConstructor; Scout is a special case outlined two paragraphs down. Flagships are still included in fleet management processes, but the AI forces them out immediately afterwards, so they are practically exceptions.

Making and Rearranging Fleets:
AIs will fire off fleet creation and rearrange routines throughout the entire game. Most creation and rearrangement routines will only fire if any ship in the gravity well has no current order. When a non-fleet combat frigate (any frigate that is created for a frigateRoleType that isn't Colony, Scout, ResourceCapturer, ModuleConstructor, Cargo, Envoy, or StarBaseConstructor) with no current order is in a gravity well or phase jump region that has no fleets and at least one other combat ship, it will initiate a fleet creation function at the next AI tick (roughly once every 10 seconds): either the originator of the creation function or a higher ranking (Titan > highest level Capital Ship > lowest level Capital Ship > Frigates and Corvettes), non-fleet combat ship in the same gravity well (ships in phase space count as being part of the gravity well to which they are jumping) will create a new fleet and invite all other non-fleet combat ships to that fleet.

When a combat frigate enters a gravity well or phase jump region that already has at least one fleet, it will initiate a fleet rearrangement process on the next AI tick (roughly once every 10 seconds); every ship that takes part in the fleet rearrangement process (ie. has at least one frigateRoleType that is a combat frigateRoleType) will be part of a fleet after it is completed. All ships in the same gravity well assigned to the same mission (see top of Section 3) will be placed into the same fleet. Note that ships already in the same fleet can still be (re)assigned to separate missions. The AI will periodically check if ships in a fleet are still both in the same gravity well and on the same mission and if not, they will fire off a fleet rearrange. As a result, large fleets phase jumping to a gravity well will often be split up, since even though the ships are on the same mission and in the same fleet, the ships currently in phase space technically are not in the same gravity well as those that are preparing to jump; this triggers a fleet rearrange, splitting up the large fleet,

Scout frigateRoleType Issues:
Although the AI treats the Scout frigateRoleType as a non-combat frigateRoleType, the moment a ship with it enters into a fleet with one other ship, even if that other ship is also a scout, it will switch over to a combat frigateRoleType for that ship. Since the AI will not attack with ships that do not have auto-attack turned on, those scouts are dead weight for the rest of the game. The AI will also not build any new scouts, thinking its existing ones (that are dead weight) are enough. A small workaround is to have an explore ability with autocast turned on by default; this will force the AI to still try to keep scouting with its dead weight scouts. However, the AI still recognizes those ships as combat ships, so they will often try to jump back to a gravity well containing normal fleets. If aiUseTime is set to Always on the explore ability, the scout ships will waddle back and forth between trying to scout a gravity well and trying to assist an allied fleet; though this is still no solution, it is better than nothing, and there is little modders can ultimately do to fix the scout grouping bug.

Giving Orders:
The AI will only give fleet leaders explicit orders, making non-leader fleet member behavior fairly predictable; the sole exception is any frigate with planet bombing capabilities, who will always be ordered to bomb a planet. Unless the fleet is planning to jump to another gravity well, fleet members will move with the fleet leader at all times, matching the fleet leader's speed. This means that if a fleet member is faster than the fleet leader, it will move slower than usual. If the fleet leader is targeting an enemy that is not in the same fleet as a member's target, the member will move into formation with the leader (matching speed as well) until an enemy that is part of the fleet the leader is targeting enters the member's attack or autocast range; if the member cannot attack (eg. carriers) or doesn't have auto-attack turned on by default (eg. scouts), it will simply stay in formation with the fleet leader.

 

Overall Production and Resources:

To determine what it wants to spend resources on, the AI keeps track of six total spending queues, or "build lists": one for ships of all types, one for research, one for building research labs, one for building logistical structures that aren't labs, one for tactical structures, and one for planet upgrades of all types. These can be viewed at any time from the dev menu via [d] Player Info > [f] Show Build Lists. Build lists are where the AI queues up stuff it wants to buy but cannot. Every AI tick, the AI will choose a build list to focus on (highlighted in red), trying to buy whatever it can from the focused build queue. The build list to be focused on is determined by a combination of chance, AI preset, current spending allocation, current fleet stance, and the priority of the highest priority item in each build queue. Priority within build queues is largely dependent on hardcoding and AISharedDef values from gameplay.constants. The maximum size of each build queue is determined by AISharedDef values from gameplay.constants, but not in a 1:1 fashion (eg. a value of 3 for BuildModuleResearch will not force the AI to only have 3 items in its labs build list).

Resource Tracking:
Credits are the main currency for the AI: they are what the AI keeps track of, while Metal and Crystal are only considered to the extent that the AI can afford what it wants to do. For instance, while Credits spent on buying Metal and Crystal on the Black Market are kept track of in the AI's spending log, Metal and Crystal sold for Credits are not.

Resource Allocation:
Current resource allocation can be seen under the [e] Show Spending in the player info menu, while ideal resource allocation is driven by the AI's preset. An Aggressor AI is hardcoded to spend more Credits on ships, while Researcher AIs are hardcoded to spend more Credits on research. Spending Credits on the Black Market is tracked independently of everything else, so an AI that spends twice as many Credits on a tech due to having to buy Crystal from the Black Market will still only note down the tech's credit cost as "spending on research". The ideal allocations set by each preset don't appear to change over time, resulting in things like the Researcher preset researching every tech up to level 3 in the first few minutes of the game.

Things get really wonky with ships that build structures or have abilities that cost resources. Specifically, the AI will not keep track of Credits spent on abilities or structures built by ships instead of from planets: in particular, this applies to starbases and non-TEC mines (TEC mines are built from the tactical structures menu, so the AI logs its spending as spending on tactical structures). Spending on ships will always be logged down as such, even if the sole purpose of the ship being built is to construct something, eg. starbase constructors. Starbase upgrades, on the other hand, are kept track of in their own category with its own allocation expectation. This is why Aggressors tend to have a lot of unupgraded starbases (their hardcoding prioritizes spending on ships, so they will spend lots on starbase constructors, not log down the cost of building a starbase, then not upgrade those starbases because they are hardcoded to not spend as much on starbase upgrades). The AI also has no resource allocation for diplomacy: spending on envoys is recorded as ship spending, spending on unlocking diplomatic actions and abilities is recorded as research spending, and sending resources to other players to complete missions is not kept track of at all.

Black Market:
The AI is very liberal when using the Black Market. When considering what it can afford, the AI will always take the Black Market into account, even if it would result in spending three or four times as much on something. More often than not, the AI will decide what to do and try to find a way to afford it rather than choose something to build or research that it can already afford without splurging on the Black Market. This is why Aggressor Vasari AIs tend to spend mounds on buying metal (Vasari LFs have a fairly high metal cost for their build times and supply usage, so Aggressor AIs who keep spamming LFs will run out of metal real quickly, and their drive to build more ships results in their Metal buying sprees), while Researcher AIs, especially Advent, will tend to spend loads on Crystal.

AI Biases From Resource Cost:
Due to set-in-stone ideal resource allocations and the fact that only Credit spending is kept track of, the AI will prefer ships and structures that cost less credits but more metal and/or crystals over those that cost more credits. For example, if a ship costs 100 Credits and 1000 Metal, the AI will spend 4500 Credits or so on buying the Metal, build the ship, and log it all down as 100 Credits spent on ships and 4500 credits spent on buying Metal. If the AI is an Aggressor AI, it will want a rather large chunk of its spending in the ships category, so it will keep buying the ship until it thinks it has spent enough credits on ships, theoretically building about 45 more ships than normally desired. The extra credits spent on buying metal are logged as Black Market expenditures, which lower the percent of expenditures in all other categories, even the one in which the bought resources were spent (in the case of the example, this would be ships).

Extractor Build Order:
The AI will always build extractors in the same order, no matter their current income ratios. They will always build metal extractors first and crystal extractors second. When there are multiple asteroids available, the AI will alternate between building the two, but if possible, one metal extractor will always be built before a crystal extractor. This does not appear to apply to capturing neutral extractors (since autocast targeting is what controls AI behavior there).

Build List Bugs:
Normally, the AI is programmed to only place items on build lists that are available to it at the time. For example, it will not place frigates in its ship build list that it has not unlocked yet, it will not place social upgrades on its planet upgrade build list when it has already chosen industrial upgrades for all its current planets, etc. There are, however, a few exceptions: the AI does not check if research prerequisites are met before queuing up extractors, frigate factories, capital ship factories, military labs, and civilian labs. While most of these will simply be queued up and forgotten, capital ship factories with research prerequisites will actually cripple the AI until it finally builds one. This is because capital ship factories are given hardcoded priority, meaning the AI will barely build any non-labs logistical structures, including extractors, until it finally satisfies its lust for a capital ship factory.

 

Research:

AIs have a very set-in-stone method of researching techs, and there is little modders can do to alter the process. Though the AI will not consider a research's cost, it will not try to research anything that it cannot afford outside of the hardcoded stuff mentioned later and the Research Victory tech. Due to the AI's reliance on resource allocation when determining whether it should research a tech or not, AIs will usually research lower tier techs first. Observations indicate that when the AI wishes to research something, it will queue up all techs that are currently available to it in its Research build queue (see Production and Resources subsection), though never queuing up more than one level of a tech at a time. It will then treat its research build list just like any other: rearranging it every AI tick, giving it focus based on the highest item on the build list and its current resource allocation, etc.

Hardcoded Priorities:
The AI is hardcoded to greatly prioritize certain techs under certain conditions (they will always occupy the top of the research build list and will often cause the AI to shift focus to it). AIs are hardcoded to research every single tech and its prerequisites that unlock ships or planet modules, though it will only do so once it has enough labs to research all the necessary techs required: for example, this includes the first few levels of the extraction bonus techs for Vasari (unlocks Orbital Refinery), all the regular culture techs for Advent once 8 civilian labs are built (unlocks Deliverance Engine), and all missile weapon upgrades for TEC Rebels once 8 military labs are built (unlocks Novalith Cannon). However, since the AI can research techs before their labs complete, it may appear that the AI is unlocking techs even before it can research a prototype. Other techs included in AI hardcoding are as follows: supply cap and capital ship cap techs if the AI has maxed out the respective supply, techs that unlock the colonization of planet types the AI has discovered and wishes to colonize, wormhole travel unlocking techs if the AI has discovered wormholes, and interstellar travel unlocking techs if there are multiple star systems. All vanilla faction AIs in Sins are also hardcoded to research the relationship-improving techs from the Diplomacy tech tree. The AI is hardcoded to only ever research pacts if it has a ceasefire treaty with at least one other player, but said pact unlock techs get hardcoded priority when this is the case.

The priority parameter:
This parameter in a tech's .entity file dictates its priority in the research Build List: a tech with a priority of 2 will always be placed above techs with a priority of 1. Techs with a priority of 0 will never be researched by the AI unless they have hardcoded priorities. The game will accept both negative and decimal values for priority (possibly up to the limits of a double-type variable), but it will treat negative priority values as if they were 0. Techs with hardcoded priority are always placed at the top of the list irrespective of their priority parameter value.  The AI will rearrange its build list every AI tick, meaning that two techs with equal priority have an equally random chance of being researched before the other. Note that giving a single tech a higher priority value than others may effectively stop the AI from researching completely: since the AI will only ever compare the top items in each build list, and giving a single tech higher priority than all others will place it at the top of the research build list (under hardcoded techs), if the AI never wants to research mentioned single tech, it will never give focus to the research build list, stalling all research.

Dummy Research Ladder:
A while back, a coding trick for prioritizing certain techs was developed by a group of enterprising modders, including Lavo_2, GoaFan77, and Zombie. The trick takes advantage of the AI being hardcoded to prioritize techs that unlocks ships/buildings, being able to define 2 research prerequisites for each tech, and being able to place tech buttons in an off-UI area so that human players will never see them, but the AI can still research them. It involves making a ladder of 0 cost dummy techs, with the bottom of the ladder populated with actual techs (endpoints for each tech chain are enough) and the top of the ladder containing a tech that unlocks a dummy ship or building that is too expensive for the AI to ever actually make in-game. Since the AI is hardcoded to prioritize unlocks, it will try to unlock the dummy ship, even if the ship is actually too expensive to ever purchase. To do so, it needs to climb up the dummy research ladder, and to do that, it needs to complete every single research in the game. Though the trick requires a long, ardous setup time (you need to set up a different ladder for each tech tree, requiring about n-1 dummy techs for n total "real" techs), and the effects usually only kick in once the AI has enough labs to research the highest tier tech at the bottom of the ladder, the payoff is that the AI will highly prioritize certain techs, regardless of its preset. Modders who use this trick must choose between two options: either having a smaller ladder, which results in the AI greatly prioritizing certain key techs and relying on the usual process for all others, or a large ladder, which results in the AI prioritizing all techs regardless of preset, but losing focus as a result.




Once again, the contents of this post are subject to change as current observations are reevaluated and new ones are noted down. If you see something missing or not aligning with your own in-game observations, please let me know.

410,038 views 113 replies
Reply #51 Top

Quoting SoulxReaper, reply 50
AMD/EA got carried away in the mantle hype and die hard bf2 fans (me partly included) may have gotten sad at the situation, but these decisions are based on reality, not some fantasy world where everyone has time to do everything.

EA may very well have screwed up with Mantle, as with many other BF4 issues, however Mantle is far from pure hype. There's very concrete, independently verified, benefits to Mantle as show in numerous Star Swarm tests. In fact, if you have a Mantle compatible GPU, you can test out Mantle yourself and see how it works.

Reply #52 Top

Quoting SoulxReaper, reply 50

I take it that you have zero experience with anything that remotely resembles code or business...

carried away in the mantle hype

lmfao

die hard bf2 fans (me partly included)

ahahahahaha

 

2/10, you get points for giving me a good chortle, but I'm afraid that's about it.

Reply #53 Top

I'm starting to love/hate these tangents, but I'll keep the replies concise to minimize blocks of text.

@StormingKiwi: Sure, a new setup would confuse humans just as easily, but humans can adapt and "change their hardcoded definitions" on their own, if you will. Having the AI query all possible actions, spells, and techs for every unit in the game to automatically account for any modifications would be a step in the right direction, but by then you'd essentially have to make an AI that would work in any custom gamemode ever made, which is quite a tall order.

@Soulxreaper: Mantle has as much to do with modability as PhysX, that is to say absolutely nothing. In fact, I'd wager that EA's decision (because it sure as heck wasn't DICE's) to restrict modability in the Battlefield series starting with Bad Company has absolutely nothing to do with extra cost. The cynical side of me would say it has more to do with artificially increasing the value of official mappacks and DLC (since it's now the only way to get new Battlefield content), while the optimist side of me would say it's because EA, currently being run by out-of-touch and control-freak people, simply dislikes people messing with their games in any way.

As for Mantle, I'm on Lavo's side saying that Mantle definitely has quite a lot of benefits, especially due to increased parallelism. I've always wondered why games haven't utilized OpenCL to help the CPU with calculations a GPU could easily do, and Mantle seems like it fills the exact same purpose, just with a more games-oriented approach and large GPU manufacturer backing it. My biggest concern however is that contrary to what AMD have said about an open API, Mantle becomes a proprietary, AMD-only thing, as they have yet to release any specifications. If AMD keep Mantle an AMD-only thing, it will likely result in a situation similar to PhysX on the nVidia side of things.

 

In the meantime, however, I've updated the mod to v0.47. It's a relatively minor update, with another tweak to frigateRoleTypes to help army composition, but I also made a v1.82BETA version of the mod. In addition, I've moved the mirror links from Multiupload to Dropbox, seeing as I no longer trust Multiupload to direct people to an actual download page instead of one advertising malware, and I've been having upload problems with Mega as of late.

 
Reply #54 Top

Quoting Delnar_Ersike, reply 53

@StormingKiwi: Sure, a new setup would confuse humans just as easily, but humans can adapt and "change their hardcoded definitions" on their own, if you will. Having the AI query all possible actions, spells, and techs for every unit in the game to automatically account for any modifications would be a step in the right direction, but by then you'd essentially have to make an AI that would work in any custom gamemode ever made, which is quite a tall order.
 

This is true - sometimes it's not that true however. Currently I'm pretty active on the PA forums, and there are a lot of requests for features, which are actually already implemented, just hidden in a settings menu somewhere.

Reply #55 Top

Updated the mod to v0.50; changes include frigateRoleType edits to heavy frigates and utility frigates, changing the Space Egg's roleType to COLONY (from Invalid, which was likely an oversight by the devs), changing aiRetreatThreshold to 0.3 (from 0.2, unmodded was 0.25) after much deliberation and multiple test runs, a slight increase in the AI research check frequency, and slightly increasing the priority value for all techs that give some sort of an economic boost (eg. cargo hold size increase techs) or a significant advantage characteristic to a faction (Truce Among Rogues, Global Unity).

I've also updated the info pages with information about how the AI handles Victory Conditions, both when trying to achieve them and when trying to stop someone from achieving them.

 
Reply #56 Top

Does anyone know if this mod is compatible with Star Trek Armada 3? I've seen one of your fixes is to curtail the spam of anti-structure frigates which is pretty much the same problem in ST:A3 also!

Reply #57 Top

Quoting Delnar_Ersike, reply 55
a slight increase in the AI research check frequency

How did you manage to do this?

Reply #58 Top

Quoting Xonal, reply 56
Does anyone know if this mod is compatible with Star Trek Armada 3? I've seen one of your fixes is to curtail the spam of anti-structure frigates which is pretty much the same problem in ST:A3 also!

The mod itself is not compatible; even a direct port wouldn't work, seeing as STA3's frigate and capital ship dynamics are quite different from the original game. However, there is no reason why a skilled and/or dedicated modder wouldn't be able to implement the mod's changes into STA3: all the information I used to create my mod is located in Section 3.

Quoting Lavo_2, reply 57
How did you manage to do this?

Via Gameplay.constants, as outlined by the relevant part in Section 3:

PlayerAITable: (under playerAISharedDef)
These are a list of four tables used by the four different AI presets for various stuff. All parameters except for MaxBountyBidCount work in a similar fashion.

All values except MaxBountyBidCount: (eg. BuildShip, BuildModuleTactical, etc.)
Even though these values seem like weights, as in how much a preset emphasizes a certain action, they actually are not. Instead, they are most likely update frequency values: the higher a parameter's value, the more often the AI checks if it can perform that action and if it should. Though this does indirectly affect priorities (an AI with a higher BuildShip value will check to see if it should build ships more often than one with a lower priority, therefore it will eventually have a slightly larger army), it is important to keep in mind that these are still update check frequency values, not priority values (eg. increasing UpgradeResearch to 1000 times its original value will not force the AI to concentrate on Research, and multiplying all values by the same amount shouldn't really change the AI's overall resource allocation, but should let it react more quickly to its environment). Also keep in mind that increasing values to a very high amount will have a performance hit, as the AI needs to do thorough checks a lot more often. Testing shows that the values do not increase check frequency linearly: multiplying a value by 10 has shown to approximately double frequency checks (results seem to roughly correspond with C/log(x+1), where x is the value and C is a time constant determined by various parameters, like game speed). All parameters are rather self-evident in what they control (BuildModuleTactical controls building tactical structures, BuildModuleResearch controls building labs, UpgradePlanetInfrastructure controls building bombing defenses, etc.), but BuildShip only affects military Frigates, Corvettes, and Cruisers and does not affect capital ships or civilian ships. Setting any parameter's value to 0 makes the AI never perform that action, and setting it to a negative number has the same effect.

 
Reply #59 Top

Just wanted to add a few about the vanila AI. That if planets are owned by rebels (usually only happens when u urself makes a map and adds high rebels on planets), then faction/races such as techs will not grab planets into midgame at least, because they research "friendly" with planets somewhat early.

Therefore when playing against techs make sure that ure premade map does NOT have high rebels/neutral on planets. So that the planets are not controled by neutrals.

----------
Also. Changing the value when enemies flee is hard to balance and dangerous for that reason alone. Simply because if they flee often they will be MUCH harder to face early to midgame (fleeing back to their defenses where u cant beat them yet). But when u facestomp them late game they will flee to their previous planet TOOOO often, just because ur army is always that much larger. 

So question is. Do we want harder early or late game? Late game without the mod is extremely easy, partly because they escape always and gives away planets for free. Therefore late game needs to be buffed imo, but if they flee more often wouldnt they become easier late game now? I dont know if thats the case, because i havent tried ur mod yet (downloading now), but I for sure dont want them to be even more nerfed late game :P espacially since they dominate early but ar really easy late game.

PS: What is the best/hardest AI preset to actually play against in modded and UNmodded game? IF I play VICIUOS. Your first page isnt exactly clear what the best presets are if you just want the highest difficluly. Both late game and early game. In unmodded the AI tend to fall of a lot, and stop building units almost all together. Making it really easy to just go from planet to planet. 

Reply #60 Top

Quoting WarNeck, reply 59
Just wanted to add a few about the vanila AI. That if planets are owned by rebels (usually only happens when u urself makes a map and adds high rebels on planets), then faction/races such as techs will not grab planets into midgame at least, because they research "friendly" with planets somewhat early.

Therefore when playing against techs make sure that ure premade map does NOT have high rebels/neutral on planets. So that the planets are not controled by neutrals.

Odd, when I was observing TEC Rebels in the unmodded game, they didn't really prioritize Truce Among Rogues (my mod increases the priority of TAR and has it as a prerequisite to the TEC Rebel dummy ship, so they'll probably research it a lot sooner). If this behavior holds even for non-TEC Rebels, it is likely indicative of the AI not understanding the way Uprising/Militia factions work.

Quoting WarNeck, reply 59
Also. Changing the value when enemies flee is hard to balance and dangerous for that reason alone. Simply because if they flee often they will be MUCH harder to face early to midgame (fleeing back to their defenses where u cant beat them yet). But when u facestomp them late game they will flee to their previous planet TOOOO often, just because ur army is always that much larger. 

So question is. Do we want harder early or late game? Late game without the mod is extremely easy, partly because they escape always and gives away planets for free. Therefore late game needs to be buffed imo, but if they flee more often wouldnt they become easier late game now? I dont know if thats the case, because i havent tried ur mod yet (downloading now), but I for sure dont want them to be even more nerfed late game espacially since they dominate early but ar really easy late game.

From my experience, lower values are generally better on smaller maps, while higher values are generally better on larger ones. Though you'd say this is a direct contrast to what you're stating, the main problem is fighting over neutral planets. Sure, the AI might retreat back to their defenses earlygame, but on a smaller map, that means they're forfeiting a neutral planet; when there are only 9 neutral planets to colonize for 3 players, having the AI retreat from trying to acquire a planet dooms their fate a lot more than on a large map with 70+ planets available to 10 players. Sure, on higher difficulty levels, the large AI income advantage makes up for their lower income from constantly retreating, but they'll still be limited in terms of tech and culture by infrastructure slots.

Quoting WarNeck, reply 59
PS: What is the best/hardest AI preset to actually play against in modded and UNmodded game? IF I play VICIUOS. Your first page isnt exactly clear what the best presets are if you just want the highest difficluly. Both late game and early game. In unmodded the AI tend to fall of a lot, and stop building units almost all together. Making it really easy to just go from planet to planet.

The higher you set an AI's difficulty, the less their presets' "hidden values" (ie. Researcher willing to accept techs more, Fortifier willing to upgrade starbases more) matter. Since they'll already be overflowing with income, AIs will always have enough resources to just keep upgrading everything. At the point, the AI is more at the mercy of the unmodded game's stupidly low "check frequency" values, since they'll be earning resource faster than they can spend it all, even if they're upgrading and researching everything they can. Still, I'd wager Aggressor is the best out of the four presets simply because they will take advantage of their income edge a lot earlier than other presets (they will immediately attack you with their ludicrously large fleets, whereas Fortifier and Researcher might take their sweet time). Fortifier might still put up quite a fight though, since they'll likely have maxed out starbases at each gravity well (and by maxed out, I mean all modules unlocked, since the AI can go over the max allowed starbase modules limit as outlined in the "General" part of Section 2); in that case, I recommend having a Vasari Rebel or Vasari Loyalist set as the Fortifier, since they're the only ones who might use their fully-upgraded starbases offensively.

 
Reply #61 Top

Quoting Delnar_Ersike, reply 60


Quoting WarNeck, reply 59Just wanted to add a few about the vanila AI. That if planets are owned by rebels (usually only happens when u urself makes a map and adds high rebels on planets), then faction/races such as techs will not grab planets into midgame at least, because they research "friendly" with planets somewhat early.

Therefore when playing against techs make sure that ure premade map does NOT have high rebels/neutral on planets. So that the planets are not controled by neutrals.

Odd, when I was observing TEC Rebels in the unmodded game, they didn't really prioritize Truce Among Rogues (my mod increases the priority of TAR and has it as a prerequisite to the TEC Rebel dummy ship, so they'll probably research it a lot sooner). If this behavior holds even for non-TEC Rebels, it is likely indicative of the AI not understanding the way Uprising/Militia factions work.


Quoting WarNeck, reply 59Also. Changing the value when enemies flee is hard to balance and dangerous for that reason alone. Simply because if they flee often they will be MUCH harder to face early to midgame (fleeing back to their defenses where u cant beat them yet). But when u facestomp them late game they will flee to their previous planet TOOOO often, just because ur army is always that much larger. 

So question is. Do we want harder early or late game? Late game without the mod is extremely easy, partly because they escape always and gives away planets for free. Therefore late game needs to be buffed imo, but if they flee more often wouldnt they become easier late game now? I dont know if thats the case, because i havent tried ur mod yet (downloading now), but I for sure dont want them to be even more nerfed late game espacially since they dominate early but ar really easy late game.

From my experience, lower values are generally better on smaller maps, while higher values are generally better on larger ones. Though you'd say this is a direct contrast to what you're stating, the main problem is fighting over neutral planets. Sure, the AI might retreat back to their defenses earlygame, but on a smaller map, that means they're forfeiting a neutral planet; when there are only 9 neutral planets to colonize for 3 players, having the AI retreat from trying to acquire a planet dooms their fate a lot more than on a large map with 70+ planets available to 10 players. Sure, on higher difficulty levels, the large AI income advantage makes up for their lower income from constantly retreating, but they'll still be limited in terms of tech and culture by infrastructure slots.


Quoting WarNeck, reply 59PS: What is the best/hardest AI preset to actually play against in modded and UNmodded game? IF I play VICIUOS. Your first page isnt exactly clear what the best presets are if you just want the highest difficluly. Both late game and early game. In unmodded the AI tend to fall of a lot, and stop building units almost all together. Making it really easy to just go from planet to planet.

The higher you set an AI's difficulty, the less their presets' "hidden values" (ie. Researcher willing to accept techs more, Fortifier willing to upgrade starbases more) matter. Since they'll already be overflowing with income, AIs will always have enough resources to just keep upgrading everything. At the point, the AI is more at the mercy of the unmodded game's stupidly low "check frequency" values, since they'll be earning resource faster than they can spend it all, even if they're upgrading and researching everything they can. Still, I'd wager Aggressor is the best out of the four presets simply because they will take advantage of their income edge a lot earlier than other presets (they will immediately attack you with their ludicrously large fleets, whereas Fortifier and Researcher might take their sweet time). Fortifier might still put up quite a fight though, since they'll likely have maxed out starbases at each gravity well (and by maxed out, I mean all modules unlocked, since the AI can go over the max allowed starbase modules limit as outlined in the "General" part of Section 2); in that case, I recommend having a Vasari Rebel or Vasari Loyalist set as the Fortifier, since they're the only ones who might use their fully-upgraded starbases offensively.

 


Good informative replies :) Are you certain that higher flee values are better for large maps? I usually play 80+ planet maps On vicious AI, in vanila, they often escape and even leave their own planets once I have full fleet at their planets (late game), almost constantly. Though I am uncertain if they escape before their starbase is destroyed. I have to pay attention to that in my next map... Basicaly the issue with them escaping once I enter their planets is that they simply give the planet to me freely that way. Late game I move from planet to planet witout facing a single units, even when they have easily 8+ planets left...

Somehow in vanila, the AI is not giving up a good fight late game, AI mostly seem to be stacking less units together (both offensively and defenisvely), and seems to be walking back and fourth more between their own planets, appearing to do nothing. I think I figured out partly why... Its partly because there are soooo many rebelions late game that they have to send their units back and fourth between their planets, instead of engaging me or protecting their outer planets from invasions. Therefore rebels are an issue in this game late game id say. Could I be right about my theory, and thats why they sort of just move back and fourth betweeen their planets late game? 

Ah I see. Then I will use Fortifier on Vasaris and Aggresive on the rest of the races, with and without ur mod both :) What would be the best preset of thsoe two for late game would you say? Both with and without your mod?

 

PS: If two races are allied against me and stack double army at my gravity well vs my army. Would they consider their army as a one? Flee less likely then? I really want the AI to become a larger threat late game, but I really have no clue how to make them. Even with your mod I think they will fall behind and "bug out" betweeen their planets and split their armys to much. And as a last question. With your mod, will "Rebel Loyalist" finally build 2 vasari starbases as standard? Or is that hardcoded and not possible to change?



Sorry for my weak english, but I think you understand most of it!

Reply #62 Top

Quoting WarNeck, reply 61
Good informative replies Are you certain that higher flee values are better for large maps? I usually play 80+ planet maps On vicious AI, in vanila, they often escape and even leave their own planets once I have full fleet at their planets (late game), almost constantly. Though I am uncertain if they escape before their starbase is destroyed. I have to pay attention to that in my next map... Basicaly the issue with them escaping once I enter their planets is that they simply give the planet to me freely that way. Late game I move from planet to planet witout facing a single units, even when they have easily 8+ planets left...

Somehow in vanila, the AI is not giving up a good fight late game, AI mostly seem to be stacking less units together (both offensively and defenisvely), and seems to be walking back and fourth more between their own planets, appearing to do nothing. I think I figured out partly why... Its partly because there are soooo many rebelions late game that they have to send their units back and fourth between their planets, instead of engaging me or protecting their outer planets from invasions. Therefore rebels are an issue in this game late game id say. Could I be right about my theory, and thats why they sort of just move back and fourth betweeen their planets late game?

It is possible that the Open Rebellion event coupled with Insurgency keeps AI fleets at bay, but I haven't really noticed anything of the sort during my AI test games. That said, the entire situation requires numerous triggers: you must be playing v1.80 instead of v1.82BETA for Open Rebellion to keep triggering, you must have at least one TEC player who is waaay ahead in civilian tech compared to everyone else to have Insurgency unlocked early, and you must have the AI on a preset that slows down their building of tactical structures and starbases (ie. everything except Fortifier). AIs will also consider tactical structures when calculating whether they should retreat or not, so the fact that they're retreating from their core planets means you've either got 16 capital ships in that fleet (the AI overvalues capital ships and undervalues titans when it comes to fleet strength calculations) and/or the unmodded AI is just that stupid when it comes to fleet composition.

Quoting WarNeck, reply 61
Ah I see. Then I will use Fortifier on Vasaris and Aggresive on the rest of the races, with and without ur mod both What would be the best preset of thsoe two for late game would you say? Both with and without your mod?

Fortifier might work on TEC Loyalists due to double starbases, but I'd still wager Aggressor is the best for both TEC factions. If you're playing on a large map, Aggressor is definitely the way to go for Advent. With my mod, use Fortifier instead of Aggressor since they both tend to build large armies, but Fortifier will have upgraded starbases and filled tactical slots as well.

Quoting WarNeck, reply 61
PS: If two races are allied against me and stack double army at my gravity well vs my army. Would they consider their army as a one? Flee less likely then? I really want the AI to become a larger threat late game, but I really have no clue how to make them. Even with your mod I think they will fall behind and "bug out" betweeen their planets and split their armys to much. And as a last question. With your mod, will "Rebel Loyalist" finally build 2 vasari starbases as standard? Or is that hardcoded and not possible to change?

Yes, with an ally present, the AI will include the ally fleet into strength calculations, both when fighting against you and your ally and when fighting with their own ally. As for double starbases, only TEC Loyalists are allowed to have two starbases at a gravity well, so if you're asking whether they'll start building two starbases per gravity well, then yes, I've definitely noticed the modded TEC Loyalist AI will build two starbases at certain gravity wells late into the game (having them on Fortifier also helps). There's little I can do to help Vasari AIs use starbases offensively however, so you'll still only ever see those built in empty gravity wells.

 
Reply #63 Top

Quoting Delnar_Ersike, reply 62

you must be playing v1.80 instead of v1.82BETA for Open Rebellion to keep triggering
 

That's kind of a shame - I quite like how the Open Rebellion planets sometimes end up with an absolutely massive fleet (i.e. 2 or 3 capital ships, plus a whole load of attendant frigates and cruisers)

Reply #64 Top

Thanks for modding effort. It does seem that the AI is slightly better with this on. As for the normal vs. quick start, I actually like the way normal-start AI is bugged to poorly prioritize homeworld upgrades because this creates intermediate AI levels between the official ones. Since the income differential with the Hard+ AI is usually highest in the beginning before you can out-expand the AIs, it helps to have the higher-level ones gimped a little that way (it's on the order of 20% income in beginning). What's less cool is that the AI in general loses lots of money to planet underdevelopment, especially on newly colonized worlds, although on the higher difficulties this doesn't matter. I'm not sure if the latter can be fixed by simply changing some weights...

Another thing I've noticed but didn't like with your mod is that the fortifier AI seems a little more inclined to star-base rush without as much as building a single defense turret or protecting his constructor in any other way. I've killed several starbase constructors with just 5 LFs at an enemy world and it never reacted in any way except by sending another one; this was vs. a Hard AI in 1.82 BETA.

 

Reply #65 Top

Quoting RespawnedTitanL10, reply 64

Thanks for modding effort. It does seem that the AI is slightly better with this on. As for the normal vs. quick start, I actually like the way normal-start AI is bugged to poorly prioritize homeworld upgrades because this creates intermediate AI levels between the official ones. Since the income differential with the Hard+ AI is usually highest in the beginning before you can out-expand the AIs, it helps to have the higher-level ones gimped a little that way (it's on the order of 20% income in beginning). What's less cool is that the AI in general loses lots of money to planet underdevelopment, especially on newly colonized worlds, although on the higher difficulties this doesn't matter. I'm not sure if the latter can be fixed by simply changing some weights... 

Remember, those values aren't weights, they're check frequency values: increasing the one that corresponds with population upgrades doesn't make the AI want to buy the population upgrades more, it makes the AI check to see if it wants to buy any population upgrades on any planets more often.

Quoting RespawnedTitanL10, reply 64
Another thing I've noticed but didn't like with your mod is that the fortifier AI seems a little more inclined to star-base rush without as much as building a single defense turret or protecting his constructor in any other way. I've killed several starbase constructors with just 5 LFs at an enemy world and it never reacted in any way except by sending another one; this was vs. a Hard AI in 1.82 BETA.

Since both the BuildShips and UpgradeStarbase values were increased at least tenfold, it's likely the AI gets stuck in a "build a starbase" loop a lot easier. Thing is, BuildTactical was also increased tenfold, so I don't see why the AI wouldn't build any tactical modules. The AI has been doing this type of stuff from the very beginning, BTW: even before I got into modding, I would often notice the AI building colony ships or starbase constructors and trying to sneak them past my giant invasion fleets. Although I haven't really noticed this behavior during my AI test games, it's likely that increasing the check frequency values amplifies this problem.

 
Reply #66 Top

Quoting Delnar_Ersike, reply 65


Since both the BuildShips and UpgradeStarbase values were increased at least tenfold, it's likely the AI gets stuck in a "build a starbase" loop a lot easier. Thing is, BuildTactical was also increased tenfold, so I don't see why the AI wouldn't build any tactical modules. The AI has been doing this type of stuff from the very beginning, BTW: even before I got into modding, I would often notice the AI building colony ships or starbase constructors and trying to sneak them past my giant invasion fleets. Although I haven't really noticed this behavior during my AI test games, it's likely that increasing the check frequency values amplifies this problem.

 

Frankly the only AI that is still a mild challenge for me is the Aggressive one (with this mod I mean, otherwise none are, LOL). That's the only one that builds SB only after it has enough fleet and sometimes defense structures at the system in question (2-3 turrets and/or a hangar). It still doesn't seem ever want to build repair platforms though, but it seems there's no special knob to tweak for that.

Reply #67 Top

Quoting RespawnedTitanL10, reply 66
Frankly the only AI that is still a mild challenge for me is the Aggressive one (with this mod I mean, otherwise none are, LOL). That's the only one that builds SB only after it has enough fleet and sometimes defense structures at the system in question (2-3 turrets and/or a hangar). It still doesn't seem ever want to build repair platforms though, but it seems there's no special knob to tweak for that.

It's odd that Fortifier doesn't build as many starbases for you as Aggressor, usually they will allocate a lot more resources to starbases. They're also the only ones who really upgrade starbases in earnest, and unupgraded starbases are just too easy to take down in my experience (Aggressor's starbases tend to be unupgraded, even late into the game when they should have plenty of resources). If you're playing on Cruel or harder, that might explain why you find Aggressor to be the only challenge, since the giant income advantage of higher difficulty levels eliminates the importance of economy management, the very thing Aggressor sucks at.

An easy way to make the AI build more repair platforms is to swap out their roleType for a different one: for example, if you change the repair platform's roleType to WEAPONDEFENSE (I think that's what it is), the AI will mix them in with its turrets. As outlined in the Planet Modules and Ships part of Section 3, the only thing the AI sees when it wants to build stuff (for both ships and structures) is their roleType value(s), so if a repair platform entity has the roleType that is normally associated with turrets, the AI won't know the difference and build repair platforms intermittently with their turrets. The same logic is applied to ships: if the AI wants to build an LF, and there are multiple ships available with the Light frigateRoleType vale, the AI will consider all of them and will likely build some of each in the long run.

Do note that while ships can have multiple roleTypes, and indeed the AI will consider all ships that have the roleType it is looking for when building ships, structures and capital ships can only have one roleType, hence why I didn't really want to mess around with the roleTypes of tactical structures. If you always play on difficulty settings where income isn't an issue for the AI, be my guest and perform the edit yourself, but the lower you take the difficulty setting, the more vulnerable the AI might get by building repair platforms when it actually wants to defend itself with turrets or hangars. To perform the edit, just copy over the 3 entity files for repair platforms of all three races (they are called PLANETMODULE_***ORBITALREPAIRPLATFORM, where the stars are PHASE, PSI, and TECH for Vasari, Advent, and TEC respectively)  to the mod's GameInfo folder, open them up via a text editor (eg. Notepad), and alter their planetModuleRoleType values to WEAPONDEFENSE. Note that if you're using the .entity files from the game files, you'll need to convert them to text format before you can edit them (there are quite a few tutorials floating around on how to do this), or you could just download pre-converted reference files and use those. You can also do some interesting stuff if you're a bit bored, like making culture centers the same roleType as civilian labs or giving superweapons the WEAPONDEFENSE roleType (since they're no longer the CANNON roleType, this also removes their building limits in addition to the obvious effect of making the AI spam them).

Also note that the AI's ability to handle ships and place structures will not improve simply by changing roleTypes. Even if you have the AI build a metric ton of Repair Platforms by altering their roleType to WEAPONDEFENSE, the AI still won't realize it should build repair platforms near its starbases, nor will it send damaged ships back to a repair platform for repairs. It also won't build repair platforms when it is programmed to want to: since the repair platform now has the turret's roleType, there aren't any structures with the repair platform's roleType, so the AI won't build anything when it wants to build a repair platform. You could get around the second problem though by having two identical repair platforms that only differ in their roleType, and placing the extra one in a UI spot that is unavailable to humans but still available to AI's...

 
Reply #68 Top

Quoting Delnar_Ersike, reply 67
It's odd that Fortifier doesn't build as many starbases for you as Aggressor, usually they will allocate a lot more resources to starbases. 

You misunderstood me. Fortifier does indeed spam SB constructors with abandon. But it has (almost) nothing to defend them with, so they die in droves with no chance of deploying. Fortifier might be ok in a 10-way FFA in the far back slots/positions relative to the human player but otherwise it's hopeless. (Your testing appears to have been mostly AI vs. AI, which is a different kettle of fish as the the AI players don't seem to try and kill SB constructors on purpose.) I lose my patience in a 10-way FFA with all Hard AI Fortifiers after I trivially nab both Terrans homeworlds of my closest neighbors, pretty much in parallel; only a slight stagger in these fights is needed, so I can mentally focus on one fight at a time while the other one is in the closing planet bombing stage. 2-4 Fortifiers on the far side in a 10-way FFA might be ok if my nearest neighbors were Aggressive (and the pair after them), but I'm still miffed as to how the starting positions get allocated relative to the player rooster order in the random-huge maps, so I haven't figured out how to set up that mixed AI config for the random maps.

Quoting Delnar_Ersike, reply 67

An easy way to make the AI build more repair platforms is to swap out their roleType for a different one: for example, if you change the repair platform's roleType to WEAPONDEFENSE (I think that's what it is), the AI will mix them in with its turrets. As outlined in the Planet Modules and Ships part of Section 3, the only thing the AI sees when it wants to build stuff (for both ships and structures) is their roleType value(s), so if a repair platform entity has the roleType that is normally associated with turrets, the AI won't know the difference and build repair platforms intermittently with their turrets. The same logic is applied to ships: if the AI wants to build an LF, and there are multiple ships available with the Light frigateRoleType vale, the AI will consider all of them and will likely build some of each in the long run.

Good idea. I'm gonna try this. The Aggresive AI, which is the only one that builds defense structures sensibly IMO, generally builds 3-4 turrets per hangar. So, the fact that a repair platform usually takes 1/2 of the tac slots of a hangar but 2x the slots of a turret will hopefully also get a decent mixture of turrets and repair platforms, although a human player would usually build more of the latter, especially as TEC...

Quoting Delnar_Ersike, reply 67

Also note that the AI's ability to handle ships and place structures will not improve simply by changing roleTypes. Even if you have the AI build a metric ton of Repair Platforms by altering their roleType to WEAPONDEFENSE, the AI still won't realize it should build repair platforms near its starbases, nor will it send damaged ships back to a repair platform for repairs. It also won't build repair platforms when it is programmed to want to: since the repair platform now has the turret's roleType, there aren't any structures with the repair platform's roleType, so the AI won't build anything when it wants to build a repair platform. You could get around the second problem though by having two identical repair platforms that only differ in their roleType, and placing the extra one in a UI spot that is unavailable to humans but still available to AI's...

Actually, the Aggresive AI (can't tell much about the other ones because they don't build enough) puts its turrets in decent positions, either around the planet to defend against bombardment or around clusters of other structures presumably to protect them. (As a side note here, turrets around planets is ok vs siege frigates, but counter-productive vs. capital ships, because these can bomb the planet and shoot at turrets in parallel, and even maximize their bank potential by engaging turrets on two-three sides while doing so.) The AI does not appear to ever build turrets on random positions or to just cover phase lanes. Given that repair platforms have a much bigger range than turrets, their placement by the AI should turn out ok.

Finally, I know not to expect miracles with the AI trying to save ships during fights. The devs settled for econ cheats/bonuses for Hard+ AI as the solution to that a long time ago. But at least having some areas of AI's grav wells covered by repair platforms should make the SP game a bit more challenging...


Reply #69 Top

My apologies if this has already been discussed, but I've been having a lot of AI problems lately and have an issue and potentially helpful observation.

First the problem. I have a generic faction AI that loves to keep its capitalships guarding its homeworld for the entire first part of the game. This is extremely weird as I've heard of no one else having this problem. Eventually after the AI builds several capitalships it can get unstuck and will start its first cap orders, but by then it is usually at an extreme disadvantage already.

The second problem I had with this AI is that I noticed in the dev.exe it got stuck in a black market buy loop. Basically it was using all the credits it could get to buy metal from the black market, even when it had 60k metal and 30k crystal. Eventually around when it got 100k metal it stopped this behavior and actually started to play really well as it sold its metal reserves to buy tons of ships and research, in a real game it would long since be dead. The problem seems to have been corrected by adding a BlackMarketBuyAdjustment to an AI only research it gets at the beginning of the game that makes the by and sell price on the market equal. Even for the non-generic AIs I think this might be a useful way to boost performance, since the AI often has issues using the market correctly, and it would help a lot in situations where the AI is not able to get much of a particular resource.

Reply #70 Top

To add to Goa's post, putting in a HyperspaceBetweenSystemSpeedAdjustment modifier will encourage the AI to attack other star systems. With SoGE's heavily modified AI, there have been Easy AIs that have done this ~2 hours into a match. Further, giving the AI ExperienceConstantGainRate and ExperienceConstantGainLevelCap modifiers that make capital ships be insta-level 3 upon construction will get the AI to build capital ships en-mass, as it values levels. Another addition that gets the AI much more competent is giving it PlanetSlotsCivilianIncrease modifiers, in increments of 4, as this allows it to build more structures and increases efficiency per planet. This effect is particularly noticeable in the game expansion.

Reply #71 Top

Quick question: does this mod need to be updated in any way for the 1.82 release (1.82.5006) as opposed to the BETA (1.82.4976)?

 

Reply #72 Top

Reorganized some information in the primary post to make it more visible (eg. the AI's "tech roulette" is now fully detailed under the Research category instead of hidden away inside the bullet point for the priority parameter).

Quoting GoaFan77, reply 69
First the problem. I have a generic faction AI that loves to keep its capitalships guarding its homeworld for the entire first part of the game. This is extremely weird as I've heard of no one else having this problem. Eventually after the AI builds several capitalships it can get unstuck and will start its first cap orders, but by then it is usually at an extreme disadvantage already.

Strange. However, since I do not know precisely when the AI ticks over from the faction-specific one to the generic faction one, there's not much I can do to pinpoint possible causes. Does it still do the same thing if the capital ship's roleType is set to "COLONY" as opposed to "Invalid"?

Quoting GoaFan77, reply 69
The second problem I had with this AI is that I noticed in the dev.exe it got stuck in a black market buy loop. Basically it was using all the credits it could get to buy metal from the black market, even when it had 60k metal and 30k crystal. Eventually around when it got 100k metal it stopped this behavior and actually started to play really well as it sold its metal reserves to buy tons of ships and research, in a real game it would long since be dead. The problem seems to have been corrected by adding a BlackMarketBuyAdjustment to an AI only research it gets at the beginning of the game that makes the by and sell price on the market equal. Even for the non-generic AIs I think this might be a useful way to boost performance, since the AI often has issues using the market correctly, and it would help a lot in situations where the AI is not able to get much of a particular resource.

I haven't actually analyzed how the AI handles the black market. Thanks for pointing this out, I'll see what else I can find out on my own.

Quoting Lavo_2, reply 70
To add to Goa's post, putting in a HyperspaceBetweenSystemSpeedAdjustment modifier will encourage the AI to attack other star systems. With SoGE's heavily modified AI, there have been Easy AIs that have done this ~2 hours into a match. Further, giving the AI ExperienceConstantGainRate and ExperienceConstantGainLevelCap modifiers that make capital ships be insta-level 3 upon construction will get the AI to build capital ships en-mass, as it values levels. Another addition that gets the AI much more competent is giving it PlanetSlotsCivilianIncrease modifiers, in increments of 4, as this allows it to build more structures and increases efficiency per planet. This effect is particularly noticeable in the game expansion.

Yes, I think I discussed the hyperspace stuff before: instantaneous interstellar travel will give the AI more flexibility when handling ships, but it does not affect the AI's target designation. Once the first steps of an expansion are achieved, the AI will handle being in multiple solar systems much better, since its fleets spend less time waiting to arrive at their destination, unable to accept new orders. However, the AI will still be just as slow with its first steps as before, at least according to my observations. The main thing I still point to is wormholes: wormhole travel is instantaneous in vanilla Sins, yet the AI is still very hesitant to use them unless they are the shortest way of getting to a gravity well the AI has already designated as its attack/colonization target.

I really need to look into the AI's handling of capital ships, you guys say the darndest things about them, and the only things I really looked into were ability usage, capital ship composition, and combat strength evaluation (for aiRetreatThreshold).

Increasing logistical slots would make any player a lot more capable, not just AIs. On that note however, I'll double check to see if the AI tends to ignore logistical slot upgrades the way they ignore population upgrades. My bet is that they only queue up a logistical slot upgrade if they want to build something but are out of logistical slots, but this means they have to wait an extra few minutes every time (so they don't queue up the upgrade when they run out, they queue it up when they already want to build something but have run out).

Quoting RespawnedTitanL10, reply 71
Quick question: does this mod need to be updated in any way for the 1.82 release (1.82.5006) as opposed to the BETA (1.82.4976)?

Most likely yes; BETA compatibility was simply a case of performing the edits on a newer Gameplay.constants file, but since I'm guessing the 1.82 release will encompass a lot more changes, there are a lot more files I'll have to update as a result. If the .exe was updated, I'll also need to run a lot more test games to see if the AI was modified in any way (doubtful, but you can never be too sure). I just wasn't aware the release version came out, since Steam still said my version was BETA until I launched the main .exe.

EDIT: Nope, no update needed, though I'll still rename the files and remove the 1.80 version to avoid confusion. The only difference between the BETA and the release version are an updated Galaxy Forge, an updated Particle Forge, and different particles on Strip to the Core. The .exe's were still changed though, I'll either have to run a lot of test games to see if the AI was altered... or open them up in a hex editor first and see if enough bytes were altered compared to a 1.80 .exe to know if I should bother with test games (unless the older .exe's are available somehow, I'm probably going to need to borrow a "quasi-legal" version for this).

EDIT #2: Hex comparison between newer 1.82 exe and an older 1.80 exe shows quite a lot of differences, though most are sections that were replaced with something smaller, causing the remaining bytes to shift up a few addresses. I'll need to run more test games nevertheless.

 
Reply #73 Top

Updated the original post with my new observations. Some key aspects:

  • The AI always factors in the black market to its "can I afford this" calculations. As a result, a Researcher AI will spend fortunes buying crystals earlygame, since that is the only way it can afford the mounds of research it wants to do. Basically, instead of the AI asking itself "what can I do that I can afford?", it asks "how can I afford what I want to do?". It will even buy resources from the black market to complete resource missions. If the AI is caught in an infinite buying loop, it is likely because it wants to buy a combination of stuff all at once that is ridiculously expensive.
  • Credit spending is the only thing the AI keeps track of in terms of resource allocation. A tech that costs 10 credits and 100 crystal will be logged as "10" spent on research. Since an AI's preset will define ideal resource allocation distribution across the various categories (ships, research, starbase upgrades, etc.), and since Black Market spending has its own, separate category, ships, structures, and research that are heavy on the metal and/or crystal cost are more favored compared to those that have a higher credit cost, since it will have a smaller effect on the AI's resource allocation stats. Since credits spent on the black market decrease the spending % of all other categories, including the one on which the bought resources were used, this still holds true even if the AI is forced to buy their resources instead of using extractor income.
  • When building extractors on gravity wells with both metal and crystal asteroids, the AI will queue up a metal extractor first, then a crystal extractor, then another metal extractor, so on and so forth. A minor detail, but an important one nonetheless (extractor build order is not random). I do not think this applies to capturing neutral extractors (since autocast targeting is what controls AI behavior there).
  • The AI will always buy logistical and tactical slot upgrades if it wants to build something and has run out of slots. Since an upgrade completes in 45 seconds, the AI's plans are delayed 45 seconds every time this happens, since it has to wait for the upgrade to complete before building what it wants to build. To counteract this, every x intervals (don't actually know this one's source), it will check to see if logistical or tactical slots are filled, but these intervals seem few and far between, so the AI will more often than not only get slot upgrades when it already wants to build a structure. This could probably be alleviated by making tactical and logistical slot upgrades complete instantly or if they triggered a cooldown period of 45 seconds instead of requiring 45 seconds to build. I've yet to put this into the main post because I feel I need to do more research on the matter.
  • Starbase constructors count as ships for the AI's spending purposes, and abilities that cost resources are not recorded in the AI's spending log. Since the AI's spending log plays a crucial role in how the AI plays depending on its preset, building starbases will skew the spending log quite a bit: this might be why Aggressors will build a lot more starbases than they should (since constructors count as frigates while starbases don't count as anything at all) and leave them unupgraded (since starbase upgrades have their own, separate category), and why non-TEC AIs love to build mines (they are built via abilities that cost resources, so they aren't logged as any type of expenditure, whereas TEC mines are logged as spending on tactical structures).
  • planetModuleRoleType is very finicky: for example, if a module with the WEAPONDEFENSE roleType doesn't have any weapons, the game will crash when the AI (possible the player, too) wants to build one.
  • Found out how aiRetreatThreshold works: if the ratio for total TkA (time to kill allied) to total TkD (time to kill enemy) in a gravity well is below aiRetreatThreshold, the AI orders a retreat. Note that this may or may not be the same TkA and TkD values that are displayed on the fleet comparison overlay (especially since fleet comparison compares the a current fleet with an enemy fleet, so it never includes allied tactical structures or starbases), but it is highly likely that they are calculated in a similar fashion. Due to known observations of odd AI retreat behavior, it is highly likely that both TkA and TkD are calculated incorrectly (abilities not considered, hit chance and miss chance not considered, regeneration not considered, squadron DPS overestimated due to flight-and-turnaround time not being considered, AntiModule's limitation of only attacking modules not considered, weapons on separate banks not taken into account, damage distribution over higher or lower HP ships not considered, etc.). The jump-in, jump-out behavior that is so common with AIs is due to fleets caught in an infinite loop of: move to target planet that requires a jump to a gravity well containing overwhelming enemy forces, retreat from overwhelming enemy forces, move to same target planet again using the same dangerous path, retreat again, rinse and repeat.
 
+1 Loading…
Reply #74 Top

Quoting Delnar_Ersike, reply 73
Since an upgrade completes in 45 seconds [...]

Only the first one; add 15 seconds per level for the subsequent ones, so 60, 75, etc. This is probably on all game speeds, by the way. Planet upgrade speeds seem to be unaffected by changing everything (including build & research speed) from normal to fast or faster.

Quoting Delnar_Ersike, reply 73
 if the ratio for total TkA (time to kill allied) to total TkD (time to kill enemy) in a gravity well is below aiRetreatThreshold, the AI orders a retreat [...] 

Given how horrible the AI is at using abilities on its capital ships (especially as Advent), I assume its estimates of TkA & TkD are terrible as well. You can see these estimates in the game by turning on "Show Fleet Comparison" in the dev exe (it's in the Player Info menu), but the AI needs to be turned on for these to show up, unlike almost everything else in that menu. And you also need to have a ship selected (doesn't matter which one in a given grav well; the estimate is per grav well, it seems.) The also don't show up until the fleets are actually in shooting at each other, it seems. The output makes for some interesting reading, especially as you watch it change. It seem the hp estimation is based on a simple hull+shield+shield_mitigation formula, as it goes up as mitigation goes up. But it doesn't seem to take into account any heal abilities. For example, a level 7 Corsev is estimated to have a hp of around 10K (probably with hull+shield+shield_mitigation), whereas a same level Progenitor is estimated to have about 9K as the fight starts, but as it comes under fire it goes up to 20K. At no point do the active self-heal ability on the Prog or the passive one on the Corsev seem to enter these estimates. And those two factors change the odds dramatically. Also, it does not look like it takes into account any offensive abilities either. At the beginning of a 40 Cobalts vs. 50 Disciples accompanying the aforementioned capitals, the estimated time/odds for the destruction of the "Mediums" (LFs) are also equal, but after the Corsev fires a boarding+demo team combo (I was impressed that the AI pulled that off correctly!), which blows up half the Advent fleet (with a maxed out demo team), the estimatd odds become 2:1. (More on that fight in the Corsev modding thread. https://forums.sinsofasolarempire.com/453667/page/1/#3471365) This probably elucidates why the AI is so easily pwnd by ability-based AoEs like the (lvl 6) Mazra or the Corsev... It just doesn't factor these in its estimates.


Reply #75 Top

Quoting RespawnedTitanL10, reply 74
Given how horrible the AI is at using abilities on its capital ships (especially as Advent), I assume its estimates of TkA & TkD are terrible as well.

Correct, the calculation is missing a bunch of factors, some of which you and/or I have named.

Quoting RespawnedTitanL10, reply 74
You can see these estimates in the game by turning on "Show Fleet Comparison" in the dev exe (it's in the Player Info menu), but the AI needs to be turned on for these to show up, unlike almost everything else in that menu. And you also need to have a ship selected (doesn't matter which one in a given grav well; the estimate is per grav well, it seems.) The also don't show up until the fleets are actually in shooting at each other, it seems.

That's why I said that the two aren't the same: fleet comparison actually compares strengths of fleets, as in the groups the AI automatically makes. This is why you only get the reading if the ship you have selected is targeting an enemy fleet. Since the AI will order a full retreat to all ships in a gravity well, even if they contain multiple fleets, I doubt the fleet comparison overlay displays the only information the AI uses, but I suspect the strength calculations are the same regardless.

Quoting RespawnedTitanL10, reply 74
The output makes for some interesting reading, especially as you watch it change. It seem the hp estimation is based on a simple hull+shield+shield_mitigation formula, as it goes up as mitigation goes up. But it doesn't seem to take into account any heal abilities. For example, a level 7 Corsev is estimated to have a hp of around 10K (probably with hull+shield+shield_mitigation), whereas a same level Progenitor is estimated to have about 9K as the fight starts, but as it comes under fire it goes up to 20K. At no point do the active self-heal ability on the Prog or the passive one on the Corsev seem to enter these estimates. And those two factors change the odds dramatically. Also, it does not look like it takes into account any offensive abilities either. At the beginning of a 40 Cobalts vs. 50 Disciples accompanying the aforementioned capitals, the estimated time/odds for the destruction of the "Mediums" (LFs) are also equal, but after the Corsev fires a boarding+demo team combo (I was impressed that the AI pulled that off correctly!), which blows up half the Advent fleet (with a maxed out demo team), the estimatd odds become 2:1. (More on that fight in the Corsev modding thread. https://forums.sinsofasolarempire.com/453667/page/1/#3471365) This probably elucidates why the AI is so easily pwnd by ability-based AoEs like the (lvl 6) Mazra or the Corsev... It just doesn't factor these in its estimates.

Damage done is based purely on overall DPS (so if a ship has weapons on all four banks, the AI treats them as if they were all on one bank), while health is based on the factors you outlined above, plus armor. As mentioned before, abilities are not taken into account, possibly because they would be quite difficult to track, especially AoE ones (for single target ones, the game could technically cache their DPS at each level, then add it on to the ship's regular DPS while it has enough antimatter for casting). However, there is no excuse for disregarding miss chance, passive hull regeneration, and passive shield regeneration, since those can simply be multiplied or added onto the calculation. The Corsev's combo only fired because demo team's autocasting conditions require the target to have the Boarded debuff. It's honestly unsurprising that the AI doesn't consider shield mitigation over time, only current shield mitigation; having it calculate shield mitigation over time would require the AI designers/programmers to know calculus, which would be too much to ask for... Something like this (might have gotten the signs mixed up, it's only a rough equation, mitigation is the percent as a decimal):

If the equation's right, effective shields should be (max shields)*(1 - ln(1 - (max mitigation))).

I've done a bit more testing, and I can safely confirm that ships, structures, and techs that cost more metal/crystal and less credits are more favored by the AI in the long run. This is due to the interplay of only keeping track of credits spent and each preset's hardcoded behavior for spending allocation. In my test cases, I moved a single ship's credits cost (usually a corvette, since that way I could test between Rebel and Loyalist factions of the same race instead of between races) over to metal/crystal cost at a 2/9 its original value (ie. 450 credits = 100 metal/crystal), then made sure both the test AIs and the control AIs were running the same preset. On average, the test AIs built anywhere between 0.85x to 2.1x the number the control AIs built, depending on individual cases, individual presets, and the ship in question.