Strategic AI Mod

A place for discussion of making game modifications.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Thu Apr 19, 2018 3:26 am

In the meantime, as a band-aid fix I've made it so that if the AI has enough scouts to meet its scouting desires, it won't build any design that has long distance scanners. Not ideal, but at least you won't have scout spam for the time being.

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Thu Apr 19, 2018 4:45 am

Hopefully this explains what I think the cause of the scout spam is a little better.

Whenever I see the AI building scouts even though it doesn't have any more need for them, I usually find this in the console.

Image

1. Orange Rectangle - The AI has more scouts than it desires, so the AI's assessment of it's scouting needs seems to be working as intended and not the source of the issue
2. Green Rectangle - Probably the most relevant output here is the AI's estimated build time and projected metal income for if it chooses the design.
3. Red Rectangle - The AI estimates the build time and projected metal income for a destroyer, and sees that it would run out of metal before the destroyer completes, and ignores this design even though it's combat value is way better than the scout
4. Yellow Rectangle - The AI ends up choosing a scout, because it's metal reserve happens to be such that it thinks it can build the scout but not the destroyer.

An important thing to note is that building the scout still drains the AI's metal. So until it gets another mine or two online, it's stuck in a loop. Once this scout is done, it's metal will start accumulating until it reaches ~45, then it will start building another scout.

If it builds 2-3 scouts this way, and this happens 4-5 times over the course of the game, the AI can end up with as many as 15 scouts. I have a feeling that once it does get more mines, all it takes is for the AI to decide to build an expensive ship that drains its metal reserve back to ~0, and then it will be stuck building scouts again until it gets more mines.

zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Strategic AI Mod

Postby zolobolo » Thu Apr 19, 2018 9:35 am

Ran a full test game with all races in autopilot but didn't encounter any errors related to the mods (tactical and strategic AI + shield regen + damage dispersion mod)

Findings:
1. Mid-game wasteland was not noticeable at all - all the AIs had a healthy level of fleet force at all times
2. Ship variety is very good: AI usually has a mixture of potent ships
3. Scouts are sometimes produced without noticeable reason by a specific empire (Orthin this time around)
4. Load times increased noticeably from in late game (<400 Turns) from around 10-15s to 45s even if no battles occur (probably due to the amount of ships having to be moved around by the AI at this point while previously the AIs had much lass- only large ships - at this point)
5. AI is adept at preventing starvation but does not seem to leave room for sudden drops in food production. It seems to be prone for going into food deficit at the end of a turn as it always balances around 1-3 Food Surplus
6. AI is now extremely dangerous if left unchecked (even on normal difficulty) as it ramps up its forces constantly and gradually with > 100-300 ships at turn 500)
7. Its inefficiency in war efforts seem to now come from their sometimes poor selection of targets and systems to defend
8. Super dreds were not produced by the two AIs left in the end of this game for some reason even though the tech has been researched by both

CapnDarwin
Posts: 14
Joined: Wed Apr 04, 2018 5:29 pm

Re: Strategic AI Mod

Postby CapnDarwin » Thu Apr 19, 2018 11:30 am

Sounds like there needs to be a way to tell the AI not to build any ship when 1) there are enough scouts and 2) a warship will cause <0 metal. Might also be interesting if the AI could phone a friend and buy metal if it has cash reserves. Then build the warship. I do see mid-game and beyond, AIs with huge cash totals and very low metal. Increasing the want to trade to build up metal or cash to a decent balance would help the AI in both building and maybe refits.

Just a few thoughts.

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Thu Apr 19, 2018 5:53 pm

CapnDarwin wrote:Sounds like there needs to be a way to tell the AI not to build any ship

Essentially, you're right. The preemtion occurs because once the AI decides it wants a ship, it has to build a ship if there are any designs it can afford. And when recovering from low metal the first design to become affordable is always the scout.

So I think the solution is to have an escape option for the AI: wait until we accumulate a bit more metal. Luckily there's a natural way to incorporate this. Since I already factor in the estimated build time, I can just add the anticipated waiting time to the estimate.

Since scouts often have less than half the combat value of even destroyers, this should make scouts unappealing except in the case of extreme metal shortage.

CapnDarwin
Posts: 14
Joined: Wed Apr 04, 2018 5:29 pm

Re: Strategic AI Mod

Postby CapnDarwin » Thu Apr 19, 2018 6:16 pm

I would also consider if the AI is at War. If so with low metal, don't build anything until a warship can be done. If at war, make the scouts value clown shoes high, so the AI ignores it for sure until at peace.

zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Strategic AI Mod

Postby zolobolo » Thu Apr 19, 2018 6:33 pm

harpy eagle wrote:
CapnDarwin wrote:Sounds like there needs to be a way to tell the AI not to build any ship

Essentially, you're right. The preemtion occurs because once the AI decides it wants a ship, it has to build a ship if there are any designs it can afford. And when recovering from low metal the first design to become affordable is always the scout.

Wouldn't it makes sense to default in this case to building Transports?
Transports fill multiple roles (generate income, transport food, troops etc) so there is no harm in having more then the effective trade capacity, and are always available from the beginning

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Thu Apr 19, 2018 8:57 pm

zolobolo wrote:Wouldn't it makes sense to default in this case to building Transports?
Transports fill multiple roles (generate income, transport food, troops etc) so there is no harm in having more then the effective trade capacity, and are always available from the beginning


Well, in the vanilla AI (and in this mod) there are a number of competing "dispatch" functions that get executed in order according to dynamic priority (i.e. the priority is recalculated each turn). When called, each function selects a planet and selects a production order for that planet. The list of dispatch functions includes:

  • build_ground_units
  • colonize - i.e. build colony ships
  • outpost - for outpost transports
  • ships - for warships, scouts, and troop transports
  • defenses - in vanilla this only built planetary and starbase defenses, with the mod it any warship or starbase
  • tradeships - for civilian transports
  • research - sets a suitable planet to research focus
  • mining - added by the mod, sets a suitable planet to mining focus

So while that's not a bad fallback case, since transports are already include in the list of production order dispatches, I'd rather just tell the AI to "do something else with this planet" and let it decide if that something else means "build transports".

EDIT: I've implemented a proper fix to the scout spam, and updated the OP (a7ec0ed). Also some significant cleanup of the ship selection code.

Scout spam seems to be significantly reduced now.

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Thu Apr 19, 2018 9:59 pm

I just watched a really interesting war between AI Orthin and AI Ashdar Colonials. The Orthin got early deflector screens while the colonials researched coilguns, and had an early advantage. Eventually though the Orthin began equipping their ships with ion cannons and started turning the tide. Once they started ramping up production of heavy cruisers it was pretty much over for the Colonials.

While it was pure luck, I guess it also helped that the Orthin decided to build a few escort cruisers, which really helped against the Colonial's carriers.

CapnDarwin
Posts: 14
Joined: Wed Apr 04, 2018 5:29 pm

Re: Strategic AI Mod

Postby CapnDarwin » Fri Apr 20, 2018 1:18 am

The file is missing on page 1 for today's update.

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Fri Apr 20, 2018 1:58 am

Whoops! It should be attached now.

Also included: when determining it's desired metal-to-production ratio (used to determine whether it can sustain it's industrial production with it's current metal income), the AI now factors in the ship cost discounts provided by shipyards (as well as any discounts it gets from the difficulty setting).

zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Strategic AI Mod

Postby zolobolo » Fri Apr 20, 2018 6:39 pm

Attachments
Empire AI Order.png
Empire AI Order.png (98.63 KiB) Viewed 20088 times

zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Strategic AI Mod

Postby zolobolo » Fri Apr 20, 2018 7:00 pm

In he below game, the Orthin seem to be focusing too much on producing Exploration vessels on a planet which has not been developed yet but has tons of improvement slot
https://www.dropbox.com/s/fbcglyngz7gcy ... g.rar?dl=0

I think in their case the planetary building aspect should take priority but even if the AI decides it needs combat ships, producing a Destroyer would make more sense at it requires less Metal per turn and would actually net a surplus each turn whereas now they are making losses on metal - so this might be a case then, where the AI thinks it needs more exploration type vessel...

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Sat Apr 21, 2018 6:46 pm

zolobolo wrote:Empire AI Order error found

That's curious. I'm away from home but when I get back in a few days I'll be able to look at it.

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Strategic AI Mod

Postby harpy eagle » Sun Apr 22, 2018 2:12 am

zolobolo wrote:In he below game, the Orthin seem to be focusing too much on producing Exploration vessels

Hmm, this exploration ship spam issue certainly is being a bit of a thorn.

zolobolo wrote:so this might be a case then, where the AI thinks it needs more exploration type vessel...

It might be, I'll need to get to a computer with SiS installed and load up your save to really know. If so I suppose then that it's WAI - I guess, although the scout need function could be tweaked.

zolobolo wrote:on a planet which has not been developed yet but has tons of improvement slot

Yeah, right now the condition for that happening is kind of crude. I should probably change it from a Boolean expression to something involving a 0-1 score, and then factor in how much potential industrial output we are missing out on by building a ship instead of development.


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 3 guests