AI Modding

Moderators: Pandora Moderators, Slitherine Core

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

AI Modding

Post by Xilmi » Sat Jul 05, 2014 12:17 am

Am I right to suppose that these:
<score strategy="Build" add="0.5"/>
<score strategy="ImproveMinerals" add="0.5"/>
and these:
<score strategy="Explore" add="0.33"/>
<score strategy="Fight" add="0.33"/>
<score strategy="Operations" add="0.33"/>

within the files under /World/Buildings
are supposed to guide the AI what to build?

It is noticeable, that the sum of the parts is always 1. Would increasing/decreasing these change the behaviour?

Let's say I'd like to force the AI to always build the research-Building once it is available, would setting a score like:
<score strategy="Build" add="2.0"/>
do the trick?

I kinda miss similar score-things in the Technology-files. How does AI determine the usefullness of technologies? In a test-game the AI's tech-order seemed to be mostly randomized.

Is it possible to add them like this:

<technology category="Physics" tier="0" subTier="2">
<modifiers>
<modifier>
<effects>
<score strategy="Fight" add="1.0"/>
</effects>
</modifier>
</modifiers>
</technology>

?

Edit: Value-Sum for Bunkers indeed is higher than 1.0! And since I've seen the AI kinda rush for them, that makes me confident that I can change build-order by playing around with these values.

Edit 2: Units all have a sum of 1.0, so I suppose that buildings > 1.0 really should be prioritized.
Also, might it be, by chance, that these values also automatically work for techs. Because I've seen that the Sea-transport-Advancement came with 2.0 from the get go and that's a tech the AI never seems to skip.

Waitaminute!
The Armors, Units, Weapons also all have their "score strategy"... and all armors have the same value there... Now would using increasing values here probably force the AI to use better Units and not just random ones?

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Sat Jul 05, 2014 3:11 am

While it cost me my night, the troops the AI builds as well as it's economic backbone now look a little different than before...

Can't post link to screenshot...

"Your post looks too spamy for a new user, please remove off-site URLs."

Dudes, seriously... I'm not spamming. I just dramatically improved your game! -_-

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Sat Jul 05, 2014 3:57 am

Anyways, here's my first attempt.

Edit:
It actually is the second attempt now. See post at the bottom of this thread for deatails.

Unzip into the following folder:

C:\Users\<AIL>\AppData\Roaming\Proxy Studios\Pandora

But replace <AIL> with your own Computer's name.

Contents:

AI is much more likely to build important buildings and advancements.
AI is much more likely to build state-of-the-art-units instead of cheap-crap-tier-1-units.
Fixed that the AI would never build certain Advancements like "Aspioch" (+25% Power for Heavy) and "Leviathan" (+25% Power for Naval).

The game might feel a little easier in the beginning because the AI focusses more on building it's economy and spams slightly less units.
But the lategame shall be way, way, way more difficult.

I haven't really played it yet, only watched in Observer mode after Del-Killing myself in the beginning. Tomorrow I'll most likely do a drawn-out test.

Edit:
Played 2 games on it. Lost badly on hard and lost on Medium aswell. Am playing my 3rd game now, on medium again, and it doesn't look good for me once again.

Please report any issues if you find some.

Edit: Newer version is here:
viewtopic.php?f=279&t=50873&start=20#p486920
Attachments
Improved_AI_1.1.0.zip
(54.74 KiB) Downloaded 335 times
Last edited by Xilmi on Sun Aug 17, 2014 9:24 pm, edited 4 times in total.

Zak0r
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 188
Joined: Sat Jan 25, 2014 1:21 pm

Re: AI Modding

Post by Zak0r » Sat Jul 05, 2014 8:08 am

Here's the screenshot you wanted to post. :)

Image

I will test those changes some time. If it really works well maybe the devs can add some of that to the game. The issue with the trash units is very important. If the AI starts to build proper units maybe the cheat bonuses in morale and growth can be lowered again to adjust difficulty and make the AI less cheaty. :)

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Sat Jul 05, 2014 12:06 pm

Thank's for posting it.

Note that the game the screenshot is taken from was partly played before all changes where working and that's why there's still a lot of strange units.
The ones my mouse is hovered over, are from an inbetween step, where forcing better armor worked but better chassies not yet because the difference in strategy-score was too low.
It only becomes relatively reliable when the difference is 0.1 or higher.

super44
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 5
Joined: Wed Jun 25, 2014 7:26 pm

Re: AI Modding

Post by super44 » Sun Jul 06, 2014 2:06 pm

:) :) :) :) thank for the game and for the work :) :) :) :)

Megas
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 40
Joined: Sun Feb 10, 2013 5:34 pm

Re: AI Modding

Post by Megas » Sun Jul 06, 2014 2:48 pm

Great job. This should make the AI at least somewhat challenging.

Megas
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 40
Joined: Sun Feb 10, 2013 5:34 pm

Re: AI Modding

Post by Megas » Sun Jul 06, 2014 3:11 pm

I looked through the files. Some suggestions.

Armor
The AI should ALWAYS use best armor. Is 0.1 difference enough to make it use the best armor all the time?

Devices

Modules that require more though to use should be best disabled for the AI. Those are
XP, HealArea, Sight, FirstStrike, AlwaysHeal, Movement, ... actually pretty much all

Good modules for AI are Defense, Upkeep and Attack. Simple boosters that are just effective.

Upkeep has no extra production costs and IA tends to spam units. This would make it less crippled with upkeep costs.
Defense is always good because it gives you more trouble when trying to kill their units.
Attack makes the more dangerous too.
Defense should have slightly higher priority than attack. AI doesn't always attack and you will always need to kill their units so defense is more likely to be used.
None is actually a good option too before some other 0 cost device.

Units

Chassis types only have 0.05 difference, You mentioned it needs to be at least 0.1 to make a difference. AI really should never use old types.

Weapons

The increased weights not only make AI use the best design from each class but also favor classes that have higher tiers researched. Should work very well.



There is unit design folder with some ready made designs. Can we use this to make ready made designs for AI to use?

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Sun Jul 06, 2014 6:13 pm

Megas wrote: Armor
The AI should ALWAYS use best armor. Is 0.1 difference enough to make it use the best armor all the time?
According to my tests I'm pretty sure it works perfectly for the armor.
Megas wrote: Devices
Modules that require more though to use should be best disabled for the AI. Those are
XP, HealArea, Sight, FirstStrike, AlwaysHeal, Movement, ... actually pretty much all

Good modules for AI are Defense, Upkeep and Attack. Simple boosters that are just effective.

Upkeep has no extra production costs and IA tends to spam units. This would make it less crippled with upkeep costs.
Defense is always good because it gives you more trouble when trying to kill their units.
Attack makes the more dangerous too.
Defense should have slightly higher priority than attack. AI doesn't always attack and you will always need to kill their units so defense is more likely to be used.
None is actually a good option too before some other 0 cost device.
Devices are the only thing I didn't modify anything about. Keep in mind that the spamming is relative and the AI will have way less units due to building stronger ones with higher industry-cost, so the -Supply might not be as usefull as you think.
I'd first like to see what the AI normally uses and then decide if it needs work. One of the most often used seemed to be the attack-several-times one.
Megas wrote: Units
Chassis types only have 0.05 difference, You mentioned it needs to be at least 0.1 to make a difference. AI really should never use old types.
Hu? I'm pretty sure it is 0.1, not only 0.05.
For example for Planes I set it to:
Tier 1:
<score strategy="Airborne" add="0.20"/>
<score strategy="Fight" add="0.40"/>
<score strategy="Mechanical" add="0.20"/>
Tier 2:
<score strategy="Airborne" add="0.30"/>
<score strategy="Fight" add="0.30"/>
<score strategy="Mechanical" add="0.30"/>
Tier 3:
<score strategy="Airborne" add="0.33"/>
<score strategy="Fight" add="0.33"/>
<score strategy="Mechanical" add="0.33"/>

This does not guarantee only new chassis but they appear to be used like 70% of the time.
Megas wrote: There is unit design folder with some ready made designs. Can we use this to make ready made designs for AI to use?
Had a brief look at it but did not see how this was usefull so I ignored it. Maybe something can be done with it but I don't know how.

Megas
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 40
Joined: Sun Feb 10, 2013 5:34 pm

Re: AI Modding

Post by Megas » Mon Jul 07, 2014 11:19 am

I looked at tanks and they had 0.40->0.45->0.50

It's two values though so they add up to 0.1.

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Wed Jul 09, 2014 10:33 pm

Here's an image from my current game with the Mod.

After seeing, that the University is in trouble I did some scans of their area.
This is what I saw:

Image

stiefelss
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 40
Joined: Wed Apr 09, 2014 10:44 pm

Re: AI Modding

Post by stiefelss » Thu Jul 10, 2014 6:51 am

Why do all the AI units have lvl 1 transcendent armor when they start the game?

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Thu Jul 10, 2014 8:08 am

stiefelss wrote:Why do all the AI units have lvl 1 transcendent armor when they start the game?
I haven't seen a behaviour like that in my Mod.
The Mod does not change what the AI starts with.

Can you please post a Screenshot of that?

They should start with no armor whatsoever, as usual.
Later on, and that's what the Mod is about, they should of course use the best armor available to them.

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Sat Jul 12, 2014 12:28 pm

I did a new version.
The file is uploaded in the same post where the old version was. (Post 3 of this thread) It is now Version 1.1.0 instead of 1.0.1

Changes:

Changed all weapons to have a total strategy score of:
1/1.3/1.6

Changed all vehicles to have a total strategy score of:
1/1.3/1.6

Changed most important buildings to have a combined strategy-score of:
2.0

Changed most Advancements to have a combined stratgey-score of:
2.0

Reason:

The difference in strategy-score for weapons and vehicles felt too low.

I first tried 0.4/0.7/1.0 for the vehicles. While it worked nicely to have them pick the best vehicles most of the time, it resulted in the AI skipping the technologies for most early vehicles.

After increasing the values to 1/1.3/1.6 once again some buildings where ignored. So I pushed those again aswell.

While after that the likelyness of getting all vehicles was reduced again, it was not nearly as bad as before and AI got most hulls. Not immediately but eventually and before they where totally outdated.

There won't be much of a difference to notice compared to 1.0.1 but the very-late-game-performance should be slightly better than before.

Here's the direct link: download/file.php?id=8541

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Sat Jul 12, 2014 12:30 pm

I did a new version.
The file is uploaded in the same post where the old version was. (Post 3 of this thread) It is now Version 1.1.0 instead of 1.0.1

Changes:

Changed all weapons to have a total strategy score of:
1/1.3/1.6

Changed all vehicles to have a total strategy score of:
1/1.3/1.6

Changed most important buildings to have a combined strategy-score of:
2.0

Changed most Advancements to have a combined stratgey-score of:
2.0

Reason:

The difference in strategy-score for weapons and vehicles felt too low.

I first tried 0.4/0.7/1.0 for the vehicles. While it worked nicely to have them pick the best vehicles most of the time, it resulted in the AI skipping the technologies for most early vehicles.

After increasing the values to 1/1.3/1.6 once again some buildings where ignored. So I pushed those again aswell.

While after that the likelyness of getting all vehicles was reduced again, it was not nearly as bad as before and AI got most hulls. Not immediately but eventually and before they where totally outdated.

There won't be much of a difference to notice compared to 1.0.1 but the AI's performance at the very-late-game should be slightly better than before.

Here's the direct link: download/file.php?id=8541

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Mon Jul 14, 2014 6:19 pm

I'm still not 100% happy with a lot of the decisions the AI makes.
Too often do they skip important techs and too often do they build crappy units in cities, that aren't fit for unit-production yet.
There seems to be a limitation in turn time-when the AI decides to make a design, it overrides all strategy-scores to prevent the golden-super-mech to be made somewhere, where it would take 50 turns.
This actually is not a bad thing but other than being pressed against the wall and direly needing units, this is very inefficient in the long run.

I think I have some ideas left but this will be once again quite time-consuming to test and might have negative impact in other areas.

I wonder if there's a way to mess around with the worker-distribution of the AI and what kind of field-improvements it builds. It looks like they will try to use all their 2+ minerals all the time and also will try to convert it into production all the time. There should be a way to have them focus on research more under certain circumstances. For example in peace-time, when not actually planning to go to war and not feeling threatened, they should relieve some of the miners/workers and use more scientists, especially if most buildings are already built.

More ideas would be strategic-scores depending more on certain circumstances. Like if there's no actual mine in the cities-radius, there should be a lower score for mining-buildings.

One thing, where I feel the Endless-Space-AI is superior is that Building Units and Ships is not weighted against each other by the same mechanism.

There's one mechanism which determines which building should be build in which order under which circumstances and then there's another mechanism that kinda "orders" units.
The Order is then processed by picking the systems most suited to unit-production in a top-down-order till the order is fullfilled. In Pandora units potentially also are built in new cities without any production-enhancers or barracks.

Zak0r
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 188
Joined: Sat Jan 25, 2014 1:21 pm

Re: AI Modding

Post by Zak0r » Tue Jul 15, 2014 7:57 am

Btw we tried the ai mod last weekend in MP with Xilmi and another friend. We had only "medium" ai but it was definitely stronger than usually.

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Tue Jul 15, 2014 3:45 pm

The way you demolished them did not exactly suggest that it was stronger. But then again I don't now how dealing with them felt for you guys before.

In my current game, after being semi-behind, I managed to outresearch all other factions.

When capturing cities I can clearly see they have all the research-buildings but yet they still can't keep up.
So it must be their worker-distribution.

Probably further increasing the Production-buildings importance could help. I already gave it a higher score than the research-building but somehow they seem to prioritize other stuff over it still.

The "trick", I still have in my sleeves would be adding Combat-Score to buildings. Did that to the Barracks already and it really works wonders.
But that comes with the risk of making them too rushable or even losing to aliens. "I need military... Let's see what has the best Combat-Score... Yeah, let's get this Morale-Building!" Gotta test it in order to make sure.

Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 522
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi » Thu Jul 17, 2014 5:10 pm

Before it makes sense to continue working on the mod, I'd really like to know which changes where made from 1.4.1 to 1.4.2.
Unfortunately as a steam user I can't get access to it.

Can someone with access to 1.4.2 please zip and upload the "World"-Folder from withing the Data-Folder?

Megas
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 40
Joined: Sun Feb 10, 2013 5:34 pm

Re: AI Modding

Post by Megas » Fri Jul 18, 2014 9:50 pm

Here you go
Attachments
World.zip
1.4.2
(165.82 KiB) Downloaded 173 times

Post Reply

Return to “Pandora : Modders Corner”