@Devs: Sophisticated suggestions for AI improvements

4X strategy game from Proxy Studios

Moderators: Pandora Moderators, Slitherine Core

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

@Devs: Sophisticated suggestions for AI improvements

Post by Xilmi » Thu Jul 31, 2014 2:06 pm

Disclaimer:
Many suggestions are based on how I think certain mechanics work and thus there might be huge differences between how they appear to work for me and how they actually work. I beg your pardon for wrong assumptions caused by that in advance.

I will cover 4 major points of which I think the AI could be easily improved on. I will start with the ones that can be taken conclusions about the easiest when observing the game and will proceed to the more complicated and less comprehensible ones later.

Algorithms are written in pseudo-code, calling variables what I think is recognizeable as what is meant.

1. AI-Tax management

Current state:
There is no such thing as AI-Tax-Management right now. This can be easily seen when watching them play the game in observer-mode. All cities will run at the default of 50% or if they were captured from the player will stay at the value the player set them.

What this means:
Credits are a very useful resource to speed up the development of newer cities. Not reaping its full benefits is a big disadvantage.

Algorithm-suggestion on a city-per-city-basis:

Code: Select all

if(Science-Bonus*people_on_science + Mining-Bonus*people_on_mines + farming-bonus*people_on_farms + production-bonus*people_on_industry > tax-bonus*people_in_city)
{
  Taxrate=0;
  while(Income<0)
  {
    Taxrate+=5;
    Recalculate_Income();
  }
}
else
{
  Taxrate=100;
  while(Happyness<0)
  {
    Taxrate-=5;
    Recalculate_Happyness();
  }
}
Algorithm in words:
Depending on wheter the cities economic-benefit from more happyness or more taxes is bigger, the city should either use:
a) the lowest tax where the empire does not run into deficit
or
b) the highest tax where the people are not unhappy

2. AI-Production management

General observations:
The AI seems to hold a set of multipliers to determine how much it needs what.
Those are for example:
food, minerals, happyness, pollution, expansion, build, combat, bio, mechanical, flight, etc.

Most of those seem to be calculated by algorithms. For example "combat" is higher if less units are there and gets lower the more units the AI produces.
"build", seems to be an exception. I think it is a static multiplier.

Every buildable item, by which I mean the entireity of buildings, advancements and unit-components, has a "strategy-score" which can be composed of any combination of compartments matching the global multipliers.
For example:
A Trooper consists of 0.5 bio and 0.5 combat.
A Mining-Refinery consists of 0.5 minerals and 0.5 build.
A research lab consists of 1.0 build

Those are multiplied by the multipliers and the city then builds whatever has the best ratio of highest value in relationship to building-time.
The exact corelation with the building-time is not clear to me but it was observable, that the AI avoids things that take too long to build.

Current state:
Right now almost all items have a sum of 1.0 in strategy-score. In my Mod and the thread about that, I've explained why that currently produces very bad results. With the current configuration the AI will, most of the time, just build cheap units and neglect it's economical buildup with buildings.
This makes them fall behind dramatically in the later stages of the game and it's more or less: Either you die in their early-game-unit-swarm or you kinda got the game.

Modifying the strategy-score-values to a) increase the importance of buildings and b) set different-tiers of unit-components apart from each other, as I have done in my Mod, already dramatically improves overall and especially mid- and lategame performance of the AI. It is the easiest and most efficient way to improve the AI right now!

Value-tweaking:
I think that some value-tweaking is unavoidable here because certain implications from the devs when using certain strategy-scores doe not work out as they should.

Note that stuff mentioned here already is in my mod. I also won't go over specific values but just mention where I think the kind of strategy-score is wrong.

Happyness-Buildings:
Strategy-score for happyness seems to be multiplied with something depending on unhappyness. This causes happyness buildings never to be build while the city is not unhappy. But since happyness always boosts either your tax-income, productivty or both, it would be stupid to not build it just because you are not unhappy. Thus the happy-score should be replaced with "build"-score for advancements and buildings affecting happyness.

Barracks-buildings:
Barracks right now scale with "build" and "combat". I disagree with that. They should be entirely scaled with "combat" and their score should be higher than that of all units. Building units without the extra ranks provided by barracks is a huge waste of ressources.

Certain Advancements:
The advancements you unlock by killing a Leviathan and an Aspioch don't have any score at all, resulting in the AI ignoring them, even if unlocked. This apparently is stupid and can easily be fixed by just adding some.

As a general tweaking rule, I have made sure that building-scores are higher than unit scores. But for handling that I have a better idea based on an algorithm I'll get to next.
Also I have tweaked unit-components to gradually have a higher score for the newer ones. I know that 1.4.2 introduced a mechanism with the same purpose but my tests leave me in doubt it works. However, since production time also is a massive factor, the AI still not building good units could also be caused by it's lacking economy caused by ignoring buildings too much.

Algorithm to dynamically determine combat-value depending on cities development-state:

Code: Select all

Combat-multiplier=Combat-multiplier*(Existing Buildings total production-cost+1/(Unbuilt available Buildings total production-cost+Existing Buildings total production-cost)+1
(+1 on both sides to prevent division by 0)
Algorithm in words:
The multiplier for combat should undergo an additional modification based on the cities development state as follows:
The higher the value of existing buildings compared to the value of possible buildings is, the higher should the combat-multiplier and thus the likelyness of this city building units be.

This should result in new cities not trying to pointlessly build combat-units but focus on their economy first.

Example:
City 1 has a Mine(16), a Farm(16) and a Lab(24), which are all buildings currently available.
56/(56+0)=1
City 2 has a Mine a Farm and no Lab.
32/(32+24)=0.57, if it really wants units badly, it might still build them, but not as likely as City 1
City 3 only has a Mine...
16/56=0.29, very unlikely that this city will build units
City 4 has no infrastructure at all.
0/56=0, city will have to get some buildings first before considering to make units

3. AI-Tile-improvement-management

Current state:
Based on my observations it appears that tile-improvements to build are determined by nothing else but what kind of tile the Former is dealing with.
This clearly is a huge waste of potential as tiles which add production and research can tremendously boost a cities output.
According to the files in the "Features" folder, there is some kind of priority list in which order tile-improvemtns are built.

I've tried to give a conditional-increase in priority to groing fungus if the the fungus-improving advancements have been built. Not sure if it works but at least it doesn't crash upon starting. ^^ If it works as I think, I can post the modified contents of the according file.

However, I would definately add some algorithsms to change the tile-improvement behavior:

Algorithms in words:

For Grassland and Tropical Plains:
If in the whole empire no food is produced on a tile with less than 3 food and food-income is positive, then don't build another (useless) farm. Build instead:
One of the things that you would otherwise build on the non-tropical/grassland-plains. Those that passively boost the city like labs, factories, trading-posts or suburbs, if pop. There certainly also is a possibility to determine which of those the city would benefit from most.

For forrests:
If less than 33% of the empires non-farmer-population are mine-workers, then leave the forest there! This is especially meant to care about something like this: viewtopic.php?f=268&t=51307 where they chopped down their only sources of minerals.

For hills:
If more than 50% of the empires non-farmer-pouplation are mine workers, then don't build additional mines.
Yes, this case might be rare, but I've seen it happen before.

Build instead:
One of the things that you would otherwise build on the non-tropical/grassland-plains. Those that passively boost the city like labs, factories, trading-posts or suburbs, if pop. There certainly also is a possibility to determine which of those the city would benefit from most. Most likely factories in this case.

Fungus: As I said already: If the AI has all the fungus improving advancements built, it should replace all mines and farms with fungus but still consider that it doesn't need to have more food than pop or more production than it can spend.

4. AI worker-management

Worker management is perhaps the most difficult part for the AI and the player as well, of course. I think many things already work perfectly fine here. For example, I'm pretty sure that the AI does correctly pick the right amount of farmers and uses the best available tiles for farming.
However, the incident shown here:
viewtopic.php?f=268&t=51307, where the AI first chopped down all forests and then used more workers than minerals were available of course needs to be fixed.

One of the key things, however is the ratio between science and minerals/production. It is a no-brainer when minerals are scarce, then you obviously will just mine and sepend all minerals available and put the rest on science.

But in many circumstances there's plenty minerals and then it becomes a difficult question how many exactly you should mine and spend.
In this regard the algorithms need to consider diplomatic relations, military-strength and current state of research compared to the competition.

I would introduce a global and a local science-thirst-factor.

Let's say a factor of "1" means that in an avarage city the AI would aim for a 1:1:1 ratio of minerals, production and science
A factor of "2" means that it would aim for a 1:1:2 distribution.

Local affections of this factor could be similar to the "combat"-willingness but in addition consider the relationship of the science-bonus and the production-bonus as generated by existing buildings and a possible observatory.

Code: Select all

Local Science-factor=Global Science-factor*(Existing Buildings total production-cost+1/(Unbuilt available Buildings total production-cost+Existing Buildings total production-cost)+1
Local Science-factor=Local Science-factor*(Science-bonus+1/Production-Bonus+1)
(+1 on both sides to prevent division by 0)
This means that a city with buildings to build would be less willing to assign more scientists and that the existence of an observatory would make the city more likely to use more scientists.

As for the global science-factor it could start at 1 and be modified like this:
*2 if behind in science
*1/2 if behind in military
*1.5 for each faction with a good relation
*0.66 for each faction with a bad relation
and of course, if all techs are discovered it should be set to 0

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Thu Jul 31, 2014 4:50 pm

AI shouldn't grow fungus. It needs high tech and it's pretty inefficient even then. It's too complicated for AI to figure out whether to grow fungus or not. First get it running basic stuff and then you can worry about stuff like that.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Xilmi » Sat Aug 02, 2014 2:25 pm

According to further research the mechanism that calculates the multiplier for "combat", or "fight", as it is actually called in the XML-files, heavily reacts to the state of war.
As long as an AI is at war, it will much likelier produce units than buildings.

I think that the Alien-Agression-Event as well as the Messari-Event should also trigger some kind of a war state in that sense. The off-switch being the destruction of Hives/Portals.

This in combination with the local modifier depending on the amount of existing buildings should work very nicely and should also prevent what has been reported happening with my mod: AI dying to Aliens while building buildings.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sat Aug 02, 2014 7:23 pm

Megas wrote:AI shouldn't grow fungus. It needs high tech and it's pretty inefficient even then. It's too complicated for AI to figure out whether to grow fungus or not. First get it running basic stuff and then you can worry about stuff like that.
I have to disagree. With both the 2nd era and 3rd era tech improvements for fungus the fungus tile is the best you can get on Pandora. The only thing that should stop AI from planting some fungus tiles after completing both improvements are huge pollution problems and it should leave a path for movement between its cities. For the current AI it would be a huge improvement already if you'd simply let it plant 1-2 fungus tiles in every city when it completes both improvements without adding any algorithm to check how much fungus would give the best result. Terra Salvum could start with 1 improvement already because it gets +1 minerals there.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Sun Aug 03, 2014 12:23 pm

Fungus tiles are bad.

On T1 they're just useless.
On T2 with fungus mutagenesis they have 2 minerals and 2 food.
You also get terraforming earlier in T2 so you can turn any tile into a mountain for 2 minerals. All the water tiles have 2 food so you shouldn't have any shortage of those.
Those tiles don't produce any pollution and can have laboratory/construction bay/energy park for +3 research/production/credits.

Fungus is inferior because it can't have those improvements on it and it produces pollution.

On T3 with fungal hormones it has 4 minerals and 4 food but with mineral teleportation and food replication you've moved to post scarcity and you'll have more food and minerals than you can use even with base 2 tile yields.

Construction bays, laboratories and energy parks are much more valuable again.

Even when playing the eco faction fungus tiles are pretty bad simply because the above improvements are just so good.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sun Aug 03, 2014 3:35 pm

I have to disagree again.

Even if you compare to mountain mines and grassland/tropical with farms fungus is so much better because it provides two resources with a yield of 4 on ONE tile. This means instead of farms and mines you can build more factories and field labs. The math isn't complicated.

Let's compare:

6 tiles around a new city

1. with fungus

2 fungus yield 8 food and 8 minerals using 2 farmers and 2 miners
4 tiles can be used for factories with 4 workers which need 12 minerals
pollution: twice 0.4 (farmers), twice 0.6 (miners), four times 0.8 (workers), two fungus = 7.2

So the city could sustain itself until pop 8 with just those two fungus tiles and adding a T1 refinery and make 12 base production already without draining any resources from other cities. However, we would have two more points of pollution in comparison to the 2nd example. If we add a recycling facility and did research and build the -2 pollution tech we still have 1.2 pollution which reduces our yields by ~5%.

2. without fungus

2 mountains with mines and 2 grassland/tropical farms yield 6 food and 6 minerals using 2 farmers and 2 miners
2 tiles can be used for factories with 2 workers + 2 workers without factory which need 10 minerals
pollution: twice 0.4 (farmers), twice 0.6 (miners), four times 0.8 (workers) = 5.2

The city could sustain itself until pop 8 when adding a T1 food building and a T1 refinery and make 10 base production without draining any resources from other cities. We would need a recycling facility and the -2 pollution tech to have 0.0 pollution.


So city 1 would get almost 20% more base production because it could use four tiles for factories instead of two like city 2 and feed itself without any food building. It is easy to see that fungus is superior. If you add more mineral and food buildings then even a single fungus tile would be enough to sustain the city and you could even use 5 factories while having 6 workers (=17 base production). Also remember that not every city has grassland/tropical tiles and mountains so you would need a few more turns of extra terraforming to get the result.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Sun Aug 03, 2014 4:08 pm

Mixed resource tiles are very good in all other civ games but in pandora you have separate miners and farmers. So having 1 tile with 2/2 is no different from having one 2/0 and one 0/2. You require 2 workers to get 2/2 in both cases. The limit is number of workers not area around the city until the very late game. And don't make theories based on lategame with all techs researched because the game is already over by that point and as I said you have more food/minerals than you can possibly use anyway with mineral teleportation and food replication so 4 yield tile are a waste when 2 is more than enough.

You never build farms and mines after T1. You build laboratories, construction bays and energy parks that are much better.

Your math example is pointless and completely unrealistic.

Add +12 base food/minerals and +200% tile yield from buildings to your example to see how non issue mineral and food limits are in T3.

Make an example in T2 so see how outclassed fungus is.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sun Aug 03, 2014 6:04 pm

In Pandora up to three population units can work on one tile together. For example if you build a lab on a grassland hill a scientist, a farmer and a miner can work on the same tile (which isn't very useful is this case, but on t3 fungus it is). It is different than Civilization games where you get all resources from the tile with one population unit.

On a single fungus tile you can have one farmer and one miner bringing 4 base food and 4 base minerals home while a mountain with a mine and grassland with a farm only yields you 3 of ONE resource. So with your mountain+grassland strategy you need one more tile and still have a 25% smaller yield than fungus.

The limit is therefor not workers but (land) tiles with improvements. Having more field labs or factories will always be superior because each adds 50% value to one worker or scientist and this counts for all bonus modifiers the resource gets in the specific city too (observatory, lab buildings, morale, faction bonus/malus).

Analyzing the worth of fungus terraforming for the AI - which is the topic here - has to be made in 3rd era environment because only then fungus gets its 4/4 yield. For the time before the AI has both techs finished you can simply set the score to zero or maybe set a low score for Terra Salvum with only 1 of the two techs if it has huge problems with minerals and no hills in the city range. This is mostly a no brainer and doesn't have to be discussed. A T2 example otherwise is useless because you need both T2 and T3 fungus tech for it to be relevant. Earlier fungus simply isn't useful and should be automatically removed by AI formers.

It is quite obvious that you will have more buildings in the 3rd era. But it would unnecessarily complicate the example and wouldn't add any difference because you can build the same buildings in both cities for the same cost. It would only make the absolute gap bigger but it would still be almost 20% in favor of fungus when looking at the two cities above (a little less than 20% because you get the absolute bonus of +2 for each building regardless in both examples). It is therefor sufficient to concentrate on the differences.

To refer to your example: a 200% bonus (actually it is 175% but we can simply add 25% from morale for this example) would make a difference of 6 production in the above example (12 production + 200% + 6 (t1,2,3 building) = 42 production; 10 production + 200% + 6 (t1,2,3) = 36 production) = fungus ~17% better. This works only if we ignore food and minerals or assume enough minerals are provided by others cities to sustain production. (FYI t2 and t3 buildings also provide only +2 resource and not 4 or 8. This was patched long ago but the tooltip wasn't changed.)

When looking at minerals and food fungus is slightly more ahead in production (39 to 33 = 18%) and much better in overall efficiency because the no-fungus city has a small deficit in minerals and loses 3 production without help from other cities and has less food surplus (+7) and no potential for more (while fungus city has +3 minerals and +10 food surplus and can provide a lot more food easily).

fungus city

food:
1 farmer with 4 food + 200% + 6 (t1,2,3) = 18 food (10 food surplus).

minerals:
3 miners with 4 mineral per miner + 200% + 6 (t1,2,3) = 42 minerals.
42 minerals would be enough to sustain the cities production. However, we would have to add one more tile of fungus for the 3rd miner (we can use the free farmer here) which would cost us 3 production because of the factory we lose (1 worker produces 1 less production times the bonus of 200%, but we have still 1 more factory than the no-fungus city). But this also means we have 3 minerals surplus from this city and two more farmers could get us another 12 food each when the city grows or we suddenly need more food because of a city we conquered. The no-fungus city wouldn't be able to provide this.


no-fungus city

Now let's look at the food and minerals in the city without fungus. We only need one tile of grassland with farm but (at least) 3 mountains with a mine so we transform a grassland to mountain with mine. We can send the free farmer to mine as well as in the fungus city.

food: 1 farmer with 3 food + 200% + 6 (t1,2,3) = 15 food (7 food surplus)

minerals: 3 miners with 3 minerals per miner + 200% + 6 (t1,2,3) = 33 minerals (3 mineral deficit)



btw: If you don't build farms and mines after T1 you are doing it wrong. If you need more farmers and miners for food and minerals your science and production will be smaller because you have less people working in those categories. Always try to max out the yield from food and minerals with the smallest possible number of population in a single city with all important buildings for this resource. Then you can push more population into the important output jobs worker and scientist. If a single city isn't enough build another specialist for food or minerals. Actually with fungus a single city can be able to sustain your whole empire both for minerals and food at once. But never ever let all your cities work +2 tiles with factories or labs on it and build all the bonus buildings to get bigger yields as you seem to suggest above (please correct me if I misread). Energy parks are also one of the worst possible choices unless your city is still too small to use all its tiles for factories or field labs, simply because they don't get all bonuses while factories and field labs do.

And let's not forget that you can use formers for minerals and food too. T3 Fungus would be the best choice here as well.
Last edited by Zak0r on Sun Aug 03, 2014 7:22 pm, edited 14 times in total.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Xilmi » Sun Aug 03, 2014 6:54 pm

What I tried to make them plant fungus was this:

Code: Select all

	<modifiers>
		<modifier>
			<effects>
				<landscapePriority add="0.5"/>
			</effects>
		</modifier>
		<modifier>
			<conditions>
				<player>
					<attributes>
						<attribute name="FungusCultivation1"/>
					</attributes>
				</player>
			</conditions>
			<effects>
				<landscapePriority add="1.0"/>
			</effects>
		</modifier>
		<modifier>
			<conditions>
				<player>
					<attributes>
						<attribute name="FungusCultivation2"/>
					</attributes>
				</player>
			</conditions>
			<effects>
				<landscapePriority add="1.0"/>
			</effects>
		</modifier>
But it didn't work. I think it just increases their priority to remove it from 0.5 to 2.5 instead of actually planting it. I don't see how according to the XML file you would make them plant fungus at all. Also seeing how TS-AI doesn't chop forrests, without any hints as to why not in the XML-files I would think that certain behaviour is hardcoded.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Sun Aug 03, 2014 7:28 pm

My strategy is mountains + construction bays and ocean not grasslands. You can get all your food from oceans in T3 and use all land for minerals.
The limit of tiles is purely theoretical because you're never going to reach it in a real game.

Even if cities had only 2 rings each would have a workable 6 + 12 = 18 tiles. That would require a population of 18*2=36

Are you saying that every one of your cities has 36+ population and works EVERY single tile in the 2 hex radius?

And that's just with 2 hex radius. In reality you can work 3 hex radius around the city. Some of them cities may overlap but there is no way you can work all the tiles in your empire with 2 workers. The game ends long time before you can get enough population to utilize all those tiles and run into the limit.

Second problem is the cost of terraforming. You yourself admitted that fungus is before T3. So how do you get to T3 and Fungal hormones? Using farms/mines and other buildings of course.
So you get your fungal hormones. What will you do? Build an army of formers to grow fungus everywhere? You'll just destroy all that work you already put into terraforming simply because fungus tiles are 4/4?
How long will you work those fungus tiles? The game is already ending. It will be over before you can plant fungus in any reasonable quantity.
Better put the effort into your victory condition than a massive terraforming operation that won't be completed before the game ends.

Also. 4 food on a tile is worthless. You have all those ocean tiles that give you 2 food that you need to work because the tiles are very precious and they are what limits your production, right? To not utilize them would be a terrible waste.
Let's look at a coastal city along a straight coast. The city can work 6+5+4=15 ocean tiles. That's 30 base food. Add to that +175% bonus from 3 food buildings and you get 82. Add 6 from free food from those buildings too. You get 88. Add that's without morale bonuses. You can easily get 100+ with those. That's a single coastal city that only uses its water tiles.

How much pop will you have by the endgame? 200? Let's even say 300. That's 300 food you need. A single water tile gives you around 6 food with building bonuses. So you need just 50 water tiles to feed your whole gigantic empire. That's easily doable and you don't need to use a single land tile for food. You can terraform all land into mountains with laboratories/workshops.

Let's see how that compares against fungus.

Let's say we have 100 population for ease of calculations.

They eat 100 food so we need 100/6= 17 working water files to feed them. That leaves us the rest for mining/building.
All our tiles are mountains with construction bays.
One worker gives us 2 base minerals + 175% from buildings + morale = around 6 minerals.
Each of our workers gives use 3 production +175% from buildings + morale = around 9 production

That gives us ratio of miner/ worker = 9:6 or 3:2
So we take our 83 free population and set them as 33 workers and 50 miners.
Our total output is 297 minerals & production.

Now let's take fungus approach. With fungus we get

4 +175% + morale = around 12 food per farmer
4 +175% + morale = around 12 minerals per farmer
2 +175% + morale = around 6 production per worker

100/12= 9 farmers to feed our pop
That leaves us 91 workers+miners
Our ratio is 2:1
31 miners and 60 workers
our output is 360 minerals and production

It is higher but let's look at our pollution.
normal
17*0.4+50*0.6+33*0.8= 63.2 pollution
fungus
9*0.4+31*0.6+60*0.8= 70.2 pollution from population +31 fungus tiles = 101.2

So we get +20% output but for the cost of +60% pollution.
You can get -40 pollution in a city so you'll have to keep your cities under 40 pop but that's not a huge problem.
We also get that out of 31 tiles instead of 50.
Ok. Fungus economy is pretty good in a ideal situation.

However in reality it's just not worth it. You get +20% output in the absolutely perfect scenario. +20% is not bad by all means but let's look at the downsides.

1. You have to get to fungal hormones somehow and that will be with mountains+construction bays. Planting fungus after you get it will cost a ton of terraforming power that might not pay itself back before the game ends.

2. The +production building is much later in the tech tree than +food and +minerals. It's also later than fungal hormones. Normal approach has much more efficient workers because construction bays so it's affected by this much less than fungal economy. If you run the numbers with only +75% production instead of +175% normal economy will come out ahead. If you wait with planting fungus until nano manufacturing that leaves it even less time to pay itself back. Game is really almost over by the time you get that. It's just few % short of scientific victory.

3. The calculations don't include the free resources from buildings. With +6 free food every coastal city gets the farmer advantage fungus has is lessened.

4. If you include research the fungus gets more advantage. It has more pop available so diverting some to research affects it less.

3 and 4 about balance themselves. But the problem that it comes too late and needs too many techs to be effective still remains.

Overall I think that +16% output is not worth the effort of growing fungus everywhere when the game is almost over by that point anyway.

EDIT: I realized that fungus could get 15 construction bays for its workers too with the free tiles it has.
I can't be bothered to recalculate everything now but it would increase worker effectiveness by about 15/60= +25% so you'd save 12 workers. Which gives effectively you +4 miners and +8 workers. So your output is around 410 instead. That's +38% not +20%. Looks much better than before but I still think it comes too late to be viable.

EDIT2: I also now realized that normal economy works best with equal number of miners/workers because some construction bays aren't worked and are useless. Efficient split in this case is 39 construction bays and 11 mines with 39 workers and 44 miners. This gives us output of 351. So the fungus advantage is 410/351 = +16%

Disclaimer:My calculations rely on assumption that you never reach population density higher than 2 pop/land hex. That's a pretty reasonable assumption I think. Load a save from around the time you get fungal hormones and count it yourself.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sun Aug 03, 2014 8:25 pm

You're making some pretty ridiculous assumptions to make your example look better. Why shouldn't the fungus setup be able to provide factories for all workers? I have explained that it results in having more workers in factories (or more scientists in labs). Why are you denying this although the example is written above?

Yes, my cities are very big because broader expansion is punished by more costs for buildings which means you have less potential for science and units. In the late game cities up to the max habitat limit are pretty much standard in my games. It is much more efficient than having a lot of smaller cities.

The cost of terraforming with the terraforming advancement from T1 is 4 turns on normal speed and 3 turns on high speed (1 turn to remove the improvement + 3 or 2 for planting the fungus)

To refer to your 100 worker example. To feed 100 pop we would need a single city with at least 7-8 fungus tiles and 7-8 farmers depending on morale. Doesn't sound like too much terraforming to me for the first step to get the food done. Also it means you don't need any food buildings in your other cities.

3. This means you have 92 pop for other jobs.

Miners provide ~12 minerals each on fungus and workers with factories provide ~9 production each. This means you need 3 miners for every 4 workers.

Obviously we can't pull out 40 fungus tiles at once so let's see how it looks gradually.

Stage 1

If we go with those 8 fungus tiles from the change in our food production we will need
8 miners on fungus = 96 minerals
44 miners on +2 tiles (mountains with factories) = 264 minerals

they can provide 40 factory workers with minerals for 360 production

360 minerals and 360 production is a 21% increase to your setup with only 8 tiles of fungus.

Stage 2

However, if we take into account that we will not have aimed for your setup in the first place and most likely still have mines on our mountains from previous T2 terraforming we would see an even greater increase. We only need around 40-52 factories max. Which leaves us with 40-52 tiles for other stuff than factories, including ocean.

So if we assume we have enough mined mountains for all needed miners we get this:
8 miners on fungus = 96 minerals
37 miners on mountain mines = 333 minerals

they can provide 47 factory workers with minerals for 423 production.

429 minerals and 423 production is a 44% increase in minerals and a 42% increase in production compared to your setup. If we have too much ocean tiles to build factories for all workers then the number of +2 miners will be somewhere between Stage 1 and 2. But in every case even with only 8 tiles of fungus we're not talking about only 20% increase anymore.

Stage 3

Now we can gradually increase our output by adding more fungus up to a maximum of 40 tiles needed.

40 fungus miners yield 480 minerals
They can provide 52 factory workers for 468 production.

This gets us an output of 468 production and 480 minerals is 58% better for production and 62% better for minerals.

The 40 miners need 40 fungus tiles obviously so if you have a lot of ocean you might run out of space for enough factories for your workers and you will need some time for the terraforming. Good thing it doesn't cost much more than time, what would you do with your formers anyway when your T2 setup is complete? Why not gradually boost it even more? Even 52 workers without a single factory would produce 312 production which is more than your setup. So you see that even in the worst circumstances there is no way a fungus setup, gradual or full, could be worse than your setup.

The up to 40 additional units of pollution will be easily absorbed by the t1-3 pollution buildings in your cities if you spread it smart between them (e.g. fungus, farmers and miners in two cities and all workers with factories in two other cities). You can also build some purifiers. If we assume we have no ocean tiles in the above setup - which is entirely possible on pangea or big maps - we have still 8 tiles left without any factory or fungus.


And this is just for food, minerals and production. If you add science to the equation you will have an even greater boost because the food part of the fungus will be used more efficiently.

To get back to the main topic: It should be obvious now that an AI that builds or uses a few T3 fungus tiles would be superior to one that doesn't utilize them.
Last edited by Zak0r on Sun Aug 03, 2014 8:43 pm, edited 1 time in total.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Xilmi » Sun Aug 03, 2014 8:42 pm

You put in quite a lot of effort into discussing something I consider quite a minor concern because of what has already been pointed out: It comes so late in the game that it probably won't matter much. In the last game I won I made maybe 3 or 4 fungi before I had the tech-victory.

It would be an issue if one plays without tech-victory and the game would still not be decided otherwise by then.

The whole issue is just a sub-aspect of of the 4 greater aspects I brought up.

Right now the AI clearly isn't fit for post-tech-victory-play. It doesn't do terraforming of any sort and way worse than that: It doesn't stop producing research when the tech-tree is fully reseached.
Funnylie enough a late-game war is so devastating for the planet, that you can't even think about planting fungi. You need all Formers to remove Fallout from Blackholes and Nukes.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sun Aug 03, 2014 8:46 pm

I wouldn't discuss it that much if Megas wouldn't have made totally wrong assumptions about it. Of course the fungus gets strong very late. But it doesn't change the fact that it is strong and should be used by the AI (and players) as soon as both the techs are available. For me it was obvious right from the start how much better fungus is. I just did the math to show it to Megas and potential other readers who might be mislead otherwise. Also I'd like to add that people playing without tech or economic victory are quite common.

Also if we're speaking about devastation I might add that you also will have to rebuild your non-fungus improvements in this case. Why not choose fungus then if it is far superior?

Also you forget one important fact: Fungus already is on the planet and can be used without terraforming.
Last edited by Zak0r on Sun Aug 03, 2014 8:59 pm, edited 1 time in total.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Sun Aug 03, 2014 8:51 pm

I estimated pop limit density at 2 pop / land tile. You shouldn't really reach it but you can get close. So you have around 50 tiles to work with 100 pop. I included fixes in EDIT notes.

You can't have construction bay and fungus on the same tile. In stage 3 you'd need 92 tiles for 40 fungus + 52 construction bays.

With 84 tiles normal can get
42 workers
42 miners
each at 3 base
= 42*9=378 output

fungus is only 468/378 = +23%

Getting fungal hormones is not enough. You also need nano manufactoring so you can deal with lesser numebr of construction bays and atmosphere processors to deal with the pollution. Both of those are further in the tree than fungal hormones.
Without them normal economy is better.

Yes. Fungal economy is better with all techs. You pay for that in bigger pollution however. It's not a huge cost but it will force you to get those few -pollution building extra. It's also taking up your formers that could just be mining your tiles to save you workers instead. Biggest issue is that it comes so late that the game is already pretty much over by that point.

And even after that it's better by only around 15-25% so it's not like it's leaps and bounds better. Normal economy can compete just fine.

For AI development however the focus should be on making it work better with normal economy that's used in T1, T2 and most of T3.

Once it can handle that well enough and we can start thinking about giving it fungus algorithms. Until then just keep the score at 0.
Last edited by Megas on Sun Aug 03, 2014 9:06 pm, edited 1 time in total.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sun Aug 03, 2014 9:05 pm

And again those assumptions. 50 tiles for 100 pop might be realistic for a bad archipelago map but not for a normal game.

I wrote a paragraph about the pollution. Please read it.

Formers mining don't get any bonus on their yield. This means you need 3+ formers to make up for 1 pop. Not a real issue.

It is better by 20-60% from the point of the change in food production when starting from your setup up to the maximum in minerals, not 10-30%. Getting 8 fungus tiles will probably take you ~10 turns. Please read my post carefully.

Also I have noticed you have changed your setup now to a 3 base for mining. So now you want to make your setup look better by getting closer to my proposed setup. I consider this as approval.

Basically your only argument left is that it comes very late and that the AI has other problems to fix first. I don't deny any of this. But you are simply wrong about the superiority of a fungus economy. There simply isn't anything better.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Sun Aug 03, 2014 9:11 pm

Assuming 100 tiles per 100 pop it's

normal
16 food
42 workers
42 miners
378 output
84 tiles

fungal
7 food
40 miners
53 workers
477 output
93 tiles

477/378 = 1.262 = +26%

The less tiles per pop the smaller difference gets. At 50 tiles it's +16%

Yes, it is better but not by much and it comes too late. The game is already lost or won by that point basically.

EDIT: I could squeeze out a bit more out of normal by switching farmers to 3 yield greenland farms from 2 ocean but I can't be bothered.
Last edited by Megas on Sun Aug 03, 2014 9:18 pm, edited 1 time in total.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sun Aug 03, 2014 9:17 pm

Megas wrote:Assuming 100 tiles per 100 pop it's

normal
16 food
42 workers
42 miners
378 output

fungal
7 food
40 miners
53 workers
477 output

477/378 = 1.262 = +26%

The less tiles per pop the smaller difference gets. At 50 tiles it's +16%

Yes, it is better but not by much and it comes too late. The game is already lost or won by that point basically.
What are you still argueing for? By adjusting your personal setup you indirectly approved mine but you now use that improved version and juggling with tile numbers to argue that the gap is smaller.

I never denied that fungal economy comes late in the game. You were the one who brought T2 into the discussion. I said right from the start that we are talking about T3. And I posted above that games without science and/or economic victory are quite common.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Sun Aug 03, 2014 9:22 pm

Yes. Construction bays only are inefficient. You need some mines too. I realized that doing the calculation. Thanks for that. It's still considered normal economy and it should be considered for the benchmark because it's most efficient non-fungal variant.

I learned that fungal economy is actually better in late T3 and you learned that it's not that much better though. We're both smarter now. Great.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Zak0r » Sun Aug 03, 2014 9:33 pm

Ok, the benchmark is a valid point. I give you that. :)

We are still talking about a 12 % increase for 8 fungus tiles (remember, you can also use existing ones) up to ~25% when comparing to the best normal economy and all you have to do is gradually adding fungus tiles with formers that would be without work anyway. You can also do this by simply expanding your cultural borders into fungus at the right moment. And our whole calculation didn't even account for the savings in buildings. In the setup I mentioned in the paragraph about pollution you only need 1 city with all food and mineral buildings. Another city with all mineral buildings. And two cities with all production buildings. (+pollution, habitat, morale in all 4 obviously). The normal setup suggested by you probably needs at least all food buildings twice and maybe also more mineral buildings.

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

Re: @Devs: Sophisticated suggestions for AI improvements

Post by Megas » Sun Aug 03, 2014 9:36 pm

Regarding building.

You only need +food in the one coastal city with 16 water tiles.
+minerals in cities with mines
+production in cities with construction bays

I think you come out a bit ahead in buildings with normal because you don't need so much -pollution but it doesn't matter because with a massive output like that it's negligible.

Post Reply

Return to “Pandora - First Contact”