RiHatz Founding City Mod

So heres the dll plus a new small xml which goes into Assets\XML\Text

edit: attachment deleted. new version available

I thought about a timed settler or making a settler cost more hammers.
I must say I dont like it, cause it doesnt seem logical to me. When to produce a settler should be a strategic decision. And while I can imagine that founding a new city will cost more gold because of more administration etc. I dont see how a new settler could need even more "building material" for the next city.

But Willgar, keep the ideas coming! Its great to have people interested in this and helping in improving.

I run game.aiplay in the console. There is an autoplay from the betterAI right? And it should be in the FFH now? Well never used it. I tried the keyboard commad once to run it, but didnt work.
Is that one different?

To all the Civ modders:
Im looking for functions that give feedback on a civs economy or anything that helps to decide when its best to build a settler (and pay the gold for the new city).
 
You have to create your own hotkey if you want a hotkey to run things (in FF I have the hotkeys set up so that SHIFT+CTRL+Z runs AI Autoplay for 700 turns, and SHIFT+CTRL+X runs it for 1 turn (effectively canceling an Autoplay in progress). Pretty sure this was done in the CustomFunctions.py file.

The command you are using kills you off when it runs right? That is the base Civ command method. FfH itself has the better version incorporated, but I've been using my shortcuts so long I cannot remember the precise line you have to enter in the debug console to make it run anymore. :( it involves a setAIAutoPlay(__) command at the end is about all I remember now.
 
It doesnt kill me of. Its rather nice i think. It plays the set turns and lets me take control afterwards.
 
Played a game on small map size the other day, and made no difference to expansion. Instead of slowing their growth, AI research slower and put the money into building cities. I think at larger map sizes though the exponential increase in city cost would kick in and they would stop expanding (but in smaller map sizes it does not slow down expansion at all).
 
I will post a new version tonight (time is UTC +1 here)

I refined the AI's decision when to build a settler.
It should not spent too much time with low research now.

The production of the first (maybe also second) settler cant be based too much on a players economy. If the starting area is full of forrests and with few gold giving ressources the AI would never (very late) build its first settler.
So for the first 2 settlers I lowered the economic threshold.

I also raised the overall city found costs to have a greater impact.

Also I think its best to try this Mod with less players than standard on a given map size.
I usually play with 2 to 3 less players for testing.
 
New Version up: View attachment FoundingCityMod.rar

Heres the updated city found costs:
Spoiler :

0 - 0
1 - 105
2 - 300
3 - 615
4 - 1080
5 - 1725
6 - 2580
7 - 3675
8 - 5040
9 - 6705
10 - 8700
11 - 11055
12 - 13800
13 - 16965
14 - 20580
15 - 24675
16 - 29280
17 - 34425
18 - 40140
19 - 46455
20 - 53400


and heres how the AI decides when to build a settler:
Spoiler :

Code:
bool CvPlayerAI::AI_isOKtoFoundCity()
{

		int iNetCommerce = 1 + getCommerceRate(COMMERCE_GOLD) + getCommerceRate(COMMERCE_RESEARCH) + std::max(0, getGoldPerTurn());
		int iNetExpenses = calculateInflatedCosts() + std::min(0, getGoldPerTurn());
		int iFundedPercent = (100 * (iNetCommerce - iNetExpenses)) / std::max(1, iNetCommerce);
		int iBestFoundValue = findBestFoundValue();
		int iCityFoundPrice = DetermineCityFoundPrice4(getNumCities());
		int iNumCitiesPlusSettler = getNumCities() + (   getUnitClassCount(UnitClassTypes(GC.getInfoTypeForString("UNITCLASS_SETTLER")))   );
		int iTotalCommerce = calculateTotalCommerce();
		bool bAnyWar = GET_TEAM(getTeam()).getAnyWarPlanCount(true) > 0 || GET_TEAM(getTeam()).getAtWarCount(true) > 0;

		int iBalanceItOut = 19; //je höher je eher baut ai siedler

//		iBalanceItOut -= getNumCities();
		iBalanceItOut += (    ((findBestFoundValue() / 1200) * (findBestFoundValue() / 1200)) / 10     );
		iBalanceItOut += ( iFundedPercent * iFundedPercent * iFundedPercent / 15000 );
		
		if ( getNumCities() == 1 )
		{
			iBalanceItOut += 1000;
		}
		if ( getNumCities() == 2 )
		{
			iBalanceItOut += 15;
		}
		if ( getNumCities() == 3 )
		{
			iBalanceItOut += 8;
		}
		if ( getGold() > DetermineCityFoundPrice4(iNumCitiesPlusSettler) / 3 )
		{
			iBalanceItOut += 2;
		}
		if ( getGold() > DetermineCityFoundPrice4(iNumCitiesPlusSettler) / 2 )
		{
			iBalanceItOut += 5;
		}
		if ( getGold() > DetermineCityFoundPrice4(iNumCitiesPlusSettler) )
		{
			iBalanceItOut += 8;
		}		
		if ( bAnyWar )
		{
			iBalanceItOut -= 20;
		}

		if ( iTotalCommerce  < ( ((DetermineCityFoundPrice4(iNumCitiesPlusSettler)) * 20)  / iBalanceItOut) )
			return false;

	return true;
}


I added, that the AI doesnt lower its research to save gold if the current research can be finished within 3 turns.

The AI will now wait for its economy to grow a lot until building a settler, so that the time with low research to save up gold will be less then 10 turns. (around 6 to 7 it should be)
The first settler is an exception to this.

On a small pangea map with 3 players and quick speed the average number of cities was around 5 until turn 300.
with the original dll the map would have been settled allover.

I hope that the balancing is getting in the right direction now.

Now, I think it will be very interesting to know who settles faster. The AI or a human player?

Theres a problem that remains for the moment. If the AI builds a settler but somehow theres no more room to settle the settler will keep sitting in a city.
That means, with the codes as it is now, the AI will also save up the gold to found that city and keep the amount.
Maybe I should programm the AI to kill its settlers if sitting in a city for too long?
(how would i do that?)

So, Im glad that some people are actually trying this out. Please lett me know the "in game feel" of it.
 
You could have a function during CvUnit::doTurn which checks something like this:

If player is AI:
If the unit is capable of Founding:
Check if the unit moved last turn:
If the unit did not move last turn:
Check if the unit is more than 30 turns old (weighted by gamespeed possibly)
If you get to this point, delete the unit
 
Is that going to solve the problem? Surely as soon as the stagnant settler is deleted, the computer will recognise it has no settlers and wants to expand, producing another settler and leading to the same cycle over and over. There needs to be a change which prevents the computer from just starting production on another settler if it cannot settle.
 
Glad to see some progress!
Played a test-game, but only came to turn 180 before it got too boring. AI seemed to build cities at about the same pace as myself (hade 3-5 at that time). Will try another game now.
 
Im sorry to inform You that I cant go on with this mod for now.
I cant play civ (or mod) at the moment. At least until next year march.
If anyone wants the code i can post it of course.

Greetings,
RiHatz
 
Im sorry to inform You that I cant go on with this mod for now.
I cant play civ (or mod) at the moment. At least until next year march.
If anyone wants the code i can post it of course.

Greetings,
RiHatz

Been playing it and there is much less city spam, so i think you did what you set out to achieve. For me personally, this makes a much more enjoyable game - thank you :goodjob:
 
The source code is linked in the first post.

Thanks a lot xienwolf for helping with this!
 
Been playing some more games now, and the mod seem to work very well. The computer founds cities a bit faster than myself (on diety), but after 3-4 cities conquest becomes the main method of expansion and alot of vast, open nature is left unsettled.

This i my new favourite modmod :) Thanks alot for all the great work!
 
Now if only someone found a way to make it FFH-compatible, xmas would be saved :D
 
To anyone that might be working on this, could there perhaps be a consideration of the Kuriotates' unique take on cities? I don't mind paying full price for a city but if I just want a Settlement to nab a resource or two, the price quickly becomes unreasonable.
 
I think RiHatz left for a while, so it's going to need a new caretaker to update this to 0.40 and tweak things. My advice would be that you have only real cities count toward the price. Then the Kuriotates quickly wind up at a leveled out price.
 
There will not be any further developement of this mod.
What I wanted to achieve in the first place was more "culturally untouched" land in later gamestages.
I just had the idea to increase the culture needed for border expansion.
Seems more easy to do :)
 
Back
Top Bottom