Logo Platform
logo amplifiers simplified

AI Modding

Reply
Copied to clipboard!
12 years ago
Aug 15, 2012, 2:36:21 PM
davea wrote:
Good suggestion for pop cap boosters. I didn't realize that expanding to another planet in the same system was decided just like any other improvement; there "should be" some term about how much happiness will change based on planet type and access to a luxury. For example, could you really prevent expansion to a second planet (just as a test) by setting the prerequisite to "industry lt 0"? I know this works because I modded the sensor range improvements like this and the AI stopped building them.


I'm not at home right now. I think the Planetary-Improvements were in another file but looked like they work exactly like the system ones.

I was wondering why you did that "$(ClassStarSystem:Industry) lt 0" comparision instead of just setting the value of the term to "0". Did you try that and it didn't work? Because that's how logic in almost all programming-languages work.



For example "==" in a C++ comparision actually is a function that returns a bool as return value. So "a == b" produces the same result as calling a function like "bool equal(a,b)" would.



Notice that changes to these things are all super-easy to test because the planetary-governor is also affected by and reloading after a change in a mod will instantly let you see the resutlts. So you need no jailbreaking nor countless sessions. Just set up a system, activate the governor and sell whatever you want to try against the AI.
0Send private message
12 years ago
Aug 15, 2012, 3:36:01 PM
Ail wrote:
I was wondering why you did that "$(ClassStarSystem:Industry) lt 0" comparision instead of just setting the value of the term to "0". Did you try that and it didn't work?


That is correct, I tried it and the AI still built the improvement. After I changed to "industry lt 0" the AI no longer built it. One annoying thing about modding is that in case there is a syntax/semantic error in the expression, there is no error; the expression is just ignored.



Notice that changes to these things are all super-easy to test because the planetary-governor is also affected by and reloading after a change in a mod will instantly let you see the resutlts. So you need no jailbreaking nor countless sessions. Just set up a system, activate the governor and sell whatever you want to try against the AI.


You are suggesting that I create a save-game which has one system with all possible improvements already built, change the prerequisite in the xml, load the game, scrap the improvement, set a governor, and click "end turn". Then look at the build queue for the system. If the prerequisite expression passes, then the governor will have placed the improvement on the queue and started building it. Is that correct? That is an interesting idea. For testing different expressions, I may need different system configurations such as low population or high industry, but that seems like a good approach.
0Send private message
12 years ago
Aug 15, 2012, 5:06:33 PM
Not one system specifically. But in one "normal playthrough" one can test a whole lot because of the simple fact that the governor acts like the AI when it comes to those limitations.



My only fear about that is that by improving the AI too much it might make it unnecessary to actually build manually because the AI will do just as good of a job anyways. ^^



Ignoring stuff that doesn't work is really bad news. So it's really hard to know if my $(ClassEmpire:CommandPoint)-change does something or not.



I'm pretty sure it did something when I flatout entered a "10". I just didn't want to use a static value there.

But if I have to because maybe at that part of the XML variables are not supported, I'd rather use an arbirarily high number then.



Edit:



Have you done that:





StarSystemImprovementMoney2



count(ClassStarSystem/ClassPlanet/MoonStatusExplored) gt 1



Because I think that this is the result of a false assumption due to a bad tooltip.



The Stuff that requires a moon does not give a bonus per moon but per pop on the planet that has the moon. I also did assume it otherwise before I read how it really is here on the forums. Made sense because otherwise these buildins would be vastly underpowered.



I will change that to only $(ClassStarSystem/ClassPlanet/MoonStatusExplored) instead of the gt 1 requirement.



Edit 2: Do you know if it is possible to check for another building? Maybe something like $(ClassStarSystem/ClassStarSystemImprovement/StarSystemImprovementIndustry6) ?

(Because I think the high-end food-improvements only really make sense when you have the food-to-industry-conversion-building)



Depending on Edit 2:

I'd like to have the BuyOut-Buildings only once in your Empire.

So would "count($ClassEmpire/ClassStarSystem/ClassStarSystemImprovement/StarSystemImprovementMoney3) lt 1" do the trick?
0Send private message
12 years ago
Aug 15, 2012, 5:28:02 PM
Ail wrote:
My only fear about that is that by improving the AI too much it might make it unnecessary to actually build manually because the AI will do just as good of a job anyways.


Well, it is likely we have now made the governor pick among the possible buildings as well as a human would. However, the AI picks exploits poorly, and the governor will override "global" player decisions such as ind->dust or building a ship, if there is an improvement it wants to build. So I wouldn't worry about that too much yet.
0Send private message
12 years ago
Aug 15, 2012, 6:18:38 PM
davea wrote:
Well, it is likely we have now made the governor pick among the possible buildings as well as a human would. However, the AI picks exploits poorly, and the governor will override "global" player decisions such as ind->dust or building a ship, if there is an improvement it wants to build. So I wouldn't worry about that too much yet.


The AI picking the exploits poorly is one of the things I'm trying to fix. ^^

Also the governor will always let you finished any ships in queue or whatever you have queued before taking control once again.



Waitaminute... There is an actual function call here... "count()..." Now doesn't that make it really likely that you can also use other functions like maybe add() and so?"



I forgot what had higher priority "and" or "or"? It was "and", right? So I have to put brackets around the things connected with "or" so they are evaluated first?
0Send private message
12 years ago
Aug 15, 2012, 6:55:23 PM
Ail wrote:
Also the governor will always let you finished any ships in queue or whatever you have queued before taking control once again.


I do not think that is true, or at least it was definitely not true in a previous release. Many players complained that they would set a system to build something, look back the next turn, and find out that something else was building. This was due to setting an AI governor. If they have fixed that, it would be good.



Have you done that:

count(ClassStarSystem/ClassPlanet/MoonStatusExplored) gt 1

Because I think that this is the result of a false assumption due to a bad tooltip.


This is debateable, and tied to tax rate. For Careful Sweeping, the improvement has overhead, and the benefit is taxed. So, at 0% tax, it is never worthwhile. The same is true for Xenotourism. My rule of thumb is to only build Xenotourism when the population is more than 10, but the actual breakeven point depends on the tax rate. It may be too complicated to evaluate the correct equation. I have not tried to mod that yet.



Edit 2: Do you know if it is possible to check for another building? Maybe something like $(ClassStarSystem/ClassStarSystemImprovement/StarSystemImprovementIndustry6) ?

(Because I think the high-end food-improvements only really make sense when you have the food-to-industry-conversion-building)




AFAIK it is not possible today. But the food improvements make sense whenever pop < maxpop. This happens when you add a high end tech like Sustainable Supercities which raises pop cap, or when you terraform. In the fast science thread, I played a horatio game where I terraformed to ocean and added supercities. I wanted every food improvement I could get, to fill up the population.
0Send private message
12 years ago
Aug 15, 2012, 8:44:03 PM
Very important finding:



MaxSystemPopulation = Current Maximum

MaxPopulation = Absolute Maximum



I, and possibly anyone else thought it was the other way around!



Found it out when my only colonize if Pop is max-mod did not work even when it was max. After changing:



$(../ClassStarSystem:Population) eq $(../ClassStarSystem:MaxPopulation)

into

$(../ClassStarSystem:Population) eq $(../ClassStarSystem:MaxSystemPopulation)



it would work all of a sudden.
0Send private message
12 years ago
Aug 15, 2012, 8:56:49 PM
Suppose I start a new game and find a system with only one planet, a large terran with pop cap of 8. I land one colony ship. To me, the "current population" is one, the "current maximum" is 8, and the "absolute maximum" assuming I had all the techs I might get someday, is like 12. Which ones of these correspond to which variables?



If only there were a document which listed all the variables.
0Send private message
12 years ago
Aug 15, 2012, 8:59:29 PM
davea wrote:
I do not think that is true, or at least it was definitely not true in a previous release. Many players complained that they would set a system to build something, look back the next turn, and find out that something else was building. This was due to setting an AI governor. If they have fixed that, it would be good.





This is debateable, and tied to tax rate. For Careful Sweeping, the improvement has overhead, and the benefit is taxed. So, at 0% tax, it is never worthwhile. The same is true for Xenotourism. My rule of thumb is to only build Xenotourism when the population is more than 10, but the actual breakeven point depends on the tax rate. It may be too complicated to evaluate the correct equation. I have not tried to mod that yet.







AFAIK it is not possible today. But the food improvements make sense whenever pop < maxpop. This happens when you add a high end tech like Sustainable Supercities which raises pop cap, or when you terraform. In the fast science thread, I played a horatio game where I terraformed to ocean and added supercities. I wanted every food improvement I could get, to fill up the population.


At least I can be sure the AI overwrites his own choices, when the Prerequisite is no longer true:



I added $(ClassStarSystem,StarSystemStatusBlocus) to the defense-buildings.

Scout enters system => Governor on otherwise idle (building money) system starts making the defense building.

Scout leaves system next turn => Governor switches back into the building money.



As for the debateble stuff... I plan to mainly test PlanetInfrastructe.xml and PlanetColonization.xml for now, as there is not much to be changed and tested. Once that is done I will upload them so you can put them into the community mod.

The StarSystemImprovements.xml is another calibre. I think there will be lots of testing and fiddling with the values involved before I think I feel good about it.
0Send private message
12 years ago
Aug 15, 2012, 9:06:17 PM
davea wrote:
Suppose I start a new game and find a system with only one planet, a large terran with pop cap of 8. I land one colony ship. To me, the "current population" is one, the "current maximum" is 8, and the "absolute maximum" assuming I had all the techs I might get someday, is like 12. Which ones of these correspond to which variables?



If only there were a document which listed all the variables.


Well, Current Population definately is "Population"

"MaxSystemPopulation" is the maximum for all already colonized at the current state.

"MaxPopulation" should be the maximum when all planets are colonized. This needs to be confirmed by tests. I actually can test it easily right now by counting the free spots, adding them and then set the prereq for something to that exact value. I highly doubt, however, that this takes future improvements from unresearched techs into consideration!



Edit: Done with the test...



Apparently "MaxPopulation" is the absolute maximum a system could ever have! It is not the current max-pop, not the max-pop with everything colonized and not the max-pop with every-improvement. It must be higher!



For a system with 24 countable MaxPopulation ($ClassStarSystem:MaxPopulation) eq 24 did nothing.

($ClassStarSystem:MaxPopulation) ge 24 but worked on all my systems. Even one with only 1 planet.



So I don't see any use for that. MaxSystemPopulation on the other hand is very useful for several things.
0Send private message
12 years ago
Aug 15, 2012, 9:54:48 PM
Ail wrote:
Scout enters system => Governor on otherwise idle (building money) system starts making the defense building.

Scout leaves system next turn => Governor switches back into the building money.


Cool! All the defense buildings should have this, plus I also like the "population gt 5" I had, so that early outposts don't waste their time.



Once that is done I will upload them so you can put them into the community mod.


I have several things ready to go (your hero assignment, plus updating the ship template names away from "MEDIUM1SWARMTEMPLATES 6"). Do you think it would be possible to put together something in about 48 hours from now? Friday nights are good working times for me.
0Send private message
12 years ago
Aug 15, 2012, 10:02:22 PM
Ok, I'm uploading what I've done so far.



Note: This is not a standalone mod. Replace the files in Endless Space/Public or your Modding-folder with them or add them into the Community-Mod in case you are davea smiley: wink



Contents:



Teaches the AI to not use heros totally random.

Teaches the AI to not colonize planets in it's system unless the other planets are full.

Teaches the AI to increase their pop-growth by always using the food-exploit for all planets in systems below maximum-population.

Teaches the AI to specialize their planets exploitations for what the planets are suited instead of using the same exploitation on all planets in a system once maximum-population is reached.

Teaches the AI to like the 40-Science-Building and the 6-FIDS-Building a little bit more.

Teaches the AI to launch more than 1 attack from a Defense-Zone. *



*=Actually I don't know if this does anything. It is really hard to verify if the change that I claim does what I say really does anything but I made sure it does not do anything worse than before.



Short term plan for further improvements: Teach the AI to distribute skills on heroes to specialize them instead of building fancy fleet/system-hybrids.

Long term goal: Make the AI really smart about if and when to build Star-System-Improvements.



@davea: Lol, yeah, it looks pretty much like I was able to put something together within 48 hours. (or 7 minutes in that case smiley: stickouttongue)



Edit: If anyone has any question about how I've done what, don't hold back and ask. (Or just look at the files)
BetterAI_1.0.zip
0Send private message
12 years ago
Aug 16, 2012, 2:55:03 AM
Ail wrote:
Ok, I'm uploading what I've done so far.


Rolled into community mod 1.0.14-02 (note serial 02). I am interested in feedback on the exploit changes; you have maximized total FIDS, which is a good goal. I usually choose to focus a system on one of the four FIDS, and then put all exploits to that. Your mod does focus on food while a system is still growing, but thereafter it will result in a variety of exploits instead of focusing on one.
0Send private message
12 years ago
Aug 16, 2012, 11:13:10 AM
I have a couple of questions...



- is there a way to make specific factions more aggressive and opportunistic (e.g. Hissho, UE & Cravers)?

- is there a way to make specific factions play towards a victory goal that suits their traits (e.g. UE - dust/conquest, Cravers - utter annihilation, Sophons - science)?



It's kinda disappointing to see the Hissho sitting back, rocking to Lennon's "Imagine" and letting me whisk away into the night with yet another wonder victory, time and time again (I usually play on serious/impossible).
0Send private message
12 years ago
Aug 16, 2012, 12:36:42 PM
Insolentius wrote:


- is there a way to make specific factions more aggressive and opportunistic (e.g. Hissho, UE & Cravers)?



I think that in either Personalities.xml or Diplomacy.xml(?) in the AI-folder there are parameters that control their agression.

You can also tell them what to emphasize. But I think that only has a little impact on the order in which they build stuff.
0Send private message
12 years ago
Aug 16, 2012, 11:35:53 PM
Due to me starting to do the jailbreaking-thing I found out that apparently my changes to "AIParametersHero.xml" actually do nothing. smiley: frown

I guess that the settings of this file are just ignored as heros seem to be assigned however the AI feels like.

I will test later by setting all heros to be System heros.

My guess for as it stands now is, that the AI will assign them to Fleets anyways.
0Send private message
12 years ago
Aug 17, 2012, 12:49:57 AM
I agree it is kind of hard to tell whether that is working. I observed that, at least it did not cause any failure; since my first attempt did cause a failure (leaving out the other AI/Parameter files caused no colony ships to be built.) But I did not check carefully against your settings. I wonder if there is some logic which *reassigns* based on need. For example, if all the systems are built up, and many attacks are happening, the AI may move system heroes into fleets. Or it could just be random or stupid too.
0Send private message
12 years ago
Aug 17, 2012, 8:31:58 AM
I'm pretty sure that reassignements between planets are going on with the heros. Despite according to what this file suggests they shouldn't.

Going as far as calling it "based on need" is a tough call though.

What need could it probably have to have a level 4 ship-hero on a crappy system and a level 11 Admin/Corp with only Admin/Corp skills on the biggest fleet? (That's what the green AI from the save of the guy with that endless-setting did).
0Send private message
12 years ago
Aug 17, 2012, 2:00:20 PM
Ail wrote:
What need could it probably have to have a level 4 ship-hero on a crappy system and a level 11 Admin/Corp with only Admin/Corp skills on the biggest fleet? (That's what the green AI from the save of the guy with that endless-setting did).


OK, but that save didn't use your mod. I thought the point was that *using your mod*, the assignments would be better.
0Send private message
12 years ago
Aug 17, 2012, 2:27:01 PM
Yes, but when I tested around with the AI-Ship-Design stuff I also kept an eye on the other changes and found at least one occassion of an Admin/Corp to be assigned to a fleet.



While I might have overlooked one, I think the more likely scenario is that this file just does not do what I think it does. And I will make sure by turning ALL heros into system-heros and see what the AI does then.



A lot of the stuff we do here is making assumptions and then trying if they are true. There's so much to learn and totally open if or if not a change affects what one thinks it does.
0Send private message
?

Click here to login

Reply
Comment