Logo Platform
logo amplifiers simplified

(even more) AI modding

Reply
Copied to clipboard!
12 years ago
Dec 3, 2012, 11:14:55 PM
I doubt everybody will look in this thread for new mods to try. I recommend a top level modding thread.
0Send private message
12 years ago
Sep 2, 2012, 5:51:35 PM
I found some more stuff:



The AI when ahead in every aspect and not threatend really slacks with it's military. It won't make new designs and it won't build ships.



I think the reason is this:





1



1

1

1



In a test-game I found that they, despite having finished the military-tree, did not have any current design.

A few turns after declaring war they had a single new design.

But that was it.

They still built Ind=>Dust in most of their systems and 1 system built one of the old designs instead of the new one.



The amount of AI-incompetence on that area is really shocking!
0Send private message
12 years ago
Aug 25, 2012, 8:24:42 PM
I have never seen the behaviour you describe in b)... Ind->Dust has a Prio of 0.1 and that is more than 0.



And for a) I've done quite a lot to improve the Exploitation-Behaviour and the decision-making about food-buildings.

I will test that some more and then release it most likely by tomorrow. My next aim is to put better decision-making into all of the other buildings. Now that I know how I can do it I can make progress there.



It requires making new variables in StarSystemDescript, where I can calculate stuff, multiply it by 100 (important because when you compare values they are rounded!) and then use them in equotations.



The formulas I have in mind shall be like calculating the IDS-gain. (not for food, there I have this other system in charge, I'm testing right now) and then bring it in connection with the build-times to see if it is worthwhile.
0Send private message
12 years ago
Aug 26, 2012, 2:13:56 AM
Can someone summarize the changes in the other thread?



Also did we ever figure out if the AI takes Industry costs into account when building improvements, or if the cost needs to be "baked" into the weights? Also, how does the AI select "replacer" constructions, i.e. exploitation and terraforming--does it compute the change in score?
0Send private message
12 years ago
Aug 26, 2012, 2:44:30 AM
Evil4Zerggin wrote:
Can someone summarize the changes in the other thread?



Also did we ever figure out if the AI takes Industry costs into account when building improvements, or if the cost needs to be "baked" into the weights? Also, how does the AI select "replacer" constructions, i.e. exploitation and terraforming--does it compute the change in score?


I'll try to summarize it. Currently I'm having problems to test the standalone-version of the mod... Same problem as usual: Game won't start anymore once I selected the mod.



The AI indeed already does take Industry cost into account and it does not necessarily need to be baked into the weight.



Terraforming and Exploitation are treated differently:



The AI, without further help by modding is smart enough to only terraform when the Tier changes and of course will never go back to a lower tier. A typical Terraforming-Chain of the AI looks like that: Lava => Desert => Arid => Terran

I tried to mess around with terraforming-priorities but I eventuelly put it back to default because my changes made it terraform too soon. The original parameters work pretty well here.



Exploitations are treated completely differently. The AI will always switch those when it thinks another one is better for the moment. I think it is treating them as a value 2.x-Building it does not have yet. Here a modder can have a huge impact and I think my new changes to that are really good as they consider the Sowers working differently and differentiate between the levels of one exploit. (As in "Why should a terran like Finance2 more then Industry2, when it only gets a bonus on Finance3?")
0Send private message
0Send private message
12 years ago
Aug 26, 2012, 5:59:21 PM
I have done an experiment to compare my play for the first 60 turns against the AI. If we still find significant differences, perhaps this will help tune the AI more. Not that I am such an expert player; but when we have done these experiments before, we have seen such obvious things wrong that we just stopped. Now maybe it will be better.



Here is my process.



1. Start a two player game, large map, both amoeba, hard difficulty, using community mod serial 04 to get ail's "better AI 1.1".



2. Save the turn zero game.



3. Play 30 turns, doing nothing but "wait one minute, click next turn". Note that we have found a bug; if you click next turn fast, the AI player is not, in fact done, and it won't do some things which it does if you wait longer. This is an exploit you could use against the AI.



4. Save after 30 turns. Repeat and save after 60 turns. The AI player has now had 60 turns of development, without interacting with me at all. (Maybe a scout landed.)



5. Jailbreak the turn 0 game. Load as the other player, which the AI has just played 60 turns of.



6. Play 30 turns on my own, save, play another 30 turns, save.



7. Compare the four saves: on the other position, me vs AI after 30 turns, me vs AI after 60 turns.



Statistics after 30 turns: I had 25 pop in 7 systems, AI had 23 pop in 6 systems. I had science value 34 in the "end game" screen (not sure what this means) and AI had 46. I had zero MP, AI had 420. In the tech tree, the main difference is the AI had all the tier 1 and 2 techs in all four trees; I hadn't bothered with weapons but I had nonbaryonic shields. I had one L3 admin hero (civil engineer natch), the AI had 3 L3 heroes, all on planets, all with fleet skills (due to the mod).



Commentary after 30 turns: There isn't much notable difference. I expanded slightly faster, and I had "better" techs, and I hadn't wasted any industry on ships. This is a little unfair, because I knew from the map setup that warfare wouldn't be that important.



Turn 60 stats: I had 83 pop on 10 systems compared to the AI with 112 pop in 14 systems. I had 152 science compared to 145 for the AI. I still didn't have any warships but the AI had 12K MP. I had one L5 hero with pure admin abilities, the AI had 3 L5 heroes.



Turn 60 commentary: Here is where we can probably learn useful things.



a. The AI had 17x 5CP fleets, which seems like quite a lot.



b. The AI still did not have nonbaryonic shields even researched, nor any of the industry boost techs in the south part of the science tree. I had antimatter, hexaferrum, and 3D replication plants. I did not manually total up the industry values and science values since jailbreaking discards the AI approval advantages; but I bet my industry and science were quite far ahead even though my pop was behind.



c. The AI had colonized every nearby system, even ones with pretty poor planets. I don't know the exact approval bonus the AI gets, maybe this makes sense.



d. This map layout didn't have much opportunity for monopolies. Some players (on some maps) make a strong effort to go after these and this could have a big impact. The AI doesn't "appear" to go after them at all.



e. The mod attempts to make heroes more useful by forcing them to take all fleet abilities, since we cannot force "specialization". I used the standard technique of an L3 admin hero, moving to a new starting system every 6 turns. I suppose this helps new systems start much faster, and the AI does not use this technique.



f. Although "community mod serial 4" is used, I saw the AI building cis-oort satellites, which is impossible according to the mod, and building xenotourism quite early, which should not happen. Since ail has found that copying files into the game directory "seems" more reliable than loading via a mod, I wonder if this has had a strong effect. If so, then the experiment is kind of wasted.



If anybody has comments on the methodology, I will probably do this again when either, (1) ail releases a new systemimprovements.xml, I will copy it into the game directory, or (2) the dev team includes some version of this into the release.
0Send private message
12 years ago
Aug 26, 2012, 9:41:42 PM
Want to comment a few things:



"Note that we have found a bug; if you click next turn fast, the AI player is not, in fact done, and it won't do some things which it does if you wait longer. This is an exploit you could use against the AI."

I'm not sure we should call this a bug. It seems to be a design-choice. The ways to exploit it are pretty limited as ending the turn ASAP won't give you much time to do better than the AI either.

I think it should be an option in the menu. "Always wait for AI to finish everything. Warning: Depending on your hardware that might cause longer turn times."



"b. The AI still did not have nonbaryonic shields even researched, nor any of the industry boost techs in the south part of the science tree. I had antimatter, hexaferrum, and 3D replication plants. I did not manually total up the industry values and science values since jailbreaking discards the AI approval advantages; but I bet my industry and science were quite far ahead even though my pop was behind."

Don't know if the community mod v4 already has the changes I made to "AIParametersTechnology.xml". Actually I changed exactly one thing. I trippled the AI value of Nonbayonic Shields there so it should research it as soon as it has the prereques. This file offers great potential to force the AI to make better choices in teching.



"e. The mod attempts to make heroes more useful by forcing them to take all fleet abilities, since we cannot force "specialization". I used the standard technique of an L3 admin hero, moving to a new starting system every 6 turns. I suppose this helps new systems start much faster, and the AI does not use this technique."

Well, you found out how we could force the other thing: We could also force the AI to use all system-heros. But I think in the long run all fleet would be better because wars are won in battle not by outproducing.



"f. Although "community mod serial 4" is used, I saw the AI building cis-oort satellites, which is impossible according to the mod, and building xenotourism quite early, which should not happen. Since ail has found that copying files into the game directory "seems" more reliable than loading via a mod, I wonder if this has had a strong effect. If so, then the experiment is kind of wasted."

Well, if that's the case then it would be really bad. :\



"If anybody has comments on the methodology, I will probably do this again when either, (1) ail releases a new systemimprovements.xml, I will copy it into the game directory, or (2) the dev team includes some version of this into the release."

I have included a new systemimprovements.xml in my Ai-Mod 1.2. It has mainly a better logic for food improvments. But needs to be taken together with the slightly tweaked AIParametersBuilding.xml.
0Send private message
12 years ago
Aug 27, 2012, 12:50:22 AM
(FYI, instead of putting quoted text in quote marks, could you use the
and
tags? It is easier to read and only a few more characters to type.)



Ail wrote:
Don't know if the community mod v4 already has the changes I made to "AIParametersTechnology.xml". Actually I changed exactly one thing. I trippled the AI value of Nonbayonic Shields there so it should research it as soon as it has the prereques. This file offers great potential to force the AI to make better choices in teching.


I have included your file. Apparently the game doesn't like loading it. Next time I play a full game, I will retry with your technique of copying mod files over the original game files. This is a bad bug in the game which we cannot easily diagnose from the outside.



We could also force the AI to use all system-heros. But I think in the long run all fleet would be better because wars are won in battle not by outproducing.


I feel we have tried enough different hacks to get good behavior from heroes. Let's wait till they expose more hooks, or fix the code.
0Send private message
12 years ago
Aug 27, 2012, 1:31:19 AM
davea wrote:
I have included your file. Apparently the game doesn't like loading it. Next time I play a full game, I will retry with your technique of copying mod files over the original game files. This is a bad bug in the game which we cannot easily diagnose from the outside.


Be aware that it depends on 2 new variables I introduced in StarSystemDescriptor. Those are required for the smart food-management won't work.



Unfortunately the smart food-management is not smart enough to work well with the Planetary-exploitations. I did not take into account that when you switch between exploitations you tend to lose the prior one and this easily means the system goes from "enough food supply" to "too little food supply".



So before I come up with a good idea on how to fix that, I'd not put the new version for "PlanetInfrastructure.xml" it into the community-mod yet.
0Send private message
0Send private message
12 years ago
Aug 25, 2012, 5:47:37 PM
We have done quite a number of things deep in the "AI Modding" thread, and these improvements will hopefully be rolled into the game soon. What else can be improved about the AI? That is, what *can* be improved? It is different from "what would we like to improve if the modding hooks were only there"?



I know ail is still working on improved numerical calculations for systemimprovements.xml, and we "hope" the dev team will fix the tonnage issue.



I played a game this morning using governors. If we are "done" with systemimprovements.xml and it works, then the governors should work fine. Actually I was surprised to find that they do work fine, with two major exceptions:



a. If I put a planet on ind->dust, and the governor wants to build something, it builds it, and takes away ind->dust. This makes the governors unusable unless you have a high trade game going, where you never need ind->dust. This is odd, because if I put an actual building or ship into the queue, it stays there. Only the ind->dust/sci get removed by governors.



b. If a small system gets done building everything, it stays at "no production" instead of at least going to ind->dust/sci.



Is it possible to give "some low" priority to ind->dust/sci in the xml? It appears to be "never", which is too low.
0Send private message
12 years ago
Sep 2, 2012, 6:13:05 PM
If they are way ahead, why waste money on ships? And why make new schematics, if you are not building ships? What would be interesting to test is, what happens when that AI is suddenly no longer ahead. For example, if you give yourself a billion dust (!!) and build a huge fleet and attack, does the AI switch gears and build modern ships?
0Send private message
12 years ago
Sep 2, 2012, 6:47:33 PM
Tried it out and bought Ships for all the Money I had saved.



2 Turns later all their queues were filled with ships. They did not use their money to buy something though. (They have 2 M, I had only 300k)



There seems to be a bug with their designs.



They have 8 regular designs. One or two per Hull-Type.

But they also have 12 "Large1bishoratiotemplates".

Instead of Modifying their Large1Bis-Template they made new ones.

Which means they

a) cannot upgrade them

b) will still build them



Their queues are filled randomly with new and old versions of this template.
0Send private message
12 years ago
Sep 2, 2012, 7:43:13 PM
Unfortunately, I am no longer surprised that this works badly. The logic for (a) when to make a new schematic, (b) when to buyout ships, (c) when to retrofit ships is invisible to us, and apparently not very good. If they can fix the tonnage bug, which we agree is even worse, then perhaps we can push for this next.
0Send private message
12 years ago
Sep 2, 2012, 8:03:18 PM
I'd really like to have a look at the actual sourcecode for some of the annoyances. :\
0Send private message
12 years ago
Sep 3, 2012, 12:26:41 PM
I've tried a lot of things to get the AI to build ships instead of nothing.



Unfortunately none of the parameters that looked like they would probably affect it, did anything. The only way to get the AI to build more ships was getting more ships myself.



Considering how many and precise options there are to tell the AI what to research and what improvements to build in what order the decisions when to make ships remain pretty mysterious.



There are hints that there is 2 triggers for them when to build ships.



a) In emergencies, independently of how well developed a system is.

b) Once a certain degree of development is reached and "the limit" is not reached yet. Only on well developed systems.



For "The limit" there again seems to be 2 different factors.



a) The size of the military of others. AI will try to match that.

b) If military size is already bigger than that of others then there seems to be a formula connceted to population.



While some of the parameters in Personality.xml seem to be variables of that formula, changing them does nothing.

[code]



1

1

1

[/code]



Also the values here appear far to low. Pop^1*1+1 = Pop+1... which is very low so this does not really seem to be what is used.



I'd love if a dev could enlighten us here as to if and how increase the number of ships the AI will build when ahead.



Personally I think it shouldn't ever stop as long as it can afford the maintenance.
0Send private message
12 years ago
Sep 6, 2012, 4:06:14 PM
I hope I'm allowed to do that. ThorTillas pretty much answered my question regarding the ship-limits and I thought that whoever read this thread might be interested as well.



So I'll post his answer for everyone to read. I don't think I hurt his privacy when doing so ^^:



ThorTillas wrote:


I can make a quick explanation on how it works, but I am not sure this will help you very much... but still.

We base our AI on three layer.

1st the "System layer", each system is responsible to choose a building and move population according to its "Governor" settings.

2nd the "Empire layer" which is responsible for all technology choices, AI ship design generation and according systems' governors with empire needs

3rd the "Master layer" which is responsible for all "intelligence" choice. Defense, diplomacy, economy, exploration, expansion and acadamy (hero) ministers try to choose what the empire can/cannot/must do.



The building are chosen based on two things. First, the possibility to build it (pathPrerequisites + AIPathPrerequisites) and second the need of it based on the AIParameter and the governor settings. We sort all available buildings and take the most interesting one.



The ship process is a little more complicated because it is based on the 3rd layer and include Defense, exploration and expansion needs.

Each minister evaluate his needs in ships and push some ship request on a big "black board".

Each ship request contains a ship design to build and a priority.

The economy minister take all ship requests and try to find an appropriate system to push it. We use a factor (which should be named "DevelopmentPercent") to define if a system has built most of his building.

so we sort the system by development percent and next by industry and as long as the system is developed we push a ship request.

If the ship request priority is over 1, then we allow the economy minister to push ship on system that are not well developed. This is to avoid some starving of military ship or colonization ships.

When a "System layer" get the request to build a ship, it will override the current construction with the ship. No matter of what was in the queue (for now).



So for the military priority computing.

We compute our current military power. We compare it to "the minimal military power" allowed (which is something like (population^coeff * coeff) + coeff as you already see it in the personality) and the higher other empire military power * diplomatic coeff (something like 0.5 when in alliance, 1.5 in war, etc).

If we are under the minimal military power, we are really bad and we push some ship request with a priority of "1.1" and limit the ship production at 80% of the available empire production.

If we are under the other empire military power, we are bad, but ok, we still can handle it, so we push request at "0.7" and limit the ship production at 50% of the available empire production.

otherwise, we are the most powerful empire, keep a little production up but with a priority of "0.2" and limit the ship production at 20% of the available empire production.



All these variables could be modify in the Public/Simulation/Registry.xml or via the personalities.xml. The personalities are just some modifier to add to the registry one. So if you modify the registry this will be done for all AI but when you do it in the personalities this will be done only for the faction you modify. You will found them under the "ShipRequest" tags.



There is no "PathPrerequisites" around ship request. so you will not be able to say "Don't build ship while you have less than 10 system" or anything related with simulation desciptor...
0Send private message
12 years ago
Sep 6, 2012, 4:38:48 PM
That is interesting information, although it is hard to do much with it. Is there any update on what triggers the AI to create new schematics, or rather, why old schematics seem to exist for a long time?
0Send private message
12 years ago
Sep 6, 2012, 7:09:35 PM
Well, I consider it indeed helpful. It covers up what I've seen as a problem in my last game.

The area has a lot of interesting stuff to play around with things how the AI attacks, how many ships it will want in which situation and the like.



Part of your question might be in connection with the Large1BIS-Bug... That was one of the bugs that caused Old Designs to stay around forever.
0Send private message
?

Click here to login

Reply
Comment