AI Modding

Moderators: Pandora Moderators, Slitherine Core

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

Re: AI Modding

Post by Xilmi »

Thanks. This is interesting.
Apparently there is only a global "StrategyAgent.xml" which modifies everything from newer eras to have a strategy-score of +0.3
I don't know if this also is true for buildings but I would think it is.

Since apparently almost nothing else was changed, there still seems need for some modding but I would first have to actually try it out and observe build-order.
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

Just taking notes here...

AI wastes a lot of production in the early game by throwing infantry at aliens.
Most human-players in multiplayer try having tanks before fighting alies because they are much easier to keep alive cost-efficiently.
This could probably be helped with by increasing the relative value of Era-1 tanks.

Another thing, that does not seem to be easily fixable is the AI's habit of teching through the tree too quickly and skipping important core-techs. Like improved Labs for instance.
I suppose all techs on the right from where you are, are automatically seen more valueable than older ones. This makes quite a lot of sense for military-equipment as in: No sense to get Armor I, when you already got Armor II. But for buildings this is a bad thing. Usually you would want to have all buildings researched as their effects stack.
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 »

Tanks come too late.
Flamethrowers are excellent against aliens.
I clear hives with flamers no problem.
Tanks are good against other factions not aliens.
lifehole
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 5
Joined: Sun Jul 20, 2014 2:55 am

Re: AI Modding

Post by lifehole »

Aye I've bought the game now and I always use flamers against early game aliens/ants. I don't think I ever see the AI use tanks though, yeah.
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

I've run some tests with a slightly increased strategy-score for tier-1 tanks.
It works okayish depending on where the tanks are in the tech-tree.

However, I've run into a really troublesome problem:

The Devices for the Units.

A huge problem is that the strategy-score is used for both research and selecting a building-project.

Right now the relative value of devices is too low for the AI to bother researching them.
Which often causes them to use the convert-alien-device since they get it without research.

I've seen it has no strategy score at all but still get's choosen. I can't use a negative strategy-score. This makes the game crash when loading the files.

Increasing the value of devices, in order to have them researched, makes units overall strategy-score too high and they once again start neglecting buildings.

I'd really ask the developers for a different approach for AI project-picking.

They should have some client order units and then pick the cities best suited for that task. I'm pretty sure that's how it already works for Colonizers and Formers.

With the way it currently is implemented, where units and buildings have to compete with each other, one of them will fall down and produce bad results.
e.g: If I force the AI to make buildings first, they become too easy to rush. If I don't, they will eventually keep producing units and neglect their long-term-economy-buildup.

That's kinda like the difference between Mod and Vanilla right now.

I still think that a forced "buildings first" is more effective. It's not like they all are available at once and the AI eventually runs out of them. But since this also affects tech-priority, this once again is troublesome. In my latest test-game one of the AI's (Togra University) even was eliminated by aliens because of that.

My mod kinda removes the AI's rushes and shifts their aggression to later in the game.

If I had to program something like it, I would have a threshold of minimum defensive units (for example a certain amount of total combat-strength depending on population, like 1 strength per pop.), which are built at the best suited cities (algorithm could simply check for the highest amount of buildings, then highest amount of industry).
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 »

Try giving the +25% defense device a small score. They are decent on AI units since they require absolutely no thinking to use. And it's tons better than alien capture.
Xilmi wrote:I've run some tests with a slightly increased strategy-score for tier-1 tanks.
It works okayish depending on where the tanks are in the tech-tree.

However, I've run into a really troublesome problem:

The Devices for the Units.

A huge problem is that the strategy-score is used for both research and selecting a building-project.

Right now the relative value of devices is too low for the AI to bother researching them.
Which often causes them to use the convert-alien-device since they get it without research.

I've seen it has no strategy score at all but still get's choosen. I can't use a negative strategy-score. This makes the game crash when loading the files.

Increasing the value of devices, in order to have them researched, makes units overall strategy-score too high and they once again start neglecting buildings.

I'd really ask the developers for a different approach for AI project-picking.

They should have some client order units and then pick the cities best suited for that task. I'm pretty sure that's how it already works for Colonizers and Formers.

With the way it currently is implemented, where units and buildings have to compete with each other, one of them will fall down and produce bad results.
e.g: If I force the AI to make buildings first, they become too easy to rush. If I don't, they will eventually keep producing units and neglect their long-term-economy-buildup.

That's kinda like the difference between Mod and Vanilla right now.

I still think that a forced "buildings first" is more effective. It's not like they all are available at once and the AI eventually runs out of them. But since this also affects tech-priority, this once again is troublesome. In my latest test-game one of the AI's (Togra University) even was eliminated by aliens because of that.

My mod kinda removes the AI's rushes and shifts their aggression to later in the game.

If I had to program something like it, I would have a threshold of minimum defensive units (for example a certain amount of total combat-strength depending on population, like 1 strength per pop.), which are built at the best suited cities (algorithm could simply check for the highest amount of buildings, then highest amount of industry).
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

The +25% has a default-score of 1.0.
That already is much better than the 0.0 from Alien-Capture-device.

And if they have it, they'll prefer putting it on all units.

The problem is, that with increased values for other stuff, the AI will usually skip it in research. So I probably should give it a higher score, in order to make them get it. But then again this will mess around with the units vs. buildings ratio.

I really think that research should have it's seperate set of strategy-scores.

Maybe I'm wrong in thinking that for deciding what to build, the sum of all parts is added when it comes to strategy-score. It actually would make sense to be that way.
I will try it out by giving the devices some extremely high values and observe what the AI does. Hopefully it turns out to be like we hope. ^^
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 »

How about giving it higher value but reducing values on units by the same amount?

Unit with he module will have the same score as before but the module will actually get researched.
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

I ran the test and while it initially looked bad, it also gives room for hope.
I set the score for the defense-device all the way up to 10. All AI's researched it as their very first item and then started spamming units with this device like there's no tomorrow.

But eventually they still built some building despite them having a much lower total score. They never built the Barracks though, since I gave those a strategy score of the fight-type before.

So this means that there indeed is something working in the background that acts as multiplier for the different strategy-score-types. If the amount of military is really high, the fight-score-multiplier seems to plummet down enough to make buildings more interesting once again.

I still have too little knowledge of the internals. Maybe unit-components value internally is divided by 4 since a unit has 4 components and the base-value of each of them is 1 in vanilla.

If this is the case, then it should work best if I use the following approach:

Era 1 weapons: all 1
Era 1 armors: 1, 1.1, 1.2
Era 1 hulls: all 1
Era 1 buildings/advancements: all 1, with exceptions getting a bonus of up to +0.2

Era 2 weapons: all 1.3
Era 2 armors: 1.3, 1.4, 1.5
Era 2 hulls: all 1.3
Era 2 buildings: all 1.3, with exceptions getting a bonus of up to +0.2

Era 3 weapons: all 1.6
Era 3 armors: 1.6, 1.7, 1.8
Era 3 hulls: all 1.6
Era 3 buildings: all 1.6, with exceptions getting a bonus of up to +0.2

Devices for all eras, depending on how usefull they appear either something between 1.0 and 1.6

If the score is indeed divided between the unit-components, then it should still make buildings quickly enough late game. If not, then this approach must be considered a failure.

I wish the devs would just allow steam-users to access 1.4.2 aswell because chances are that by doing this, I'm almost exactly replicating what their StrategyAgent.xml does.
So it might turn out a big waste of time from my side just because of the unfairness of steam users getting nor "Slitherine"-Key.
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

Well, since more days passed and still no signs of availability of the patch for steam-users I did what I intended.

Now while watching, I see the AI do something extremely stupid, which has nothing to do with build order.
But the AI-behaviour here is so stupid, that it could almost be considered a bug.

The Togra University has 2 cities. Both of them have not a signle mountain or hill in their range.
What are they doing? They chop all forrests and turn every single tile into farmland, leaving them with no additional mining at all.
And what else they are doing? They have 6 Minerals per turn to build but they use a total of 8 workers!
So instead of at least using their capacity to research faster, they waste 5 workers to do absolutely nothing!

Here's a screenshot:
Image
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

The new test clearly shows, that having an equal value for buildings and unit-components doesn't work out.
This once again causes economy to be neglected in order to make units.

The only option to counter this is to give buildings a significantly higher strategy-score.

But this again also affects science and AI hardly researches the unit-components anymore.
I'd still want the AI to research better unit components but without having them think this means that they should spam these units then.

My conclusion is: There should be seperate stratgey-scores for science and for building-project picking.

So for the moment I can't really improve much about v 1.1.0 of this mod because of that.
DarkZeak
Private First Class - Opel Blitz
Private First Class - Opel Blitz
Posts: 2
Joined: Mon May 26, 2014 12:35 am

Re: AI Modding

Post by DarkZeak »

Does this work in MP? Also, am I able to unplug it at will? I have a game going with a friend on vanilla atm. Its both of our first game. I went ahead and looked for an AI mod as most base game AI isn't all that great.

Also, any chance of getting the devs to add what you need in?
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

Yes, we have tried the mod in MP. We haven't noticed any problems with it.
It even is enough if only the host has it, as his computer handles all the stuff the AI does.
This of course also means that if you are not the host, the Mod will not have any effect.

You can also apply/unapply it to ongoing games without any problems. The mod doesn't change anything that is persistant within the save-game-files. It only changes the here-and-now-decision of what the AI builds in a given city.

I'm trying to discuss AI-improvements from this mod and more with the devs but they make themselves really rare in these forums.
DarkZeak
Private First Class - Opel Blitz
Private First Class - Opel Blitz
Posts: 2
Joined: Mon May 26, 2014 12:35 am

Re: AI Modding

Post by DarkZeak »

Thanks for the info and the mod. Also, good luck with the devs. Hope they take advantage of making their AI smarter.
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

Finally got to test some of the changes I made.
Didn't change much and since some changes might not be welcomed by everyone, I'll leave the old version online.

Changes are:
AI now considers Population-Growth-Buildings more important.
AI shall now prefer more advanced devices over older ones.
Increased Aggressiveness of Togra University, Solar Dynasty, Terra Salvum and Noxium Corperation.
Attachments
Improved AI 1_1_1.zip
(155.98 KiB) Downloaded 491 times
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

Does anyone know whether it is possible to teach the AI to Raise/Lower-Terrain and improve Ecoregions?

I tried adding this code-block:

Code: Select all

		<modifier>
			<conditions>
				<territory>
					<features>
						<feature name="Mine"/>
					</features>
				</territory>
			</conditions>		
			<effects>
				<landscapePriority add="1.0"/>
			</effects>
		</modifier>
to the Mountains, so a feature that already has a mine e.g. a hill with a mine get's terraformed into a mountain.

The game loads the modified file but it doesn't work.

Another thing I tried was playing around with values for 0/1-food plains. I could easily make it so that Labs are the preferred choice by lowering every other option to 0.9 instead of 1.0. This also made them replace existing other improvements with Labs.

If I can't find a way to do it, I'd consider removing the possibility from the player so it's fair once again. Being able to terraform better than the AI otherwise would be a huge advantage.
Xilmi
Pandora Community Developer
Pandora Community Developer
Posts: 523
Joined: Fri May 23, 2014 3:21 pm

Re: AI Modding

Post by Xilmi »

Attention: Trying to start Eclipse of Nashira with this mod installed might crash the game while loading.
Please update to the Nashira-Version of this mod, which you can find here:

http://slitherine.com/forum/viewtopic.php?f=279&t=52710
jonmjachimowicz
Private First Class - Opel Blitz
Private First Class - Opel Blitz
Posts: 1
Joined: Thu Nov 13, 2014 2:54 pm

Re: AI Modding

Post by jonmjachimowicz »

Thanks for nice sharing



Self-Control
Post Reply

Return to “Pandora : Modders Corner”