Getting added territory to stick beyond city culture

Joined
Apr 2, 2013
Messages
461
Location
Oklahoma City
Hello,

I'm in the process of creating a world map scenario, and within the WorldBuilder, I'm able to "paint" territory onto the map for whatever civ I have in question, but upon reloading the map, it always reverts back to whatever the city culture is. Does anyone know of a way to make this permanent, without having to rely on city culture itself (which can make cleaner looking borders more of an issue)?

Any and all help appreciated, thanks.
 
Looks like the Territory tab was added to WorldBuilder by the BtS expansion. It calls CvPlot::setOwner, but the WBSave format doesn't store plot ownership (nor plot culture; just city culture):
https://github.com/f1rpo/Civ4CE/blo...57f9/BtS/Assets/Python/pyWB/CvWBDesc.py#L1082

If the scenario is part of a particular mod and doesn't need to work with BtS or other mods, then you could add the owner to the save format by editing CvWBDesc.py, perhaps following the example of improvementType. (Maybe the original version of the script would actually tolerate such extra data, meaning that the scenario might still work standalone apart from territory.) Not sure though if it's safe to call CvPlot:.setOwner in CvPlotDesc.apply, i.e. while the scenario is still being initialized.
 
Thanks for your help.

So, assuming that there aren't any initialization issues, the only way to do this is to edit the ownership of every square of the map manually within XML? That might be problematic as well, if any civ properly loses territory from conquest and the outlying land remains theirs. Still, though, a civ's ownership of land as a fraction of the land area is important even for game balance in affecting the viability of a domination win. If Russia already controls all of the Siberian wastelands that they would never normally settle, it makes their threat of winning domination more serious.

I'm working within Realism Invictus, so everything I do would need to be compatible with BtS AFAIK.
 
So, assuming that there aren't any initialization issues, the only way to do this is to edit the ownership of every square of the map manually within XML?
My thinking was to add
Code:
if plot.getOwner() >= 0:
	// (based on code in CvCityDesc.write)
	f.write("\tPlotOwner=%d\n" %(plot.getOwner(),))
to CvPlotDesc.write in CvWBDesc.py so that ownership changes made in WorldBuilder get written into the WBSave file. (This does not cover the initialization from a loaded WBSave.) The resulting WBSave might then look something like this
Code:
BeginPlot
	x=24,y=37
	PlotOwner=3
	TerrainType=TERRAIN_GRASS
	...
So it would not be necessary to edit the WBSave manually.
That might be problematic as well, if any civ properly loses territory from conquest and the outlying land remains theirs.
I expect that it would indeed work that way (or already does work that way when continuing play after placing territory in WB during an ongoing game). When a city is conquered, tile ownership gets updated only within the city's culture range (in CvCity::setCultureLevel). I agree that this is a problem. I guess the DLL would have to check for tiles not connected to any city of their owner in order to clean up orphaned territory. Can be implemented but is probably too big a task.
I'm working within Realism Invictus, so everything I do would need to be compatible with BtS AFAIK.
You could ask Walter to merge your additions to CvWBDesc.py into Realism Invictus. Otherwise, you'd have to distribute your version of CvWBDesc.py along with the scenario and players would have to copy it into the RI folder manually and possibly later restore the RI version. That sounds undesirable.
Still, though, a civ's ownership of land as a fraction of the land area is important even for game balance in affecting the viability of a domination win. If Russia already controls all of the Siberian wastelands that they would never normally settle, it makes their threat of winning domination more serious.
I suppose letting the scenario place size-1 cities (with no prospects for growth) in the Siberian tundra would not be an option?
 
Thanks again for the thorough help!

I'm using the pre-existing huge world map scenario as a template, and thanks to lots of work done by others already, most city names have cross-cultural tags which appropriately flip to their ruling culture upon a change of ownership. The map begins with Siberian tribes already fairly well spread out up there, but they're all doomed to remain underdeveloped. However, when I switched their ownership to Russia, their names appropriately flipped to their Russian titles. Otherwise I spent about 10 hours researching where cities would have been placed circa 1870 (the starting date for the scenario) and placed them accordingly.

I'm a little reluctant to try that fix (but thanks for digging into the code!) if territorial conquest wouldn't work properly. That's too central to the game to impede.

While it is mostly cosmetic, there are two main problems here:

1.) Getting tight borders in the right shape. This one is fairly tough, especially in Europe. I think the actual cities are placed appropriately, but getting borders to align in the right way will be a challenge, particularly in the Balkans and along the Rhine.

2.) Representing political ownership of land. Since this is an era when proper and formal "map painting" was an understood thing, it would be nice if I could feature this, as per the domination factor but also it would have bearing on unit movement in campaigns. Fortunately, outside of Siberia itself, there are few places where there would be any gaps.

Separate question, if you don't mind...
Spoiler :
Do you know of a way to install foreign culture within cities? Is there a WorldBuilder tool for this? In the city editor, I can add more or less of my own culture, but it doesn't seem that I can add other civs'. With RI's separatism mechanic, I basically want to "program in" national minorities/foreigners, and I think this would work very well within the existing mechanics.
 
@1 – Storing tile culture values in a WBSave so that contested tiles get their historical owner would be less messy than storing tile owners. But it would still mean that you'd have a modified CvWBDesc.py on your hands. Also, there's no WorldBuilder widget for adding tile culture, so you'd actually have to edit the WBSave in this case. Maybe not worth the trouble. I guess part of the fun in making a scenario is working within restrictions - if they're not too stifling.

Setting foreign city culture should actually be possible by editing the WBSave file. The syntax appears to be e.g.
Player3Culture=50
(Gets parsed just a few lines above the CvPlotDesc class that I've linked to.) At least in BtS, foreign city culture pretty much only matters when a city is re-conquered and, in particular, does not affect city nationality – that's city tile culture. But it might still affect separatism in RI as you write.
 
Sweet, I just tried that and it worked! :)

With the separatism mechanic in this mod (as well as Israel being a fully fleshed-out and represented civ with its own unit roster) I can pleasingly somewhat model Zionism in my era by putting Israeli culture at 50% within Jerusalem even while the Ottomans still politically control it and as yet no modern Israeli state existed. Thanks again, that helps a lot!

As far as the tile culture goes, I'm actually fine with that. The WorldBuilder does at least nice and cleanly show you the coordinates of each tile in question, and like I said, outside of Europe this shouldn't be much of an issue. As a timesaving measure I might just go ahead and give the Siberian cities a bunch of culture so that they fill out the area, even if that's not on any kind of historical basis.

Is the modified save any kind of technical issue, assuming it loads correctly in the first place?
 
Sweet, I just tried that and it worked! :)
Well, that's at least something.
Is the modified save any kind of technical issue, assuming it loads correctly in the first place?
I see no issue. I've wondered for a moment whether manual changes would be lost when loading the WBSave in WorldBuilder, making further changes and then saving, but I think WorldBuilder will load and save the foreign city culture values correctly, it just lacks a tool for modifying them.
 
Top Bottom