Strategic AI Mod
Re: Strategic AI Mod
In Vanilla, the AI has thus far been avoiding the construction on Marauders (Gremak specific ground unit), Assault Marines (Human specific ground unit) and Stargates (even AI playing Imperials does not build them)
Do you think the modded construction logic could trigger production of these units as well?
I know this wouldn't result in the AI properly utilizing them (that would probably concern the movement logic) but at least they could have a passive effect on their playstile
According to the production selection logic, I would suppose, that the AI does not have any "plan" for which these elements would be used that is why it is avoiding them completely (no raiding intent on a strategic level means no raiding unit is needed)
Do you think the modded construction logic could trigger production of these units as well?
I know this wouldn't result in the AI properly utilizing them (that would probably concern the movement logic) but at least they could have a passive effect on their playstile
According to the production selection logic, I would suppose, that the AI does not have any "plan" for which these elements would be used that is why it is avoiding them completely (no raiding intent on a strategic level means no raiding unit is needed)
Last edited by zolobolo on Sun Apr 22, 2018 6:36 pm, edited 1 time in total.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
That's something I'll think about. But yeah, the value of that might be diminished if the AI just treats them like regular ground units.zolobolo wrote:Do you think the modded construction logic could trigger production of these units as well
I know this would result in the AI properly utilizing them (that would probably concern the movement logic) but at least they could have a passive effect on their playstile
- sven
- Site Admin
- Posts: 1621
- Joined: Sat Jan 31, 2015 10:24 pm
- Location: British Columbia, Canada
- Contact:
Re: Strategic AI Mod
This is a fun feature, but, it can currently trigger bugs due to a bug in my code. Um, at the top of production.lua::deactivate_current_project(planet), there should probably be a call to reset_food_caches(). (This silly explicit cache maintenance is the source of so many bugs, I'm getting really tempted to redesign it somehow.)harpy eagle wrote: The AI now decides to city plan or manufacture population if doing so would produce more resources than building an improvement.
Re: Strategic AI Mod
Here is the save for the Gremak survivalist AI mentioned in the other Thread:
https://www.dropbox.com/s/fbcglyngz7gcy ... g.rar?dl=0
What is interesting here is that the AI has made very good decisions so far: conserving forces and building escort ships
At this point in time it has a good amount of resources and good income but has now decided to only build:
1. Transport (though pool is fully utilized)
2. Scout Cruiser (the classical )
In my opinion, in this scenario, planet: Naradh should construct a Shipyard (as enough metal deposits are in place) and then focus on constructing combat ships. The other planet should focus on refitting the existing ships to the latest design though this would involve movement orders as well so is outside of the scope of this mod
https://www.dropbox.com/s/fbcglyngz7gcy ... g.rar?dl=0
What is interesting here is that the AI has made very good decisions so far: conserving forces and building escort ships
At this point in time it has a good amount of resources and good income but has now decided to only build:
1. Transport (though pool is fully utilized)
2. Scout Cruiser (the classical )
In my opinion, in this scenario, planet: Naradh should construct a Shipyard (as enough metal deposits are in place) and then focus on constructing combat ships. The other planet should focus on refitting the existing ships to the latest design though this would involve movement orders as well so is outside of the scope of this mod
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
Thanks, I'll take a look at it tonight.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
Okay, so (1) is the vanilla AI. I haven't really changed how the AI decides to build transports, outpost transports, or colony ships (aside from a few tweaks, and only for colony ships).zolobolo wrote:At this point in time it has a good amount of resources and good income but has now decided to only build:
1. Transport (though pool is fully utilized)
2. Scout Cruiser (the classical )
As for (2), what was happening was that the AI decided it wanted 5 scouts, but only had 3.
It looks like the second most desired ship was heavy cruisers, so it probably will return to building those once the scouts are done. While nothing here seems particularly amiss, I've gone and tweaked the scout desire anyways.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
Update (13edc0a): The AI will now move population between worlds if doing so would increase the population cap of the destination world and doing so would leave at least 1 pop of that species left on the source world.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
Hmm, yes I see. The AI thought it was starving when really it just needed to stop city planning, and ended up with a huge surplus of food from extra unneeded farms several turns later.sven wrote:This is a fun feature, but, it can currently trigger bugs due to a bug in my code. Um, at the top of production.lua::deactivate_current_project(planet), there should probably be a call to reset_food_caches(). (This silly explicit cache maintenance is the source of so many bugs, I'm getting really tempted to redesign it somehow.)harpy eagle wrote: The AI now decides to city plan or manufacture population if doing so would produce more resources than building an improvement.
Also, I've been trying out your dynamic dispatch fix and it seems to improve things quite a bit. Now when I hack the AI's ship desire to absurdly high levels, it does indeed try to build ships on every single world. I probably now need to be careful that the AI doesn't go overboard on ships, but it's a step in the right direction
- sven
- Site Admin
- Posts: 1621
- Joined: Sat Jan 31, 2015 10:24 pm
- Location: British Columbia, Canada
- Contact:
Re: Strategic AI Mod
I'm a big fan of this change. The population transport feature in r22231 (now on 'in_development') is a descendant of this code. (The list of code diffs relative to your version is rather long, but, basically, the big difference is that I'm trying to teach the AI to respond sensibly to overcrowding, in addition to optimizing for species diversity.) Sorry about the lack of comments. I may add those in in r22232harpy eagle wrote:Update (13edc0a): The AI will now move population between worlds if doing so would increase the population cap of the destination world and doing so would leave at least 1 pop of that species left on the source world.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
Update (097f859):
- Reworked planetary improvement selection to encourage the AI to build more factories. The AI no longer cares about the build time of improvements, I don't think it was helping. The AI no longer cares about max sustainable hammer production - if it has more production capacity than it can supply with minerals, it just tries extra hard to get more mines.
- When determining it's desired mineral income, the AI only looks at planets that have at least one factory.
- Overhauled ship construction desire, to accommodate some important bugfixes in vanilla. I've tried to strike a balance between building up naval power while also allowing for construction of colony ships/outposts/etc.
- If the AI doesn't have enough transports to meet it's food import needs, it assigns a higher priority to civilian transport production.
- The AI will no longer attempt to build ground units on planets that are not fully developed when revolt chance is 0.
- Removed pop transfer code in favour of the vanilla version.
Re: Strategic AI Mod
Does this mean that you can trigger population related events as well?harpy eagle wrote:Update (13edc0a): The AI will now move population between worlds if doing so would increase the population cap of the destination world and doing so would leave at least 1 pop of that species left on the source world.
Is it possible to have the AI issue a command to enslave/free and harmonize/deharmonize pops?
Something along the lines of:
WHEN Slave collar/Harmonization tech present (though I am not sure there is a tech for Tinkers - would be sensible though as then it could be reverse engineering like slave collars)
THEN IF moral<15 AND rebellion chance >0 THEN enslave/harmonize ELSE free/deharmonize
Or an even more simplified approach would be to activate enslavement and harmonization every time when available and never revert it. This is not that effective but might be much more simple and fun for the player to encounter
Enslavement could also affect Gremak build order as Marauder units become useful to have especially with the simplified logic
It would also have an effect to pop transport as unruly elements should not be placed on planets where they start a rebellion right off the bat and planets colonized by slaves would need a transport of suppressing pops/troops right away to keep the new estate
Re: Strategic AI Mod
- Attachments
-
- Prefered Improvement.png (88.15 KiB) Viewed 19711 times
Re: Strategic AI Mod
Seems to have worked: the Gremak AI now has 3 Scout Cruisers and started producing a Heavy Cruiser and 2 Destroyers at once without exceeding its metal incomeharpy eagle wrote: As for (2), what was happening was that the AI decided it wanted 5 scouts, but only had 3.
It looks like the second most desired ship was heavy cruisers, so it probably will return to building those once the scouts are done. While nothing here seems particularly amiss, I've gone and tweaked the scout desire anyways.
It is also distributing pop units - this should give the AI economy quite a boost everywhere on the mid-long term
Do you know what the condition for producing Shipyards is? Might benefit from a bump up in weight for the top production worlds if metal reserves allows it (which is true in this case)
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
The AI only ever builds shipyards as part of building a ship that requires them.zolobolo wrote: Seems to have worked: the Gremak AI now has 3 Scout Cruisers and started producing a Heavy Cruiser and 2 Destroyers at once without exceeding its metal income
It is also distributing pop units - this should give the AI economy quite a boost everywhere on the mid-long term
Do you know what the condition for producing Shipyards is? Might benefit from a bump up in weight for the top production worlds if metal reserves allows it (which is true in this case)
But they do provide a discount to ship production costs, right? So it may be worth considering building them on their own. Though I'd need to figure out exactly when it makes sense to do so. For example, the AI probably shouldn't build them on worlds that are under threat of attack.
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.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Strategic AI Mod
That's really weird. I'm not sure how that's possible. Gotta load up the save.zolobolo wrote:Improvement selection error
Last edited by harpy eagle on Tue Apr 24, 2018 3:32 pm, edited 1 time in total.