Strategic AI Mod

A place for discussion of making game modifications.
zolobolo
Posts: 916
Joined: Fri Nov 25, 2016 3:49 pm

Re: Strategic AI Mod

Postby zolobolo » Tue Apr 24, 2018 3:30 pm

harpy eagle wrote:But they do provide a discount to ship production costs, right?

That is correct: they halve the wrench cost of all ships but leave metal cost intact. Effect does not stack so it only makes sense to build one per planet
Hence they are both crazy usefull for production heavy worlds (to justify the intial investment in metal) and dangerious to metal income as ships built there will consume double the amount of metal per turn as before

Hence it would make sense to build them if:
1. Planet is among top 20% highest production worlds (if it has 5 planets it should build one for the planet with the highest priduction capacity - more would not be feasable to operate metal wise)
2. Metal reserves ensure succesfull building of the Shipyard(s) (so that they dont cripple production during the time they are built)

harpy eagle wrote:Speaking of which, the AI is pretty bad at defending it's key planets sometimes. It will send it's fleets off to guard some unimportant planet even though there are hostile ships just a few turns away. I've seen the AI lose their homeworlds this way, despite having a fleet large enough to fend off any invasions - I should probably keep a save the next time.

Yes, there is a lot to be said regarding ship movement on the strategic map - tried to sum it up for you somewhere.

Was thinking that you initial approach to the tactical AI might be portable here but instead of assigning priority to potential targets based on damage potential/risk, it would be assigned to systems where an individual ship or fleet should move to based on system value. e.g.: enemy with highest metal income is primary target, but defending own top metal producing planets might outweight it if closer and under direct threat

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

Re: Strategic AI Mod

Postby harpy eagle » Tue Apr 24, 2018 3:46 pm

harpy eagle wrote:
zolobolo wrote:Improvement selection error

That's really weird. I'm not sure how that's possible. Gotta load up the save.

Every time I try to load the save the game crashes :(

I'm pretty sure it's because I've switched to the beta testing branch.

Image

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

Re: Strategic AI Mod

Postby harpy eagle » Tue Apr 24, 2018 4:51 pm

Okay, luckily I managed to reproduce it in another game. It's fixed now along with a bug related to memoization of relative empire strengths (c6b4c57).

I think I was a little premature to call one of the earlier versions 1.0, but I think I'm getting close to that now. With the dynamic dispatch fixed in vanilla I've been able to make a lot more progress in getting the AI to do things.

Also, this is technically sven's work, since he majorly revamped AI pop transfer, but I thought it was lovely:

Image

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

Re: Strategic AI Mod

Postby zolobolo » Tue Apr 24, 2018 5:07 pm

harpy eagle wrote:I'm pretty sure it's because I've switched to the beta testing branch.

You mean the one outside of Steam?

Have the latest version from the DEV branch from Steam

Anyhow: updated to your latest mod version and it has fixed the issue - thanks!
Attachments
Version.png
Version.png (96.79 KiB) Viewed 904 times

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

Re: Strategic AI Mod

Postby zolobolo » Tue Apr 24, 2018 5:09 pm

harpy eagle wrote:Also, this is technically sven's work, since he majorly revamped AI pop transfer, but I thought it was lovely:

Yes it is a beauty - besides the economic benefits, this will make police duty on newly captured worlds all the more interesting :)

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

Re: Strategic AI Mod

Postby harpy eagle » Tue Apr 24, 2018 6:33 pm

Some more bugfixes (4e97698).

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

Re: Strategic AI Mod

Postby harpy eagle » Tue Apr 24, 2018 10:16 pm

This update (78e6377) contains a critical fix to the strategic ship combat power calculation, that was causing the AI to act somewhat erratically compared to the intended behaviour.

Also fixed an issue where the AI would build defenses on undeveloped worlds while not at war.

With the mod's fleet AI issues fixed, as well as the vanilla issues that were causing the AI to not follow it's production desires, I think the strategic AI is really starting to shape up.

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

Re: Strategic AI Mod

Postby zolobolo » Thu Apr 26, 2018 1:57 pm

harpy eagle wrote:
  • 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


Does this mean that there is currently no logic to refit ships in orbit to the latest design, or is it be part of the ships production logic?
Maybe this could lead into issues where the AI would want to move a ship that is queued for refit...

The instant refit action would elevate some of the need for this function but of course costs more and haven't seen the AI do that yet

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

Re: Strategic AI Mod

Postby harpy eagle » Thu Apr 26, 2018 6:22 pm

I don't think the AI knows about ship refitting at all.

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

Re: Strategic AI Mod

Postby CapnDarwin » Thu Apr 26, 2018 7:59 pm

@Harpy Eagle, any chance you can also post the latest production release version of this mod in the first post with the inDev build?

Any idea on when the new version will be ready for release use?

Love your mods. Keep up the awesome work! I hope the Devs fold in your work into the games general updates in the future.

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

Re: Strategic AI Mod

Postby harpy eagle » Thu Apr 26, 2018 9:22 pm

CapnDarwin wrote:@Harpy Eagle, any chance you can also post the latest production release version of this mod in the first post with the inDev build?

Any idea on when the new version will be ready for release use?

Love your mods. Keep up the awesome work! I hope the Devs fold in your work into the games general updates in the future.

I've attached it to the OP. As for when indev version will be ready, that will be when r22220 will be out. So I'm not sure. You'd have to ask sven.

And thanks! It's a lot of fun, and I'm lucky the game is so readily moddable.

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

Re: Strategic AI Mod

Postby harpy eagle » Fri Apr 27, 2018 3:21 am

While this mod does a whole bunch of things that I believe go a long way to help the AI avoid metal shortages in the first place (avoiding excess building of horrendously expensive fleet bases, smarter ship build choices, use of mining focus, increased construction of mines when low on metal), I actually haven't implemented much to handle metal shortage itself when it does occur, aside from a few scattered checks to prevent the AI from setting ship production when it's low on metal.

I think those checks were a bad idea, since they tended to be embedded in places where it was hard to evaluate the importance of the ship the AI wanted to build versus other things it could cancel.

So instead I let the AI set production however it wants, and then check for a metal shortage afterwards. If there is one, the AI now goes through its planets and culls projects to reduce it's metal usage.

Since the AI tries to build more important projects on higher-production worlds, I start with low production worlds first. And I make sure not to cull all projects, so that something can proceed even if it's slowed down. It seems to work fairly well.

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

Re: Strategic AI Mod

Postby zolobolo » Sat Apr 28, 2018 10:40 am

Below save contains a case where Phidi AI is having trouble building up its fleet

They are currently producing ships on a single planet from the total 3 that they have and are running a considerable deficit in Metal by doing so

It is difficult to compare their buildup performance with that of their Yoral neighbor as those have 7 planets, but running on a deficit will certainly hold them back even further as opposed to saving up metal before returning to ship production
Attachments
Orthin Third.rar
(321.57 KiB) Downloaded 16 times

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

Re: Strategic AI Mod

Postby harpy eagle » Sat Apr 28, 2018 1:20 pm

zolobolo wrote:Below save contains a case where Phidi AI is having trouble building up its fleet

They are currently producing ships on a single planet from the total 3 that they have and are running a considerable deficit in Metal by doing so

It is difficult to compare their buildup performance with that of their Yoral neighbor as those have 7 planets, but running on a deficit will certainly hold them back even further as opposed to saving up metal before returning to ship production

I remember thinking at some point that it was better to avoid cancelling the last metal project, but maybe I was wrong.

User avatar
sven
Site Admin
Posts: 1390
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Strategic AI Mod

Postby sven » Sun Apr 29, 2018 9:48 pm

harpy eagle wrote:NOTE that the latest indev version requires r22220 or later.


As of r22256, I've folded version f35f5db of this mod into the vanilla "in_development" branch. However, harpy eagle (and anyone else interested in further playing with this code) should be aware that the latest vanilla code does deviate from the code in that git branch. Specifically:

  • The build variety ship valuation adjustment is replaced with a strategy card valuation adjustment. See navy_composition.lua:229.
  • research_desires.lua has been entirely retired in favor of strategy_cards.lua.
  • get_best_infrastructure() is defined inside init_navy_composition, tying it's lifetime to that of the temp AI State.
  • I've added a minor bugfix to the median calculation code in empire_naval_power().


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 2 guests