Resource icon

C3X: EXE Mod including Bug Fixes, Stack Bombard, and Much More Release 20

Version 20 is done, finally. It's another in the tradition of huge releases that took forever to post for no good reason. I got around to overhauling the readme and mod main page, which is something I've wanted to do for a while. The readme.txt included with the mod has been cut down a lot, now it's just installation & config info. It would be nice to keep it matching the full mod info pages on CivFanatics (and now GitHub too) but that's not really practical since it's just a text file.

Anyway, here's what's changed since 20 Preview 2:
  • Polish precision striking by cruise missiles
    • Now plays the correct animations and despawns the unit afterward
    • Controlled by the polish_precision_striking config option, which used to be named polish_non_air_precision_striking
  • Enable cruise missiles to perform stealth attack bombard
  • Add ability to perfume technologies and governments
    • Options named technology_perfume and government_perfume, respectively
    • The perfume_specs option from before has been renamed to production_perfume but the old name still works as an alias
  • Option to show more strategic resources (up to 13) in the box on the top left of the city screen by packing them in more tightly
    • Named compact_strategic_resource_display_on_city_screen, off by default
  • Fix AIs not switching off a unit build when it can't complete due to a limit
  • Fix tile visibility check in stealth attack bombard
 
Another great milestone! Here are a few ideas for the next release:

Precision strike for cruise missile ability units. After stealth attack, this is the obvious thing people would like to see.

City improvements and population have a hardcoded defense value that is set the the rules section of the editor. In stock game, this is balanced around industrial artillery and bombers. But with PTW style targeting, it also means that early game artillery is of very little use in laying siege to a city that has grown past size 6 and no longer has exposed walls. Decreasing the improvement and pop def value would make early game artillery more rewarding ptw style, but make later game strategic bombing too strong. Could there be a way to trigger the game to increase that value in game without having to touch the C3X config patch? Like with a tech or a city improvement? So by the time a player reaches a certain tech, their city improvements and population will be buffed to match the increased artillery strength.
 
Amazing.

can I be cheeky and add a request to the pile?

The base game can point to new animation folders, such as the worker by different eras.
Is it possible to copy this idea, but to use Culture Groups and Civ Names instead of eras?

This would make it easier to add flavour units to civs, without cluttering up the unit lists and civilopedia.
 
Thanks for the appreciation everyone. :)

Precision strike for cruise missile ability units. After stealth attack, this is the obvious thing people would like to see.
But... this is already in R20

City improvements and population have a hardcoded defense value that is set the the rules section of the editor. In stock game, this is balanced around industrial artillery and bombers. But with PTW style targeting, it also means that early game artillery is of very little use in laying siege to a city that has grown past size 6 and no longer has exposed walls. Decreasing the improvement and pop def value would make early game artillery more rewarding ptw style, but make later game strategic bombing too strong.
This reminds me of a similar request I got before to make tile bombard defense vary by era. Both should be doable but I remember when I looked into varying tile defense it was a bit awkward so I never ended up doing it. It's on the list, though, like so many other things. The problem with reducing improv defense in the ancient era might be that it makes it more likely for wonders to get destroyed. As I recall, the game has a really weird little rule that you can destroy wonders by bombardment but only in the ancient era.

The base game can point to new animation folders, such as the worker by different eras.
Is it possible to copy this idea, but to use Culture Groups and Civ Names instead of eras?
That would be possible and would even be relatively easy as I've already identified the two functions I'd need to modify from when I was working on removing the Elvis Easter egg. Those two functions are responsible for looking up a unit's INI file to load its animations and icons. They're where the base game swaps in the Elvis unit and so they could be modified to swap in other things. The only problem I can foresee is ambiguous replacements, like if you had a replacement medieval era worker and another for a Mediterranean worker, which would you use for a medieval Mediterranean civ?
 
Would it be pretty easy to toggle on/off the ability for HN units to capture cities? As it is now, an AI HN unit can capture a city but a human HN unit cannot.
 
Precision Strikes are when bombing only attacks City Improvements, this ability works for Air Units, but not Cruise Missile units.

This would allow the creation of a Shahed Drone unit with all its real life characteristics.
 
Hello. Thanks again to Flintlock for the great C3X mod.
Here are a few more ideas for your mod:
1. Destroying improvements on tiles (Shift + P).
The order of destroying improvements on tiles is hard-coded in the game: railroad / road and mine (irrigation) / fort.
But often you need to destroy one most important or already unnecessary object. Is it possible to make it so that when you press the "Destroy" button, a menu appears with a choice of the object to destroy: railroad or road / mine (irrigation) / fort?
2. Abuse of railroads.
The game has bonuses from railroads: irrigation (+1 food), mine (+1 shield). This makes it tempting to build railroads on all tiles. Your great feature of restricting movement on railroads allows you to use them even in the Ancient World and Middle Ages scenarios (strategic "imperial roads"). To limit their construction, it would be nice to introduce a penalty for their "maintenance". This can be a fixed amount specified in the C3X settings file (for example, "-1" or another amount of gold for each tile with a railroad). Bonuses from construction can be left as is, or also specified in the settings file with a "+/-" sign. Can this be implemented?
3. Capturing a city and losing it on the next turn.
An example from the Hegemon mod is given.
Capturing an enemy city - 0 gold captured.
Losing a city on the next turn - 1261 gold lost, although the city did not bring almost any income to the treasury.
Most likely, when a city is lost, all gold from the treasury is multiplied by a coefficient depending on the ratio of the size of this city to the total size of all cities (or something similar).
1734036604579.png

1734036642145.png

Have you ever studied how this part of the code works? Is it possible to make changes to the calculation of the amount of captured gold to make it more realistic?
4. Full use of roads in enemy territory.
This was mentioned a long time ago, but now I can’t find who asked this question first (if someone finds it, please send me a link to the post).
The principle may be as follows.
The 1st unit occupies a tile with a road, losing the amount of movement points as when moving to a tile without a road. From this moment on, the tile with a road is under control.
The 2nd unit uses this tile as when moving along a road on its territory. Moving to the next (not yet captured) tile with a road, it also loses movement points. Two tiles are already under control.
And so on, step by step, control over the tiles with a road is established.
If your units leave the captured tile with a road, or it is captured by an enemy unit, then control over this tile is lost, and you will have to occupy it again.
This will allow you to move faster into enemy territory, as well as pull siege equipment and heavy slow units to enemy cities. How feasible is it to implement this?
 
Would it be pretty easy to toggle on/off the ability for HN units to capture cities? As it is now, an AI HN unit can capture a city but a human HN unit cannot.
I looked into this before and unfortunately it's not easy. I might be able to prevent AI HN units from capturing cities, but I wouldn't know where to modify to allow human HN units to do so. The reason it's inconsistent in the first place is that the code for this is just a mess. I think even the original developers lost track of all the special rules and edge cases.

1. Destroying improvements on tiles (Shift + P).
2. Abuse of railroads.
These wouldn't be easy, but I expect they could be done with enough effort. The hard part about making railroads cost maintenance would be reprogramming the AI to understand the rule.

3. Capturing a city and losing it on the next turn.
...
Most likely, when a city is lost, all gold from the treasury is multiplied by a coefficient depending on the ratio of the size of this city to the total size of all cities (or something similar).
It is similar to that. The rule for how much gold you steal when capturing a city is:
  • If it's the last city your opponent has, you get their entire treasury
  • Otherwise, the amount of gold equals their treasury divided by their city count multiplied by a factor depending on the size class of the city
    • That factor is 0.5 for cities of level 1 (towns), 0.75 for level 2, and 1.0 for level 3 (metropolises)
An interesting thing I discovered while reading the code for this is that there's an undocumented special action that lets units deliver twice as much gold as was stolen from the city. I.e., the player that lost the city doesn't lose any more gold but the one that captures the city gets double if the capturing unit has the action. It's odd that it's an action instead of an ability, and makes me wonder if it does anything else. I didn't see anything about this in Quintillus' editor so it might be an original discovery.

Unfortunately changing the amount of gold stolen on city capture is not easy since the logic to compute the amount is integrated into the method that does the capture.

4. Full use of roads in enemy territory.
This might be doable with a small change, but I wouldn't know where to make it. The function that computes movement costs is rather complicated and I'm not sure if there's a single point where it decides whether or not there's an open road on the tile in question. It looks like that logic might have been duplicated. I'd have to study it some more to be sure.
 
Hi Flintlock! I have been playing with some settings from C3X on. Could you please advise if the following behavior was expected?
- Movement on the railroads ignores the movement points of a unit. I.e. if I set limit_railroad_movement = 15 both units with MP: 1 or MP:3 will move 15 tiles on the railroad.
- Whenever entering the other civ's territory is prohibited one may still attack units that are in the border square (i.e. Barbarian or belonging to the hostile 3rd Civ) and enter the other's territory in progress;
- Playing Hotseat with disallow_trespassing = true may be a bit problematic because there is no option to declare war and one has either to bombard or to attack enemy troops somewhere to start war. Maybe Human player could be presented with an option to move into enemy territory and declare war?
 
There have been cases of the AI having its artillery stack stuck in a city for prolonged periods of time. They're stuck not because they didn't have escorts. They're stuck together with their escorting defensive units. Their was a legit path towards the enemy territory. But the AI seems to be confused with its artillery while its offensive units are not. And so the fast moving offensive units would go to war on their own and the artillery plus a buncha defensive units stay behind. I posted screenshots of that in my reporting thread.
 
Wow. You were right Flintlock. Making flood plain disease work like it is supposed to (not eliminated until Sanitation instead of in the AA) is a little nasty. My flood plain adjacent cities were taking a beating in my recent test game.
 
Random thought that occured when I was playing Carthage;
Is hasContactWith(Spain) a condition you could potentially check for building units?
Might be colourful to be able to build Gallic and Spanish mercenaries on condition that I had contact with those civs.
 
That would be possible. As you could probably guess, it would work similarly to the building prereqs, only instead of a bit of logic disallowing production unless all buildings from a list are present, it would disallow production unless any of a list of techs have been researched. It's a bit harder since the rule ought to apply to the entire upgrade chain before the obsoleted unit, but that could be handled by automatically copying the rule for each unit in the chain.
Another option I thought about is instead of a single building pre-req like a Factory being required to build a Tank is something similar to standard Civ with how Wonders often require X number of improvements (e.g. Wall Street requires 5x Stock Exchanges). For example, a Civ would need three Factories in order to build a Tank, simulating building up your manufacturing core. That way you don't have the outdated build queue in cities without a specific improvement that can still build something like Cavalry but not Tanks. This way once you have X number of improvements every city can build the unit. For example, three Barracks for Swordsmen, three Shipyards for Frigates, three Airports for Bombers, etc.
 
Another option I thought about is instead of a single building pre-req like a Factory being required to build a Tank is something similar to standard Civ with how Wonders often require X number of improvements (e.g. Wall Street requires 5x Stock Exchanges). For example, a Civ would need three Factories in order to build a Tank, simulating building up your manufacturing core. That way you don't have the outdated build queue in cities without a specific improvement that can still build something like Cavalry but not Tanks. This way once you have X number of improvements every city can build the unit. For example, three Barracks for Swordsmen, three Shipyards for Frigates, three Airports for Bombers, etc.
That is an interesting idea that I have played around with a little.
 
Hi Flintlock! I have been playing with some settings from C3X on. Could you please advise if the following behavior was expected?
- Movement on the railroads ignores the movement points of a unit. I.e. if I set limit_railroad_movement = 15 both units with MP: 1 or MP:3 will move 15 tiles on the railroad.
- Whenever entering the other civ's territory is prohibited one may still attack units that are in the border square (i.e. Barbarian or belonging to the hostile 3rd Civ) and enter the other's territory in progress;
- Playing Hotseat with disallow_trespassing = true may be a bit problematic because there is no option to declare war and one has either to bombard or to attack enemy troops somewhere to start war. Maybe Human player could be presented with an option to move into enemy territory and declare war?
- That's working as designed. Limited railroad movement works like railroads in Civ 4. I think it makes the most sense that way, and it's also what people wanted back when I asked before implementing that.
- That is a bug. There was a previous similar bug about combat and trespassing where units were allowed to cross a locked border to attack a third civ and then would get stuck trying to move into the locked tile if they won combat. I fixed the bug by disallowing moves like that but I guess I missed something. Can you share more about the circumstances where that happens?
- I didn't know about that since I never play hotseat. I'll look into it. It should be possible to add a popup asking to declare war in that case.

There have been cases of the AI having its artillery stack stuck in a city for prolonged periods of time. They're stuck not because they didn't have escorts. They're stuck together with their escorting defensive units. Their was a legit path towards the enemy territory.
AI artillery will only path toward an enemy city, so when all paths to your cities are blocked off by your units, the AI artillery just stays in place. I don't see any easy way to change that, the unit AI for artillery is just too rudimentary.

Is hasContactWith(Spain) a condition you could potentially check for building units?
Sure, you could check for pretty much anything. If I were to implement something like this, the hardest part would be to read in the special rules from the config files. Applying them would be very straight forward. These sort of requests really tempt me to buckle down and put in the work to integrate Lua into the game. That way you could have a Lua function that works like an additional condition on the game's canBuildUnit function where you could put in whatever crazy conditions you like.

Another option I thought about is instead of a single building pre-req like a Factory being required to build a Tank is something similar to standard Civ with how Wonders often require X number of improvements (e.g. Wall Street requires 5x Stock Exchanges). For example, a Civ would need three Factories in order to build a Tank, simulating building up your manufacturing core.
You can kind of do this already with resource generating buildings, ex. three barracks are required to build a cheap small wonder that produces a resource that's needed to build swordsmen. Programming this rule directly would be possible and relatively easy, but again, wouldn't it be nice if you could do it yourself in Lua?
 
It makes sense as the artillery stack is always looking to bombard cities first, not units. There was a 1 tile isthmus and I had a unit blocking bombardment access to the nearest city.

Is there a way to mod what nuclear weapons do? It seems like they will 100% kill off any unit with only 1 HP. Unfortunately the 1 HP concept is how I mod a lot of air units that are very weak in air to air combat but are difficult to shot down by anti air fire. I also modded artillery to have 1 HP to avoid them being bombardment sponges when stack bombard is used. These units are extremely vulnerable to nuclear weapons. Is there a way to mod 1 HP units to have the same 50% of dying to a nuke like other hit point level units?
 
Is there a way to mod 1 HP units to have the same 50% of dying to a nuke like other hit point level units?
Sure. Modifying the logic for nuke damage isn't easy in general since it's all piled into one method, but this modification in particular is easy since I can intercept the call to the unit despawn method and have it randomly spare units that have a maximum of one HP.
 
- That is a bug. There was a previous similar bug about combat and trespassing where units were allowed to cross a locked border to attack a third civ and then would get stuck trying to move into the locked tile if they won combat. I fixed the bug by disallowing moves like that but I guess I missed something. Can you share more about the circumstances where that happens?

- That is not difficult to reproduce. Let's have Civ 1, Civ 2 and Civ 3 where Civ 2 and Civ 3 have the right of passage and Civ 1 and Civ 2 share a border. Move unit of Civ 3 into the border tile of Civ 2. Then attack it directly with units of Civ 1.

I also wanted to ask about a feature that limits the production of units to specific number. If we have something like "Super Death Star" limited to 2 does it allow each Civ to produce 2 units of this type? Can they replenish their losses of such unit(s)? Or is it 2 for the whole map. I have not tested this feature yet but I have high expectations of it.
 
Woo-woo. Some fixes I've hankered for and more. Will instal and test at once, well, after Christtmas anyway. Top work, thanks.

Can you still chop down LM Forests for shields? Would be handy if you couldn't, stops the player from planting forests on virgin land then chopping them down for a 'free' one-off shield bump which feels like cheating.

Here's a tiny request to add to the list - to be able to sell/remove Aquaducts and Sewers - often I take a city that the AI has built these in when there is barely enough food to warrant them. The only options are to raise and start again, or live with the gold loss for the rest of the game. Petty but annoying..

Here's another - currently you can have a building require a number of other buildings or a single one, sweet, but you if you select a multiple building requirement you can build it in a city that doesn't host one of the specified improvements. So you can stipulate you need five libraries in order to build a college, makes sense, but you can then build the college in a city that doesn't even have a library yet, which makes less sense. Is it possible to combine the two building requirements so you need five libraries including one in the city you want to build the college in?

RE: talk about railways - I use these for paved roads (fantasy mod). The extra resources gives the game a proper second act which make logical sense, love it. The fixed speed works for a railway, but not a road though, it means cavalry moves at the same speed as your siege artillery in your own lands. Don't know how hard it would be to have the option to switch between a flat speed or a bonus, but would be useful when you don't use the feature as an actual railway. Although flying creatures would get an unearned bump.
 
Last edited:
Top Bottom