Culture

Xyth

History Rewritten
Joined
Jul 14, 2004
Messages
4,106
Location
Aotearoa
Something I've been pondering for the future (possibly 1.21) is a way to make culture a bit more interesting. Except when going for a cultural victory, culture is really only useful in your border cities and there's not a lot of point in developing it in your interior cities.

Most cultural mechanics are locked away in the DLL so changing the existing mechanics isn't going to be an option. I don't know yet what's possible in Python yet, but, as always, the simpler the better.

My current idea (which may or may not be feasible to implement) is to have some fraction of a city's cultural generation 'spread' over it's trade routes - to both domestic and foreign cities. This is not a complete solution and I've not begun to think through all the implications, but I wanted to throw the idea out there early for discussion.
 
That sounds interesting, but it brings up something I noticed is missing - a civic which prevents foreign trade, like mercantilism.

Back to your idea, I can see how it could be done.
A quick scan of the python API finds this: isConnectedTo (CyCity pCity)
A code could cycle through all of the cities, looking for domestic ones.
Then, it would take the culture rate of the city and add some fraction of it to the city's culture.
Then, it would cycle through all of the cities, looking for all of the connected ones. It would... I don't know. Something about culture. And then modify the culture percentage of the other city - both foreign and domestic.

The second part is done in RFC, and here's the relevant code.
Spoiler :
Code:
 for iLoop in range(len(lTotalRanking)):
                                iPlayer = lTotalRanking[iLoop][1]
                                if (iPlayer >= 0 and iPlayer <= iNumPlayers-1):
                                        sourceCity = self.selectRandomCitySourceCiv(iPlayer)
                                        print ("immigrating from ", iPlayer)
                                        if ( sourceCity != False):
                                                sourceCity.changePopulation(-1)
                                                if (gc.getPlayer(iPlayer).isHuman()):
                                                        CyInterface().addMessage(iPlayer, False, con.iDuration, CyTranslator().getText("TXT_KEY_UP_EMIGRATION", ()), "", 0, "", ColorTypes(con.iWhite), -1, -1, True, True)
                                                targetCity.changePopulation(1)
                                                targetPlot = gc.getMap().plot(targetCity.getX(), targetCity.getY())
                                                iCultureChange = targetPlot.getCulture(iAmerica)/targetCity.getPopulation()
                                                targetPlot.setCulture(iPlayer, iCultureChange, False)
                                                if (gc.getPlayer(iAmerica).isHuman()):
                                                        CyInterface().addMessage(iAmerica, False, con.iDuration, CyTranslator().getText("TXT_KEY_UP_IMMIGRATION", ()), "", 0, "", ColorTypes(con.iWhite), -1, -1, True, True)
 
Means... every turn, for every city of every player, you wanna loop through all the cities of that players to see if they are connected, and if so, add part of the culture rate to it?

The RFC code is basically just immigration, -1 Pop somewhere and +1 Pop somewhere else.
Not really related to culture spreading.
 
That sounds interesting, but it brings up something I noticed is missing - a civic which prevents foreign trade, like mercantilism.

No foreign trade is a pretty hefty disadvantage, needing some significant bonuses alongside it to make it work. I found it easier to just omit it. May have a place if culture is transmitted via trade routes though.

Means... every turn, for every city of every player, you wanna loop through all the cities of that players to see if they are connected, and if so, add part of the culture rate to it?

No, that would be pretty brutal on performance. I'd check actual trade routes rather than just the trade network, so each city would only be influencing a select few others. And I certainly wouldn't want to do it every turn, more likely some sort of average applied once in a while or something.

But anyway, it's just an idea at the moment. I need to consider the gameplay implications and research deeper into how trade routes are decided first.
 
Means... every turn, for every city of every player, you wanna loop through all the cities of that players to see if they are connected, and if so, add part of the culture rate to it?

The RFC code is basically just immigration, -1 Pop somewhere and +1 Pop somewhere else.
Not really related to culture spreading.

RFC also adds culture.
If you play as America, and you look at your cities, you find that they're like 50% american, 12% some other civ, 9% yet another civ and so forth.
 
What the above code does is:
1) Select an unlucky random city
2) Transfer 1 Pop from the victim to the target city.
3) Add foreign culture to the target city, which is 1/total pop * culture of America, though I have no idea why setCulture is used when changeCulture should be more accurate.

So it is not really about culture spreading Xyth wanted, since you are spreading from your city to your another city.
setCulture will screw up because if initial culture is already 5000, and you use setCulture(x, 100, x), instead of adding 100, you simply reduce it to 100.
 
Back
Top Bottom