Logo Platform
logo amplifiers simplified

AI Modding

Reply
Copied to clipboard!
12 years ago
Aug 24, 2012, 1:55:35 PM
In PlanetInfrastructure.xml...



[CODE]

PlanetaryImprovementFood1

$(PlanetStatusColonized)

$(../ClassStarSystem:Population) lt $(../ClassStarSystem:MaxSystemPopulation)[/CODE]



... the above means that the AI will always use a food exploitation as long as the system Population is less than MaxSystemPopulation, correct?



My question is whether there's a way to set it up so that the food exploitation will be used as long as the system Population is less than, for example, 80% of MaxSystemPopulation?
0Send private message
12 years ago
Aug 24, 2012, 2:04:56 PM
Interesting point. It "should be possible" to just throw a "0.8 *" in there:

[code]

$(../ClassStarSystem:Population) lt $(0.8 * ../ClassStarSystem:MaxSystemPopulation)

[/code]

But, if you make only this change, then up till 79% of max pop, all exploits will still be food, and at 80%, none of the exploits will be food. This is different, it is debatable if it is better.
0Send private message
12 years ago
Aug 24, 2012, 3:22:08 PM
I think like 6 pages of this thread ago we already figured that operators like +,-,*,/ don't work in these kind of statements. Otherwise I would have long since done that!



ThorTillas also confirmed that they don't work yet in the Thread "Question for ThorTillas".



He said that they will most likely implement something like that soon and he also suggested a different approach to do that.



As a sidenote: Limiting food-buildings was exactly the same example that he used himself. Only it was MaxPop*0.6 instead of 0.8.
0Send private message
12 years ago
Aug 24, 2012, 3:30:35 PM
davea wrote:
This is different, it is debatable if it is better.




I realize that. But it would stop the AI from going omni-food for longer periods of time in systems with higher number of planets. There's also the problem of queuing optimal exploits alongside a colonization once the system reaches MaxSystemPopulation and then reverting everything to food exploits, thereby wasting a turn every time a new planet is open to colonization (you can confirm this behaviour by using governors).



Having an additional +2/+3 to IDS is sometimes preferable to having a minutely faster growth rate.
0Send private message
12 years ago
Aug 24, 2012, 3:33:59 PM
The best thing would be a formula that calculates growth rate. Because that way one could see: "I grow in 2 turns anyways, no need to specialize for food"
0Send private message
12 years ago
Aug 24, 2012, 3:59:55 PM
Ail wrote:
I think like 6 pages of this thread ago we already figured that operators like +,-,*,/ don't work in these kind of statements.


Yes, any time I make a silly statement like "it should be possible", I should just stop and delete the line before posting. Attempting to find "logic" in what works and what doesn't is painful, and often pointless.



The goal we are going after is avoiding a huge number of food exploits. Is it possible to count food exploits in a system, and never have more than, say 2?
0Send private message
12 years ago
Aug 24, 2012, 6:12:05 PM
I somewhat disagree about that goal. The easier and probably more effective way would be to treat food-exploits just like the others instead of "enforcing" them, what I currently do.

Counting buildings/exploits of one type should be possible by the way described by ThorTillas.



(($(PlanetTypeTerran) or $(PlanetTypeWater) or $(PlanetTypeJungle) or $(PlanetTypeTundra) or $(PlanetTypeArid)) and ($(../ClassStarSystem:Population) lt $(../ClassStarSystem:MaxSystemPopulation) or $(../ClassStarSystem:FoodSurplusToProductionBonus) gt 0) or $(../ClassStarSystem:FoodSurplus) lt 1



could be the new line.



I will explain.

There would be 3 conditions that allow food-exploits:

a) On Planets with Bonus-Food when Pop < Maxpop

b) On Planets with Bonus-Food when FoodSurplusToProductionBonus > 0 (this means the system has the food => industry-building)

c) On all Planets when the system does not grow



For the other exploits I would then change

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

to:

$(../ClassStarSystem:FoodSurplus) gt 0

so they could be built all the time unless the system is starving.
0Send private message
12 years ago
Aug 24, 2012, 6:29:32 PM
I guess we have to agree on the goal and then intersect the goal with what we can achieve in modding. Here is how I play. When I colonize a new system, I put the first planet on food -- even if it is arctic or lava; we need all the food we can get.



If I colonize additional planets in the system and it is still growing, I put the one "best food" planet on food exploit and any remaining on industry. This is because I still need to build a lot of buildings, and I need the industry to do that. One could argue that when the system is growing, it should be 50/50 food/industry. But, we do not want a situation where the system is growing, and *none* of its planets are on food. Even if there is no tier 1 or 2 planet, we need some food coming in.



When a system has reached full pop, with all the planets I want to colonize, and there are no new techs coming up which will increase pop cap, then I consider the system "closed". Then the system gets specialized as either forge or science or dust, based on what race I am and what victory I am pursuing. I change all the exploits to that, and I actually rename the system so I can see this from the empire view. Others may feel that once the system is "closed", each planet should be assigned to its optimal exploit so you wind up with a mix of science, dust and industry income; the total empire FIDS is higher, and I have no objection to that. It just isn't the way I play.



Can we agree on this goal, or a similar goal? Then we can find a way to implement the goal, or something close to the goal.
0Send private message
12 years ago
Aug 24, 2012, 6:39:25 PM
Actually I'd like to hear more about specific exploitation-strategies from otheres. Preferably players who play and win on endless-difficulty.

Thing is: what I have implemented currently was exactly how I developed the systems. "Pop till Lilmit, then take what gives most ids."



And as I can see it differs quite a lot from what you do. So since this is so different, I'd really like some experts opinions.



So any "Pro" up to help us here and tell us how he uses the exploitations?
0Send private message
12 years ago
Aug 24, 2012, 7:00:44 PM
Do you really find on midsized systems (1+ planets but not full) that you would rather have a little more food rather than a little more industry? That is the only important place we differ. I doubt many people who are not already modders will stop by here, to collect the info you may want a top level thread.
0Send private message
12 years ago
Aug 24, 2012, 7:35:46 PM
Since all exploitations scale with population, I was thinking that getting it up ASAP might be a good idea. And they indeed do grow really fast when you set every planet to the food-exploit.

You are right, elsewhere there might be some more people willing to discuss the best exploitation-strategies.
0Send private message
12 years ago
Aug 24, 2012, 8:29:07 PM
I've started going for forge system as much as possible with the determining factoring being terraforming capabilities. Early game I'll go for individual planet exploits as I don't have the terraforming abilities /shrug I'm far from a expert player.
0Send private message
12 years ago
Aug 25, 2012, 10:28:51 PM
Ail, I've got another question. See, I want to limit food exploitations to tier1 and tier2 planets only, for both the human player and the AI (for the purposes of balance and common sense (farms on asteroids?!?, not on my watch)).



I was thinking about the following, but I'm pretty much a rookie when it comes to these things, so I wasn't sure if it'd be valid...



I was looking to change this...





PlanetaryImprovementFood1

$(PlanetStatusColonized)

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



%PlanetaryImprovementFood1Title

%PlanetaryImprovementFood1Description









... into this...





PlanetaryImprovementFood1

$(PlanetStatusColonized) and ($(PlanetTypeTundra) or $(PlanetTypeArid) or $(PlanetTypeTerran) or $(PlanetTypeOcean) or $(PlanetTypeJungle))

$(../ClassStarSystem:Population) lt $(../ClassStarSystem:MaxSystemPopulation) and ($(PlanetTypeTundra) or $(PlanetTypeArid) or $(PlanetTypeTerran) or $(PlanetTypeOcean) or $(PlanetTypeJungle))



%PlanetaryImprovementFood1Title

%PlanetaryImprovementFood1Description









... and I'd do the same for other food exploitations. Would that accomplish what I want?
0Send private message
0Send private message
12 years ago
Aug 26, 2012, 3:42:37 AM
Ok, now that I have your attention, I have one more thing to ask.



The changes were great and the AI handled them beautifully... except certain factions. After the first test, I removed the $(../ClassStarSystem:Population) eq $(../ClassStarSystem:MaxSystemPopulation) on ind, sci and dust exploitations because the AI would simply leave them without one until the system reached maxpop. But, that created a conflict. For example, on a jungle planet in a system that's below maxpop, the AI would have to choose between the food exploitation and the optimal one (industry)...



$(../ClassStarSystem:Population) lt $(../ClassStarSystem:MaxSystemPopulation) and ($(PlanetTypeTundra) or $(PlanetTypeArid) or $(PlanetTypeTerran) or $(PlanetTypeOcean) or $(PlanetTypeJungle)) - for food exploitations



... and...



$(PlanetTypeLava) or $(PlanetTypeGasMethane) or $(PlanetTypeAsteroids) or $(PlanetTypeJungle) - for industry exploitations



As I've said already, only certain factions had trouble with choosing (I tested a couple of matches whilst playing with the Amoeba, so I could monitor their exploitations from the start). Sowers, for example, never chose the food exploitation whilst the Pilgrims and the Hissho used it very rarely. Other factions performed admirably, that is, they'd use the food exploitation as long as the system's pop was not maxed and then they'd switch to the optimal one.



If I haven't bored you to death by now, my question...



Is it possible to add separate conditions to the AIPathsPrerequisites? For example, I'd like the AI to always use food exploitations on tier1 and tier2 planets as long as the system's pop is not maxed and then switch to the optimal ones once it is maxed, whilst using the optimal exploitations on other planet types at all times.



Let's take PlanetaryImprovementIndustry1 for example. I'd like to combine this...



$(../ClassStarSystem:Population) eq $(../ClassStarSystem:MaxSystemPopulation) and ($(PlanetTypeTundra) or $(PlanetTypeJungle))



... with this...



$(PlanetTypeLava) or $(PlanetTypeGasMethane) or $(PlanetTypeAsteroids)



Is that possible? If so, could you "spell it out" for me, because I have no idea how to combine the two... smiley: alder
0Send private message
12 years ago
Aug 26, 2012, 1:39:50 PM
In the new version of Better_AI I have a completely new algortihm that can and will use other exploitations than food on planets that are not maxpop.

It required some more work than one might think at first. I had to introduce new variables to put a good logic into that. Took me roundabout 6 hours mainly of trial-and-error-testing to get it to work like I wanted to.

I think what you want to do is about the same...



Note that what you write in the Prerequs is not telling the AI what to choose, but telling it when it is not allowed to choose something.

So if you want to make it choose between Food and Industry, you have to forbid Money and Science.

For your jungle-example:



Food:

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



Industry:

... (nothing to add here!)



Money:

!$(PlanetTypeJungle)



Science:

!$(PlanetTypeJungle)



This way the AI is free to choose between Food and industry as long as the Pop
Look at the new AI-Mod to see how I realized it in particular.



As for the factions. See the Personality.xml for that:



Sower:



0.8

1.5

1

1

1

1

1



Pilgrim:



1.1

1

1

1

1.1

1

1.2



Hissho:



1

1.4

1

0.8

1

1.4

0.8



Horatio:



1.4

1

1

0.8

1.2

1

1



As you can see there are differences into what they prefer racewise. If one kind of behaviour here seems to be sub-ideal you can tweak it at this point.



To your second question: Of course that is possible. It is close to what I've done myself.



Just forbid them to build food on the non-tier1-food-planets. Same as I said before. It's not about allowing them something to do it's about forbiding them. So to achievhe what you want you don't edit Industry, you edit everything else!



Should look like that:



Food:

$(../ClassStarSystem:Population) lt $(../ClassStarSystem:MaxSystemPopulation) and !($(PlanetTypeLava) or $(PlanetTypeGasMethane) or $(PlanetTypeAsteroids))

Money:

!($(PlanetTypeLava) or $(PlanetTypeGasMethane) or $(PlanetTypeAsteroids))

Science:

!($(PlanetTypeLava) or $(PlanetTypeGasMethane) or $(PlanetTypeAsteroids))



So since everything else but industry is forbidden for Lava, Methane and Astroids you leave them no choice but to put them on Industry.
0Send private message
12 years ago
Aug 26, 2012, 3:37:43 PM
Thanks, but I did this way and it works as well, for all factions (food on tier1 and tier2 below maxpop & optimal at maxpop; optimal for other types at all times).



Food:



$(../ClassStarSystem:Population) lt $(../ClassStarSystem:MaxSystemPopulation) and ($(PlanetTypeTundra) or $(PlanetTypeArid) or $(PlanetTypeTerran) or $(PlanetTypeOcean) or $(PlanetTypeJungle))



Ind:



$(../ClassStarSystem:Population) eq $(../ClassStarSystem:MaxSystemPopulation) and ($(PlanetTypeTundra) or $(PlanetTypeJungle)) or $(PlanetTypeGasMethane) or $(PlanetTypeLava) or $(PlanetTypeAsteroids)



Dust:



$(../ClassStarSystem:Population) eq $(../ClassStarSystem:MaxSystemPopulation) and ($(PlanetTypeTerran) or $(PlanetTypeArid)) or $(PlanetTypeDesert) or $(PlanetTypeGasHydrogen) or $(PlanetTypeAsteroids)



Sci:



$(../ClassStarSystem:Population) eq $(../ClassStarSystem:MaxSystemPopulation) and ($(PlanetTypeOcean)) or $(PlanetTypeArctic) or $(PlanetTypeBarren) or $(PlanetTypeGasHelium) or $(PlanetTypeAsteroids)



I felt like a goddamn hero once I figured it out. smiley: money



EDIT: another thing that I'm curious about... does adding an exclamation mark before the dollar sign basically tells the AI "DO NOT TOUCH!"?
0Send private message
12 years ago
Aug 26, 2012, 5:51:32 PM
Well done! smiley: smile



Exclamation-Mark is a logical "NOT".

For example if you want to allow something to be built on all PlanetTypes but one or two you don't need to list all the ones you allow it on but say !($(PlanetTypeLava) or $(PlanetTypeJungle)) so it is allowed to build this on any planet but Lava or Jungle.
0Send private message
12 years ago
Sep 4, 2012, 7:48:17 AM
On your question about general exploit strategy, I have a method which seems to work fairly well but might require too much of a "big picture" outlook for use by the AI in determining exploit choices.



My overall strategy requires two unique types of systems: specialist systems which focus solely on one of cash/science/production located at "appropriate" regions of my area of influence. The "best" potential industry system near the frontlines becomes the forge system for that front - I generally have one "main" forge and then one "secondary" forge near each additional chokepoint area if there are multiples, as there often are on the larger or non-spiral map types. One "bank" system as far to the rear as I can find a suitable system, this system is chosen specifically for reasonable early growth speed as WELL as long term maximum population. An additional "bank" system is chosen for each map size category above medium. The bank system(s) is/are the focal point(s) for trade-route structures, cash-production exploits, and corp heroes. Then at least one "dedicated" science system per bank system, which prioritizes science and pop growth improvements exclusively, and when neither of those categories (or blanket improvements) are available it sits on indu-sci. The only exceptions are production improvements necessary to keep a "reasonable" rate of producing new tech improvements, and happiness improvements if they are under 85% system approval or would be pushed to be by colonizing a new planet type such as a gas giant in the system. Obviously, if you get a moon temple with a system-wide bonus to trade routes and/or science, these make excellent starting points for those specialist systems, or at least a secondary if the moon shows up in a system with a low overall max pop potential after terraforming possibilities.



After that, the remainder of the systems get a food exploit as first planet (unless current and near future max pop is 10 or less for the entire system), followed alternately with industry and food exploits, colonizing in order to get the best results from that when possible, but keeping the exploit order regardless even if being less than ideal colonization order to grab strategic/lux resources or avoid bad approval penalties before the appropriate techs are researched to either remove the anomalies or give blanket boosts to system happiness.



Once reaching 75-80% of max system pop with current or near-term tech levels, I pick the best food production planet in the system I have and leave it with farms (even if its base type is not an ideal food production planet type) and the rest of the planets all get the exploit which will yield max IDS per planet (ignoring food bonuses at this point).



Paired with an alternating indu/food system production order, always prioritizing rainbow improvements, and only building happiness improvements when system approval is below 85%, this method gives you overall a few very high, very specialized systems for large projects, and/or sustained base levels of cash/science, while letting your lesser systems shuffle the load as needed between lightweight ship production, cash flow, science, etc. Unlike a pure industry-based balancing of the dust/science budgets, this allows you to slip in a needed system improvement or put out a couple picket/scout ships/fleets from a number of systems at once spread around as needed without having say, an entire "lesser bank" system go down at once due to overexpansion or combat losses...



The total absolute FIDS numbers are not quite as high as some more specifically optimized setups, especially as you end up paying support costs on a larger range of improvements in each system, and have some competing goals in build order, but the flexibility this approach gives you tends to actually end up with a net faster overall production and development rate in much the same way that building balanced destroyers one at a time is not as tonnage efficient as building balanced battleships, but you get the use of a slightly less effective force, slightly sooner in time. Whether this will work best for the AI I have no idea at all, but I know it works for me AGAINST the AI, so it's got to be better than what they are currently doing at least smiley: wink
0Send private message
12 years ago
Sep 4, 2012, 8:04:04 AM
Your post came a little late. I'm pretty much done improving the building/exploit selection for now and I'm pretty content with it.

However, there's other and more impactfull issues that hinder the AI a lot more than this.

We continued discussion about it in another thread.
0Send private message
?

Click here to login

Reply
Comment