C3X Districts

One possible feature I've wondered about over the years is an extraterritorial colony to expropriate another civ's resources. This would be an Industrial-era improvement, maybe requiring a special unit, allowing you to claim a strategic resource or luxury in another civ's territory.
Hello!
I think that... If you are in an inferior situation, if you play with a Hard level, and someone takes your resources, without being able to do much... I think you will be put in a very disadvantageous situation...!
You trade - you have the resource!
You declare war - you take the resource - you make peace!
- Maybe a setting through which a weaker state, to trade the targeted resource quite quickly, whatever the relationship between the two states is...
- Maybe a setting so that after a war with a state, you can force trade!
You ask for the resource - refuse - threaten with embargo, war (again) - make forced trade...
It's just an idea!

In the modern era, let's say you give up the exploitation of the resource (another state builds a colony on your territory), but you also have something to gain, a share in money or/and resources!
- Maybe like this... I don't know how complicated the setting would be...
But why would you do that?
- Maybe only if it would cost enormously to build a facility to exploit that resource, and you can't afford to waste that much time (you are a less economically developed state)... for example, oil/gas extraction wells/platforms, a refinery, etc. and for a while you accept such a compromise, someone else comes and does the job and you have a reasonable profit (here, perhaps, the percentage will be negotiated)!

Thanks for your attention!
 
Last edited:
I've thought about this a bit more and am wondering: does this really need to be a district? Would it suffice to just surgically patch a few things in the source code and instead allow colonies to be founded inside others' territory, and (maybe separately) not be swept up by expanding borders?

If I've learned anything from Flintlock, it's that often a few well-placed minor changes to the codebase can achieve a lot. And after reflecting a bit, I realized there's actually quite a bit wired in the game about how colonies work that it'd be much simpler just to slightly tweak instead of trying to reinvent the wheel as a district. The art is maybe the easy part, other things like handling when a rival civ unit enters them, drawing the "Colony, <Civ> <Resource>" text and borders in the UI, not to mention tradenet calculating who-gets-the-resource and so on - that's code I'm hesitant to recreate in districts code if there's an easier way. (especially given that we're leaning towards just keeping the vanilla graphics).

So anyway I did a small experiment and found the function that, when a game is started or a civ's territory grows, checks for (among many other things) colonies within someone's territory and if found, removes them. For that specific check, I just overrode it and always returned false, so no colonies are removed due to being in someone's territory. And the result is:
View attachment 754829

View attachment 754830

(and from Babylon's perspective, no dyes)
View attachment 754833

Success! We can have extraterritorial colonies and the resources extraction just *works* with barely any code changes at all.

I also found how the "Build Colony" button checks (whether to show it or not and allow a worker to build one) happen and can pretty easily override those (I think). So basically, barring unforeseen snags, it's relatively simple to just let players both build and keep colonies in other people's territories, without it needing to be a district. This would all be set via C3X configs, of course.

Additionally, I found where in the code leaders' attitudes towards one another is determined. I think I could just add some negative value (users could configure, e.g. -4) to the base relationship score for each colony in someone else's territory.

So long story short, it appears straightforward to allow users to found and keep foreign colonies, and also allow relations to deteriorate due to that. This seems pretty compelling and interesting to me, and also, more realistic, as when one civ's borders expand, another civ's people on that territory don't magically disappear, but instead may become a point of contention. Not to mention expropriating resources actually, well, happens in the real world.

What do you think? I'm inclined to go this route instead of making it a special district type.

The only downsides I see are that, if not a district, we aren't able to layer in technology/wonder/whatever checks districts allow for, and also custom graphics, etc. But in the great scheme of things that seems minor to me.


I need to investigate on this one. This may actually be the trickiest piece. I'm thinking I can patch how vanilla workers search for candidate colony tiles and override the check that only considers resources on tiles with no territory owner. If that is possible, this could work without much coding.

Creating an extraterritorial colony is kind of an aggressive act, so we'd need to think through the right circumstances for workers to do so. Maybe if one civ's military strength is "much stronger" than the other civ's? (I don't know how that check currently works). Or any other factors that should be considered, if they're not too complex?
This is great. It makes sense to me to do this little tweak, and to adjust the relationship as you described.

My only hesitancy about making all workers capable of building extraterritorial colonies is that 1) they might cover the map, which would change the game a lot and 2) these kind of extraterritorial resource-extraction colonies emerged in a specific phase, and fit the industrial era of the game better than the others.

Is there a way to limit the kinds of workers that can/will build these colonies only with a specific flag, possibly Hidden Nationality? I know that that flag makes it possible for settlers to build cities in foreign territory, and wonder if it could function the same way with colonies.

If so, you could make a Corporate Executive unit (or something along those lines), with C3X caps on how many can be produced, that becomes available with The Corporation, whose sole job is to build extraterritorial colonies. And building a colony on another player's territory without the Hidden Nationality flag could start a war, the way that building a city on another player's territory does now.

And yes, I think just having a much larger military should be a good enough precondition.
 
Last edited:
Hello!
I remembered a setting that I wanted to propose but I missed it:
1. Walls:
- walls with gate- one side with access gate;;
- the appearance of defensive moats, with a bridge, maybe defensive towers;
- the possibility of having defensive elements on the walls (boulders, oil/hot water, pitch, etc.)
2. Wall with a gate:
- the entry/exit of units into the city, to be done only on the side with the wall with the gate;
- the attack of cavalry and/or infantry units, from the city, to be done only here - attack/counterattack/withdrawal into the city.
- the gate can only be broken by ram units and less often by catapults and only then the cavalry can attack, together with other attack units (swordsmen for example);
3. Walls with a secret exit/entry:
- build walls with a secret exit/entry unseen by the opponent, where units can enter/exit the city
=>
only the spy unit can reveal it and then this secret gate can be broken;
- the cavalry and/or infantry attack units can exit through here (surprise attacks!).
4. attack on the walled city:
- archers + catapults - both units bomb from a distance, not directly involved in the battle;
- the appearance of ram units to demolish the gate -> only now can attack, cavalry and other attack units;
- the appearance of attack units with stairs, without them (direct condition) the attacking infantry units cannot 'climb', and they will also have a higher defensive penalty than in the ground attack (only units with light armor or no armor);
5. if the access road to the city (the wall with the gate) was blocked, the city should be starved, only if it has a secret exit/entrance can it benefit from the production of the fields;
6.The road to the gate:
- the only access to/from the city, including resources - except for the existence of a secret entrance/s.

That's it... maybe you can fill in more... :)

I posted both at C3X and at District,!

Edit::
instafluff, The Great Wall may have gates( like in reality - Gates like Shanhaiguan and Jiayuguan!?) and thus will not be completely invulnerable, until the discovery of Metallurgy?
Another question:
- can secret exits/entrances be made in the Great Wall - for raids? :)
- secret exits/entrances that only the spy can reveal and which he can sneak in and maybe other specialized units (like the Ensclaver from COM3, Ninja etc?

Thank you for your attention and understanding!
 
Last edited:
I read up about it and municipal districs existed from ancient to modern times, but formalized by England. "what if you add a municipal district?"

It could allow courthouses, hospitals, police stations, and the aqueducts. Now here comes the gravy. Extra tile yields can be optional but their main ability would be to give irrevocable specialists to cities, meaning you can't change their profession by clicking. Courthouses give lawyers, police stations give police officers, and hospitals give doctors.

Lawyers give bonus -2corruption

Police officers give bonus -1corrupt & +1 content face.

Doctors give -pollution if we treat it as health?

If extra tile yeilds are zero then a use case scenario would be to trade off between food/commerse/shields/science/culture and corruption/uprising/pollution suppression. It's AI proof since the Ai builds those buildings anyway and they'll get the same bonuses humans would.

The same logic can be applied to vanilla engineers and scientists maybe.

I made a post about civ4 like specialists in Flintlocks post a while ago and I think if you are able to accomplish this it opens the door to a lot of the other things I mentioned.

And of course we can tweak any bonuses and yields to balance it.
 
My only hesitancy about making all workers capable of building extraterritorial colonies is that 1) they might cover the map, which would change the game a lot and 2) these kind of extraterritorial resource-extraction colonies emerged in a specific phase, and fit the industrial era of the game better than the others.
Right, I wouldn't think that would be very fun, or at least it may seem quite chaotic. In terms of implementation for AI I need to think this through a bit.

For now, I've implemented functionality to allow extraterritorial colonies and incur a relation penalty for each one. Haven't touched the AI yet though.

In other news, I think I was able to figure out how the Military Advisor screen compares militaries and decides strong/same/weak. Bad news is it's not a convenient function that can be easily reused, but I'd probably have to replicate part of the logic.

Is there a way to limit the kinds of workers that can/will build these colonies only with a specific flag, possibly Hidden Nationality? I know that that flag makes it possible for settlers to build cities in foreign territory, and wonder if it could function the same way with colonies.

If so, you could make a Corporate Executive unit (or something along those lines), with C3X caps on how many can be produced, that becomes available with The Corporation, whose sole job is to build extraterritorial colonies. And building a colony on another player's territory without the Hidden Nationality flag could start a war, the way that building a city on another player's territory does now.
The obvious way to implement this in terms of C3X configs would be a flag like extraterritorial_colonies_require_hidden_nationality_flag, or something like that. That seems very specific though, and I worry that I'd have to implement almost duplicative AI logic in multiple places if I added that, once for workers specifically (if false), and once for any other unit type with hidden nationality (if true). There may be elegant ways to do that, but I need to meditate on it a bit.

Maybe more importantly, if the AI doesn't handle this well it may not be very fun. I'd rather just not touch the AI for the time being if it would require a lot of coding and testing. (that's not the end of the world if the end result is fun, but it would certainly delay the current release)

I remembered a setting that I wanted to propose but I missed it:
Noted, but I need to restrict the scope of what I'm working on for this release or it will never get done :)

@instafluff, The Great Wall may have gates( like in reality - Gates like Shanhaiguan and Jiayuguan!?) and thus will not be completely invulnerable, until the discovery of Metallurgy?
Another question:
- can secret exits/entrances be made in the Great Wall - for raids? :)
- secret exits/entrances that only the spy can reveal and sneak inside himself and maybe other specialized units (like Ensclaver; from COM3?)
This sounds like something that could be implemented in when Lua is ready.

When will the next version of C3X come out? Hopefully soon! :whew:
I'm glad you are excited! I'm aiming for March, though ultimately that's up to Flintlock. I need to do a lot more polishing and testing to make sure we don't release something half-baked. After that we will do code reviews and likely more rounds of refinement.

I read up about it and municipal districs existed from ancient to modern times, but formalized by England. "what if you add a municipal district?"

It could allow courthouses, hospitals, police stations, and the aqueducts. Now here comes the gravy. Extra tile yields can be optional but their main ability would be to give irrevocable specialists to cities, meaning you can't change their profession by clicking. Courthouses give lawyers, police stations give police officers, and hospitals give doctors.
I love this idea, and those buildings make perfect sense in that context. The tricky thing though is that those particular ones don't depend on each other, and thus the buildings would need to be rendered visually in a special, non-predictable way. Thus it would need to be a special district with logic baked in the code for how to show it (like neighborhoods, wonder districts, energy grids [new], and so on). And the specific specialists is a really cool idea, but again would need some special attention & coding to get right.

I think this is one of those cases where if some intrepid soul(s) could take on the art piece (and it would almost certainly need custom art per-culture, per-era), I could do the coding. Otherwise I'm worried about taking much more on than I have on my plate at the moment.
 
Last edited:
Right, I wouldn't think that would be very fun, or at least it may seem quite chaotic. In terms of implementation for AI I need to think this through a bit.

For now, I've implemented functionality to allow extraterritorial colonies and incur a relation penalty for each one. Haven't touched the AI yet though.

In other news, I think I was able to figure out how the Military Advisor screen compares militaries and decides strong/same/weak. Bad news is it's not a convenient function that can be easily reused, but I'd probably have to replicate part of the logic.


The obvious way to implement this in terms of C3X configs would be a flag like extraterritorial_colonies_require_hidden_nationality_flag, or something like that. That seems very specific though, and I worry that I'd have to implement almost duplicative AI logic in multiple places if I added that, once for workers specifically (if false), and once for any other unit type with hidden nationality (if true). There may be elegant ways to do that, but I need to meditate on it a bit.

Maybe more importantly, if the AI doesn't handle this well it may not be very fun. I'd rather just not touch the AI for the time being if it would require a lot of coding and testing. (that's not the end of the world if the end result is fun, but it would certainly delay the current release)


Noted, but I need to restrict the scope of what I'm working on for this release or it will never get done :)


This sounds like something that could be implemented in when Lua is ready.


I'm glad you are excited! I'm aiming for March, though ultimately that's up to Flintlock. I need to do a lot more polishing and testing to make sure we don't release something half-baked. After that we will do code reviews and likely more rounds of refinement.


I love this idea, and those buildings make perfect sense in that context. The tricky thing though is that those particular ones don't depend on each other, and thus the buildings would need to be rendered visually in a special, non-predictable way. Thus it would need to be a special district with logic baked in the code for how to show it (like neighborhoods, wonder districts, energy grids [new], and so on). And the specific specialists is a really cool idea, but again would need some special attention & coding to get right.

I think this is one of those cases where if some intrepid soul(s) could take on the art piece (and it would almost certainly need custom art per-civ, per-era), I could do the coding. Otherwise I'm worried about taking much more on than I have on my plate at the moment.

I can try to make textures. I'm more aggressive and in your face with my art but I can use the small buildings file from vanilla with the hospital, courthouse, police station, and aqueduct as a base and starting point. Then I'd look at your textures and try to match it up to your style and colors in a way that might resemble a downtown, which is usually where municipal buildings are. I'll TRY!!!
 
I can try to make textures. I'm more aggressive and in your face with my art but I can use the small buildings file from vanilla with the hospital, courthouse, police station, and aqueduct as a base and starting point. Then I'd look at your textures and try to match it up to your style and colors in a way that might resemble a downtown, which is usually where municipal buildings are. I'll TRY!!!
Excellent! Here's what I would suggest, and please don't kill me if I get nitpicky about the graphics :)
  1. I'd suggest creating 5 files, MunicipalDistrict_AMER.pcx, MunicipalDistrict_EURO.pcx, MunicipalDistrict_ASIAN.pcx, MunicipalDistrict_MIDEAST.pcx, and MunicipalDistrict_ROMAN.pcx, copying the _template.pcx file under C3X/Art/Districts/1200/.
  2. You may want to consider selectively copy/pasting a few buildings from the vanilla city art files to make the downtown, as that will potentially be faster and blend better.
  3. For each file, I'd suggest the following layout:
    1768765202787.png

    In other words, the generic downtown buildings (specific to that culture & era) in column 1 center/north-ish quadrant, the courthouse only in column 2 (west), police station only in column 3 (south), and hospital only in column 4 (east). They should be positioned in such a way that, if all placed together, they would look appropriately spaced and overlap just slightly, if at all. If the buildings were cleanly separated in this way in different columns, I can pretty easily write code that selectively adds them together onto a tile.

    This approach is different by necessity than how most other districts art works (which tend to "accumulate" and more buildings are added as you move left -> right in PCX files) because the buildings don't depend on each other.
  4. For the actual building graphics, you may find it helpful (though feel free to ignore and do however you'd like) to paste your drafted art in ChatGPT (or whatever) alongside the standard city graphics you want them to blend with. Then prompt it with something like:

    Code:
    "Please generate an EXTREMELY SIMILAR VARIATION of this district sprite from Civ 3 (picture one), but make it blend better aesthetically with the city sprite in picture two.
    Make the angle of the light and shadows EXACTLY THE SAME as the city such that they would BLEND PERFECTLY. Make sure the background is still magenta and green."

    Just an idea, and you may need to iterate and tweak it a bit if you go this route.
Let me know if this doesn't make sense.

Last, I'd suggest skipping the aqueduct for now. I'm not sure long-term how (if at all) I want to render that (it'd be great if it could visually connect somehow with a nearby mountain or hill, but I have no idea how I'd do that), and also the district itself may get cluttered with the downtown + 4 other buildings in it.

Thanks - if this is too much or ends up being more than you bargained for, no problem and we can work on it some other time.
 
Last edited:
Excellent! Here's what I would suggest, and please don't kill me if I get nitpicky about the graphics :)
  1. I'd suggest creating 5 files, MunicipalDistrict_AMER.pcx, MunicipalDistrict_EURO.pcx, MunicipalDistrict_ASIAN.pcx, MunicipalDistrict_MIDEAST.pcx, and MunicipalDistrict_ROMAN.pcx, copying the _template.pcx file under C3X/Art/Districts/1200/.
  2. You may want to consider selectively copy/pasting a few buildings from the vanilla city art files to make the downtown, as that will potentially be faster and blend better.
  3. For each file, I'd suggest the following layout:
    View attachment 754898
    In other words, the generic downtown buildings (specific to that culture & era) in column 1 center/north-ish quadrant, the courthouse only in column 2 (west), police station only in column 3 (south), and hospital only in column 4 (east). They should be positioned in such a way that, if all placed together, they would look appropriately spaced and not overlapping. If the buildings were cleanly separated in this way in different columns, I can pretty easily write code that selectively adds them together onto a tile.

    This approach is different by necessity than how most other districts art works (which tend to "accumulate" and more buildings are added as you move left -> right in PCX files) because the buildings don't depend on each other.
  4. For the actual building graphics, you may find it helpful (though feel free to ignore and do however you'd like) to paste your drafted art in ChatGPT (or whatever) alongside the standard city graphics you want them to blend with. Then prompt it with something like:

    Code:
    "Please generate an EXTREMELY SIMILAR VARIATION of this district sprite from Civ 3 (picture one), but make it blend better aesthetically with the city sprite in picture two.
    Make the angle of the light and shadows EXACTLY THE SAME as the city such that they would BLEND PERFECTLY. Make sure the background is still magenta and green."

    Just an idea, and you may need to iterate and tweak it a bit if you go this route.
Let me know if this doesn't make sense.

Last, I'd suggest skipping the aqueduct for now. I'm not sure long-term how (if at all) I want to render that (it'd be great if it could visually connect somehow with a nearby body of water, but I have no idea how I'd do that), and also the district itself may get cluttered with the downtown + 4 other buildings in it.

Thanks - if this is too much or ends up being more than you bargained for, no problem and we can work on it some other time.
I'm up to the challenge and I understand your rules. I'm familiar with chatgpt and will give it a shot.
 
In my eyes quite clear number 3 (districts configuration) is the best solution for that problem, as it allows a flexible handling for the districts.
Okay, districts can now optionally have resources rendered under them, rather than on top. Let me know if this looks better :thumbsup:

1768806356274.png


I decided to call it draw_over_resources so the name is more consistent with draw_forests_over_roads_and_railroads. The default value is 0 / false.

Configuration:
Code:
#District
name                  = Great Wall
tooltip               = Build Great Wall
obsoleted_by          = Metallurgy
wonder_prereqs        = "The Great Wall"
buildable_on          = desert,plains,grassland,tundra,floodplain,mountains,forest,swamp,jungle
draw_over_resources   = 1
...
 
Last edited:
Okay, districts can now optionally have resources rendered under them, rather than on top. Let me know if this looks better :thumbsup:

View attachment 754958

I decided to call it draw_over_resources so the name is more consistent with draw_forests_over_roads_and_railroads. The default value is 0 / false.

Configuration:
Code:
#District
name                  = Great Wall
tooltip               = Build Great Wall
obsoleted_by          = Metallurgy
wonder_prereqs        = "The Great Wall"
buildable_on          = desert,plains,grassland,tundra,floodplain,mountains,forest,swamp,jungle
draw_over_resources   = 1
...
Is there any way to make this district-dependent, so that the Great Wall is drawn on top but resource generators are drawn underneath?
 
Is there any way to make this district-dependent, so that the Great Wall is drawn on top but resource generators are drawn underneath?
It already is :thumbsup:

1768835574003.png


Code:
#District
name                  = Encampment
draw_over_resources   = 0

#District
name                  = Great Wall
draw_over_resources   = 1

The config is at the district level (Civinator's suggestion) rather than C3X config, so you'll have granular control. The default is 0, so if unspecified, resources will be drawn on top.
 
Last edited:
In my eyes this looks much better. :)

And there is another feature in your mod, that was not discussed yet and that I find very interesting:
By your natural wonders you have managed to place additional writing on the map without using resource graphics for it. :hatsoff:

Unfortunately at present it is not possible to settle on such a "name-district".

City Names.jpg


City Names2.jpg


Besides districts, this feature alone could have an enormous potential for modding Civ 3. Per example such a feature could allow in fixed world maps starting at 4000 BC to give every city in preplaced correct locations the correct names for cities founded at those locations. Rivers and regions on the map can also receive their proper names. The graphics for such a "name-district" could be set to transparency as the decisive are only the letters at the correct place on such a worldmap.

Since my second post at CFC I am dreaming about such an option. I tried to realize it with resources placed near the locations of those cities, but here I found out, that there are only 256 different resources possible in Civ 3 - too less for 512 cities and the other purposes for resources in a game.

massilia-jpg.88770


rmideast-cities-jpg.127834


Here more can be seen about the combination of transparent city graphics and city-resources - and now the territory of those cities can even be enlarged by the C3X suburbs (=neighbourhood):

Spoiler :

chinakorea-jpg.735552


chinamongolia-jpg.735553


south-america-jpg.735555


usmexico-jpg.735556

 
Last edited:
And there is another feature in your mod, that was not discussed yet and that I find very interesting:
By your natural wonders you have managed to place additional writing on the map without using resource graphics for it. :hatsoff:

Hmmmm. Maybe something like this? :)

1768850990689.png


1768855135085.png


1768851084377.png


or

1768851122925.png


I just implemented this. Obviously I will clean things up a bit and add support for pre-placing these in scenarios too. And enable_named_tiles is separate from districts and can be used with or without them.

Ok, now I seriously need to stop adding things to this release so I can finish it :)
 
Last edited:
I just implemented this. Obviously I will clean things up a bit and add support for pre-placing these in scenarios too. And enable_named_tiles is separate from districts and can be used with or without them.
Super ! :woohoo:
 
Do you want the text to appear in the middle of the named tile, at the bottom, under it, etc? (or at the top, for that matter)
In my eyes under the tile would be the best place. That is why I have made the second screenshot with the Natural Wonder and its writing pasted into the tile of the city. This place is well suited for the name of cities during a game, in this case Angkor (instead of Tropical Rainforest) when a city is founded at that location.

city-names2-jpg.754999
 
Ah, I see what you mean. Ok here is what that looks like:

1768881271160.png

1768881299516.png

1768881316031.png


Here is how it looks with other terrain:
1768881392390.png

1768881471853.png


Entries in scenario.districts.txt are now implemented as well and will look like:
Code:
#NamedTile
coordinates  = 41,23
name         = Tiber River

(they can be used for this even if districts are disabled, despite the file name)
 
Last edited:
instafluff, this is fantastic ! Now CCM and RARR can have a worldmap that is worth for these mods. :bounce:

The concept of the CCM worldmap, starting at 4000 BC, exists since many, many years. Each city-resource marks a location that can be settled and the AI is knowing this very well. What was missing is, to give the AI cities on the map their proper names in the proper locations. Important is, that all names can be placed in the editor to the worldmap, so they are all there when the game starts and there stands the name of the city above the normal field for a city name (in the example in the following screenshot the name Naples above Roman City 2) or as you wrote in a post above, to give "support for pre-placing these in scenarios". The function to give locations names during the game on random maps is very nice, too :) , so it is not needed for games starting on fixed maps.

CCM Worldmap1.jpg


CCM-Worldmap2.jpg
 
Last edited:
nstafluff, this is fantastic ! Now CCM and RARR can have a worldmap that is worth for these mods. :bounce:

The concept of the CCM worldmap, starting at 4000 BC, exists since many, many years. Each city-resource marks a location that can be settled and the AI is knowing this very well. What was missing is, to give the AI cities on the map their proper names in the proper locations. Important is, that all names can be placed in the editor to the worldmap, so they are all there when the game starts and there stands the name of the city above the normal field for a city name (in the example in the following screenshot the name Naples above Roman City 2) or as you wrote in a post above, to give "support for pre-placing these in scenarios". The function to give locations names during the game on random maps is very nice, too :) , so it is not needed for games starting on fixed maps.
Excellent! That makes perfect sense.
 
Back
Top Bottom