City Growth

The algorithm is basically using the difference between current population and the potential population supported by food supply.

But that's not how it works in the real world.  Real populations grow until they exceed food supply and then individuals start starving or dying from their toxic garbage.

Real growth is actually an exponential function dependent on current population.  In simple terms, the growth rate is proportional to the current population.  Some human populations stop growing due to sociological factors.   Affluence is the usual negative factor.  In terms of LH, more food would mean less growth!

16,593 views 23 replies
Reply #1 Top


But in Elemental the population growth doesn't come from new births. It comes from people leaving the country and coming to your city, as they hope they will have a better life there. So in that context it makes sense. Something like "There is plenty of food, you may move to that city."

Reply #2 Top

Real growth is actually an exponential function dependent on current population.
End of quote

False... it is slightly more complicated than this... it is usually modeled by an exponential function because that is the easiest to demonstrate and for most situations without limiting factors it will resemble something close to this function. The actual function looks more like an inverse tangent function shifted (a Z shape), where the top of this Z is your cap to the population. Stardock did a fine job modeling it here.

Reply #3 Top

I actually really like the city growth system. I have no issues with the way it is currently, and I never look at a city and say: "Wow, I think it's unreasonable that that city's growth rate is so low."

I do think as things stand it's extremely difficult to get a city to level 5, but I'm fairly certain that's intentional. Getting to level 5 is a major achievement, and should be treated as such.

Reply #4 Top

The main problem at the moment is the 'queued pioneers' exploit.

I love growing my cities to level 4 and 5, but often the reward for doing so is quite disappointing and feels like an anti-climax.

Reply #5 Top


The queued pioneers exploit would be solved if pioneers required food instead of population. Don't know if that's possible with the engine right now.

Reply #6 Top

Actually, shouldn't pioneers require pop, and food? 

Reply #7 Top


Yes, I think so. Pioneers should reduce food of the parent city by until they settle. That way the effect on the parent population would not recover until the Pioneer has settled.

Reply #8 Top

Quoting OliverFA_306, reply 5

The queued pioneers exploit would be solved if pioneers required food instead of population. Don't know if that's possible with the engine right now.
End of OliverFA_306's quote

Very interesting!

 

Reply #9 Top

I also like the idea of units requiring food as a support but like OliverFA_306 said it may not be possible with the engine the way it is.  I know he has been trying to implement something like this for a little bit.

Reply #10 Top

I don't see why they couldn't just subtract the population once the pioneer is constructed, instead of when it is added to the que.

I don't have a problem with growth, but I do agree with Pink that it is very difficult to get a city to level 5. In half a dozen games, I don't think I've ever done it. The problem may be I like small kingdoms, and usually only have 3 or 4 cities. This limits my farm towns. A way to balance city growth to make small empires viable would be nice.

Reply #11 Top


Is there a location in the code where you can change at what levels cities will level up at?

I'm wishing to play with the figures....if possible...

 

Reply #12 Top

Quoting GFireflyE, reply 11


Is there a location in the code where you can change at what levels cities will level up at?

I'm wishing to play with the figures....if possible...

 
End of GFireflyE's quote

In the Core Improvements folder, the file CoreImprovements.xml, look for the CityHub1 improvement. You will find a <GameModifier> of the type LevelBarrier. There, you can change the values.

However, I should warn you about the effect for the AI. Each city level has a tag, that is used by the AI to know how to behave regarding that city. In the mod I am doing I changed Level 2 barrier from 50 to 100 and the result was that the AI never constructed grain improvements, as it seems that it's something that the AI is coded to do at level 2. Then I created a 1.5 level from 50 to 100 with the same AI tag as the level 2 and then AI players started to behave like before.

Reply #13 Top

Quoting halmal242, reply 9

I also like the idea of units requiring food as a support but like OliverFA_306 said it may not be possible with the engine the way it is.  I know he has been trying to implement something like this for a little bit.
End of halmal242's quote

The problem is that food is a resource stored at the city level, and units can only produce global resources. There are two possible workarounds:

- Create a new resource, something like UpkeepFood which is global and make each city produce one UpkeepFood per Food. Then you can have units requiring this new resource as a prerequisite. It won't have any effect on the real food, but can be used as a way to effectively cap the player's army as a whole depending on his economy.

- Use the A_ADDITIVE_Resource command, but this command does not work in normal units, it only works in champions. So you must be ready to cope with the inconveniences that this approach creates, such as champions not dying and having to do a complicate workaround to kill them on the next fight after they were "killed", creating dummy traits for the level ups, and other things. I am trying this approach right now. I am not sure if I will succeed, but I do it for fun and I am having a lot of fun trying to mod the game, despite the ocasional moments of disapointments.

Reply #14 Top

Good grief that is annoying. Why can't we just link the resource reduction for a unit to a cities food such as the specialist system back in E:WoM.  This is one thing I am finding over and over again I would like to see make a come back as it was a direct reflection of how much a city could support food and money wise since units were directly tied to a city.

Reply #15 Top

Quoting OliverFA_306, reply 12



Quoting GFireflyE,
reply 11


Is there a location in the code where you can change at what levels cities will level up at?

I'm wishing to play with the figures....if possible...

 


In the Core Improvements folder, the file CoreImprovements.xml, look for the CityHub1 improvement. You will find a <GameModifier> of the type LevelBarrier. There, you can change the values.

However, I should warn you about the effect for the AI. Each city level has a tag, that is used by the AI to know how to behave regarding that city. In the mod I am doing I changed Level 2 barrier from 50 to 100 and the result was that the AI never constructed grain improvements, as it seems that it's something that the AI is coded to do at level 2. Then I created a 1.5 level from 50 to 100 with the same AI tag as the level 2 and then AI players started to behave like before.
End of OliverFA_306's quote

Thanks for the heads up. That's exactly what I was about to try and do.

Want to have the city level up at 100, 200, 300, and 400 in interval. The fact that the AI behaves differently with different city levels is very important.

 

Reply #16 Top

Alright looking at the CoreAIDefs file I can't see why the AI won't build food improvements at level 1 cities as they are weighted pretty heavily once they research them.  The only other thing I can think of is that the biggest problem is that they are likely not researching them and working on other techs.  The only things that are weighted equally or higher are commandposts and study.  This seems very silly in my opinion as the first thing the AI should build within its queue is a workshop/lumbermill as it increases their base production allowing faster building in general.

 

Reply #17 Top

Alright I also found another tag that could help,

<AIEarlyBuildUpMultiplier>10</AIEarlyBuildUpMultiplier>

this is applied to the workshop under the AI tag so that it is weighted even higher and you could apply this to increase the priority early on.

This is within the coreimprovements file.

Reply #18 Top

Quoting GFireflyE, reply 15

 Thanks for the heads up. That's exactly what I was about to try and do.

Want to have the city level up at 100, 200, 300, and 400 in interval. The fact that the AI behaves differently with different city levels is very important.

 
End of GFireflyE's quote

Look at the tags that the default setup have:

Level 1: 1 to 49 - <AIName>Outpost</AIName>

Level 2: 50 to 199 - <AIName>Village</AIName>

Level 3: 200 to 399 - <AIName>Town</AIName>

Level 4: 400 to 799 - <AIName>City</AIName>

Level 5: 800 - Infinite - <AIName>GreatCity</AIName>

I think it's better to respect those tags in order to have the least possible impact in the AI.

Reply #19 Top

Quoting halmal242, reply 16

Alright looking at the CoreAIDefs file I can't see why the AI won't build food improvements at level 1 cities as they are weighted pretty heavily once they research them.  The only other thing I can think of is that the biggest problem is that they are likely not researching them and working on other techs.  The only things that are weighted equally or higher are commandposts and study.  This seems very silly in my opinion as the first thing the AI should build within its queue is a workshop/lumbermill as it increases their base production allowing faster building in general.

 
End of halmal242's quote

Yes, I also researched those files and reached the same conclussion as you. Was thinking about changing the priorities for those tags, but at the last moment I decided just to créate the 1.5 level instead.

It would be very interesting to change those priorities and see how the AI behaves. Perhaps it behaves even better!

Have you notices the weird "Farming" tag? It has a lot of priority for a level 1 town, and the only improvement that is tagged as "Farming" in the horses improvement. So strange!

Reply #20 Top

Quoting OliverFA_306, reply 18



Quoting GFireflyE,
reply 15

 Thanks for the heads up. That's exactly what I was about to try and do.

Want to have the city level up at 100, 200, 300, and 400 in interval. The fact that the AI behaves differently with different city levels is very important.

 


Look at the tags that the default setup have:

Level 1: 1 to 49 - <AIName>Outpost</AIName>

Level 2: 50 to 199 - <AIName>Village</AIName>

Level 3: 200 to 399 - <AIName>Town</AIName>

Level 4: 400 to 799 - <AIName>City</AIName>

Level 5: 800 - Infinite - <AIName>GreatCity</AIName>

I think it's better to respect those tags in order to have the least possible impact in the AI.
End of OliverFA_306's quote

 

I still don't understand why your first city needs to level up to 2 so bloody quick. I don't even have enough time to select my second and third building sites. Consequently, when the option to level appears, I have NO idea what I want that city to BE yet.

I also really think that the ceiling is still too high. It's near impossible to reach level 5 status.

Imo, levels should be as follows (I'll admit that my initial thoughts on city levels were perhaps a bit too extreme. Here is a revisement):

Level 1: 1 to 99 - <AIName>Outpost</AIName>

Level 2: 100 to 199 - <AIName>Village</AIName>

Level 3: 200 to 399 - <AIName>Town</AIName>

Level 4: 400 to 599 - <AIName>City</AIName>

Level 5: 600 - Infinite - <AIName>Citadel</AIName>

Also note that 'GreatCity' is ...well... lacking in the creative department. I recommend changing the term to 'Citadel'. Much better to describe a grandiose municipality.

Sure the definition is a 'little' off, but the Latin root comes from the same word that derives city...so why not?

Reply #21 Top

Quoting GFireflyE, reply 20
I still don't understand why your first city needs to level up to 2 so bloody quick. I don't even have enough time to select my second and third building sites. Consequently, when the option to level appears, I have NO idea what I want that city to BE yet.
End of GFireflyE's quote

Sometimes, I haven't even *found* a second city site by the time my city levels up. Basically, I go the route of: "Essence? Lots of essence? Ok now you're a conclave. Production? Lots of production? A fortress for you.... Not either of those two things? Well I guess you must be a .... Gryffindor! Wait, I meant town."

Reply #22 Top

@animageous  sounds like you played the "game that is not to be named" (elemental war of magic).  smile

Reply #23 Top

In CoreIADefs in the game phase "Early" there' is:

            <AIPriority InternalName="Food">
                <Type>Resource</Type>
                <PriorityValue>5.0</PriorityValue>
            </AIPriority>

The same for metal, crystal, and shard.

 

However, in the "Middle" and "Late" phases there is:

            <AIPriority InternalName="Food">
                <Type>Research</Type>
                <PriorityValue>1.0</PriorityValue>
            </AIPriority>

 

Resource changes to Research for metal, crystal, and shard as well.

Bug?