Resource icon

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

You are correct ToW are 0 air def, I had given them credit for shooting down planes in the past, but it must have been another unit. I cannot be sure that there was a Battery in those towns at the time of the bombing, so just having mobile sam units could be just poor luck that none ever scored. DD is the USN designation for destroyer.
 
The other thing I wanted to do before R11 (the first thing was resource generation by buildings) was allowing buildings as prerequisites for unit construction. That's done too. It took a while but doesn't make for an interesting story. The gameplay code modifications were simple, I just had to modify the single function that determines if a given city can produce a given unit. The hard part was reading in the rules from the text config. The mod is written in C and doing text processing in C is always a pain. Here's an example of what it looks like in the config:
Code:
building_prereqs_for_units = [Factory: Tank "Modern Armor",
                              Barracks: Swordsman Cavalry Tank "Modern Armor",
                              Airport: Bomber]

Flintlock, if I understand this correctly, this very important new option can be used by simply writing the text into the default.c3x_config file. :hatsoff:

If this is not so easy, may be the following entry in the Quintillus editor about building telepads (what have no real use in gameplay) can be used for setting the building prerequisites for units:

Units-Buildingprerequisite.jpg


In my eyes alone the new option of a building as prerequisite for a unit would be worth the next release of your fantastic mod. :)
 
Last edited:
It's an amazing feature! Now we just need to make sure to also perfume these buildings so the AI considers them worth making in the first place. :D

And @Civinator I do indeed understand it that way that it is simply done via the txt file, so no need for a modified editor.
 
Flintlock, if I understand this correctly, this very important new option can be used by simply writing the text into the default.c3x_config file.
If this is not so easy, may be the following entry in the Quintillus editor about building telepads (what have no real use in gameplay) can be used for setting the building prerequisites for units:
That's correct, although it would be more appropriate to put it in the scenario config. It probably would have been easier to use the "Legal Building Telepads" instead of reading names from the config, but it's nice to have a system for reading names from the config so that it can be reused for other things like reading resource & building names for resource generation. Speaking of which, here are the entries in the default config for these features, along with their descriptions:
Code:
; Here it's possible to set buildings as prerequisites for unit production. Each unit type can have up to 10 prereq buildings.
; The format is a list of building names and unit type names, each one looks like "building name": "unit type 1" "unit type 2" ...
; Quotation marks are not necessary around names as long as they are one word and don't contain any weird characters.
; Here's an example:
; [Factory: Tank "Modern Armor",
;  Barracks: Swordsman Cavalry Tank "Modern Armor",
;  Airport: Bomber]
building_prereqs_for_units = []

; Here it's possible to set buildings to generate resources. Those resources can be added to the trade network or limited to the building's city.
; The format is a list of building name and resource name pairs with an optional "local" keyword before each resource name. Here's an example:
; ["Steel Mill": Steel, "Coal Liquefaction": local Oil]
; The keyword "local" means that the produced resource will not be added to the trade network, it will be available only in the building's city.
; Buildings will not generate resources if the resource requirement for the building itself is not met. This makes it possible to set up resource
; production chains. Note for modders: Production chains require the input resources to be listed before the outputs in the scenario data, when the
; inputs also come from buildings. For example if you have iron ore on the map, a building that requires it and produces iron, and a building that
; requires iron and produces steel, iron must be listed before steel in the scenario data or the chain won't work. This is because building resource
; generation is calculated in the same order as the generated resources appear in the scenario data. This limitation does not apply to map resources
; (iron ore in the example) as access to all map resources is calculated first before any building resources.
buildings_generating_resources = []
I hope the descriptions are clear, please tell me if they're not.

I'll try to get the next version posted soon. I actually finished coding it a few weeks ago but have been slow about giving it a final testing pass, partly because I've been busy and partly because I find testing to be tedious.
 
Probably not something you could do, but I play RARR and there is a small wonder called the Iron Works, which needs to have both coal and iron it the resource box.

Whenever I get the warning that I can build the Iron Works, it is often a chore to find the city where the small wonder can be built.

Would it be possible for the splash letting me know that I can build it to also include the city where it can be built?
 
I hope the descriptions are clear, please tell me if they're not.

; Here's an example:
; [Factory: Tank "Modern Armor",
; Barracks: Swordsman Cavalry Tank "Modern Armor",
; Airport: Bomber]
building_prereqs_for_units = []

So in your example above, a "Modern Armor" and a tank need both, a factory and barracks in the city where these units can been built ?

=> are the two buildings needed cumulative in the city to produce a tank or are the two buildings alternative, so it is sufficient, when only one of them is in the city that should produce a tank ?

What happens, if tons of units (fifty or more) are needing the same building in the city, so that the list of units in the []-part of the default.c3x_config file becomes longer than one line?

Is a unit name connected by a hyphen (p.e. T-34) counting as one name, so writing "T-34" is not necessary ?

Would names like T-34/76 be possible in that list ?
Flintlock, these new options can become great new features for C3C ! :hatsoff:
 
Last edited:
Probably not something you could do, but I play RARR and there is a small wonder called the Iron Works, which needs to have both coal and iron it the resource box. Whenever I get the warning that I can build the Iron Works, it is often a chore to find the city where the small wonder can be built.

ynot56, when you open the trade advisor in your game, you get a list of all your strategic resources in your territory and a description about the location of those resources. Per example for the iron works you must only have a look if there are iron and coal resources listed in that advisor and if yes, if their locations are suited to build that SW in a founded city, or if a new city can be founded in your territory, that is able to build that SW.

Trade Advisor.jpg
 
Yep, I know about that screen.

But it is often very difficult when you put your cursor over the resource to tell which city has precisely which resource, particularly if your civilization is fortunate to have a lot of resources/luxuries. When there are a lot or resources, the "local" bar can be very compressed and even though you get the pop up, it can be difficult to tell which resource relates to the popup.

And you have to do it twice, once for coal and once for iron and see where they match.

And, one of the resources could be nearer to another city but still within range of a city with coal to build the Iron Works, so it would not show up as belonging to the city capable of building it.

It is certainly possible to track down, but it is harder to do than it should be, since the game tells you you can build it. Just not the city where it can be built.
 
Would it be possible for the splash letting me know that I can build it to also include the city where it can be built?
That's doable, unless there's some nasty little issue I'm not expecting. Modifying popups is easy, the only challenging part might be identifying the available cities. I'll add this to the list.

=> are the two buildings needed cumulative in the city to produce a tank or are the two buildings alternative, so it is sufficient, when only one of them is in the city that should produce a tank ?
The prereq buildings are cumulative. They must all be present for the unit to be buildable.
What happens, if tons of units (fifty or more) are needing the same building in the city, so that the list of units in the []-part of the default.c3x_config file becomes longer than one line?
Right now splitting the list of unit names across multiple lines doesn't work. It's easy to make it work, so I'll go ahead and do that.
Is a unit name connected by a hyphen (p.e. T-34) counting as one name, so writing "T-34" is not necessary ?
Yes, two hyphenated things are considered one word. A name doesn't need to be quoted as long as it's made up of all letters (a-z or A-Z), digits (0-9), periods, hyphens, or underscores. I should mention that in the config descriptions somewhere.
Flintlock, these new options can become great new features for C3C ! :hatsoff:
Thanks!
 
Right now splitting the list of unit names across multiple lines doesn't work. It's easy to make it work, so I'll go ahead and do that.

It´s great that you add the multiple line ability to your mod, as the splitting of the list with 31 civs and their civ-specific units can be reached very quickly. :)

A name doesn't need to be quoted as long as it's made up of all letters (a-z or A-Z), digits (0-9), periods, hyphens, or underscores. I should mention that in the config descriptions somewhere.

So the sign / in the correct unit name T-34/76 would not be accepted, or must it be written "T-34/76" ?
 
Last edited:
Regarding the IronWorks question, CAII is able to report which towns can build which Wonders, so the information is definitely extractable from the save, e.g. perhaps by looking at the build-list for each town.

Edited to add:

@Flintlock:

I started my current solo game (Mayans, DG, mostly-all random settings) to compare gameplay using the unpatched Firaxis .exe, with gameplay on the C3X_R10-patched .exe with all options turned to 'Firaxis-basic' (i.e. no AI-artillery, no AI-Armies), at least in part to test whether it would be 'safe' to use the patch-associated stack-commands, improved GUI (Terrian-chop status) and "no-haggle" Diplomacy, while also playing SGs.

But at 950AD, I started getting what seems to be a consistent crash over the interturn, which seems to be associated with the C3X_R10-patched .exe.

After hitting End Turn (with most animations turned off, but AI-moves shown), the crash occurs very shortly after the Byzantines finish shuffling their land-units towards/across the Jungle-chokepoint overlooked by my Horsemen -- possibly during the Japanese(?) movement-phase, just before a Dromon-pair is attacked by a Japanese Galley. I got this crash three times on three separate crash-and-restarts. The second restart was on a freshly powered-up computer.

After the third crash, I exited the game, deleted the patched .exe, renamed the Firaxis-backup, then restarted using the Firaxis .exe. This time the crash did not occur, the Dromons sank the Galley, and my research on Banking completed. I've attached the crashing-save below, plus the one I made just after the Firaxis-completed interturn, for you/ others to test.

Further EDIT

Just tested the same 950 AD savegame on C3X_R9 (I still have that folder and all its files inside my ../Conquests folder), and got no crash using that, either -- at least with the C3X_R9 .ini.

But when I replaced that C3X_R9-folder .ini with the one from the C3X_R10 folder, two things changed: I got a notification when starting the game about the "lost turn" bug not being recognised -- and the crash re-occurred. So I've uploaded the .ini I was using as well (I appended the ".doc"-extension to the filename to get it to upload to CFC, so that would need to be deleted to make the .ini usable again...)
 

Attachments

  • Smoke-Jaguar of the Maya, 950 AD.SAV
    175.4 KB · Views: 6
  • Smoke-Jaguar of the Maya, 960 AD.SAV
    175.3 KB · Views: 5
  • default.c3x_config.ini.doc
    5.7 KB · Views: 6
Last edited:
So the sign / in the correct unit name T-34/76 would not be accepted, or must it be written "T-34/76" ?
Just always put all units within quotation marks and you'll be safe. :) Having some with and some without would only look like a mess.
 
Another thing I'm working on is forcing the AI to build more artillery in general. This is much easier, like I mentioned before, I know what function is responsible for making the AI's build choices so I can intercept its return and adjust its decision. I am concerned that all this effort is going to backfire, though, by making the AI an easier opponent. If the AI builds a lot of artillery and sends it into battle but doesn't defend it properly, against a human player it's just donating units. The only way I can think to solve this problem would be to replace the defensive unit AI too, because, as far as I can tell, in the base game there isn't any coordination between units. Specifically, artillery units will move somewhere to attack on their own (if outside a city) then it's up to some defensive unit to notice they're exposed and move to cover them, but there's no guarantee that any will decide to or that any will even be available to. I wonder if the AI's inability to use artillery is actually an intended behavior to avoid these kinds of problems. If so the only proper solution would be a thorough overhaul of the unit AI, which would be a lot of work, but it's just plausible enough to be tempting. But it will probably never happen.

I think you very much went outside the game designers intended game and did something drastically different by significantly increasing how much artillery AI makes. What you've tried to do to make the AI have a smart combined arms stack I also think unlikely that the game designers intended. What would such look like to a new player, and even semi-experienced, with a smart AI combined arms stack coming at them? I'm not sure that they wanted that much challenge. Also, there exist some comments on the internet suggesting civ III the toughest of the series.

Also, consider the industrial era after Replaceable Parts and before tanks. There exist old notes around calling such a stalemate. ICS combat settlers were not part of intended play by the game designers ... they were trying to get rid of ICS as optimal, as evidenced by the increased settler cost and corruption model. Multiple armies by the human player attacking probably were part of the intended game play, but that takes more effort than combat settlers. That probably was part of the intended means for players to break the stalemate of such a war.

I also believe that pillaging of rubber even deep inside of AIs territory was part of the intended way to play for players.

But, with the number of artillery around my experience leads me to believe that such becomes rather difficult or can be significantly costly, more so than the game designers intended.

I had a cavalry army (with explorers) going around pillaging in an Emperor Always War game. I would take care, most of the time, not to end up directly adjacent to a city and I could pillage a lot with rifles around. But, then the richest civ on the map, the Dutch, got infantry and artillery proper two or more turns after I had started pillaging their land, and my cavalry army got bombarded to the red and killed.

upload_2022-7-10_22-25-23.png


I wouldn't expect a much newer player to use an army for pillaging, or a rifleman or infantry army. And with so many artillery around possibly almost anything trying to pillage would likely be dead well before it got to rubber a ring or two inside of AI territory in a very large proportion of cases.

On the other hand, the army change though does seem like a bug fix.
 
Last edited:
So the sign / in the correct unit name T-34/76 would not be accepted, or must it be written "T-34/76" ?
Yes, you'd need the quotation marks in that case.
But at 950AD, I started getting what seems to be a consistent crash over the interturn, which seems to be associated with the C3X_R10-patched .exe.
How annoying. Unfortunately I can't reproduce this crash so there's not much I can say or do about it. I tried both the GOG & Steam versions of R10 with & without your INI. In all cases the game proceeded to 960 AD like normal. I'm curious, were you using the original R10 or the patched R10B? Not that that should make a difference, the patch fixes a crash that was only affecting scenarios with more than 32 resources.
I think you very much went outside the game designers intended game and did something drastically different by significantly increasing how much artillery AI makes. What you've tried to do to make the AI have a smart combined arms stack I also think unlikely that the game designers intended. What would such look like to a new player, and even semi-experienced, with a smart AI combined arms stack coming at them? I'm not sure that they wanted that much challenge. Also, there exist some comments on the internet suggesting civ III the toughest of the series.
Even though the AI now builds plenty of artillery and sends it out into the field, its artillery usage still isn't what I'd call smart. It usually doesn't assemble combined arms stacks and when it does it's only due to chance or because it has no choice, for example attacking through a choke point. What usually happens is that its attacking units run off on their own and die while the remaining artillery-only stack is uselessly bombarding a city with no attackers to follow up on the damage. The human player can take advantage of this by making sure to pick off any attackers around the AI's artillery stack, which in some circumstances can neutralize it as a threat. For example, I had a game where I was cavalry rushing the AI. It had a stack of 15 or so cannons and trebs but it sent that off to attack a small, irrelevant, corrupt jungle city on the border. I made sure to pick off any attackers in the area and so the artillery stack wasted 10 turns pointlessly redlining the defenders in that city meanwhile my cavalry overran most of the AI's territory.

I would like to take another look at the AI artillery production logic at some point. As it is right now, it's too tilted toward human-like army composition and industrial era warfare. That's what I was thinking of when I set the build ratio to 20. I did try to fix it somewhat, that's what the ai_artillery_value_damage_percent config option is for, but I think I can do better. The AI doesn't properly understand that, before the industrial era, it's not worth it to try to build enough artillery to redline all defenders when attacking a city, but it is still worth it to build enough to knock off one hit point from each. Though the reason I haven't looked into this yet is that I don't think it will help the AI much given its inability to coordinate its attackers & artillery. I.e. three catapults are effective in a stack with swordsmen but on their own they're useless or worse than useless as free units for the enemy.
I also believe that pillaging of rubber even deep inside of AIs territory was part of the intended way to play for players.
I don't know what the developers intended but IMO it's too easy for human players to exploit the fact that the AI is unwilling to attack high health armies. I consider the fact that it can bombard down armies first to be an improvement. In fact I'd like to go even further and teach it that it's worth it to sacrifice a few individual units to kill an enemy army. Unfortunately the way the unit AI is structured makes it difficult to coordinate actions involving multiple units. The reason the AI doesn't attack high health armies is that each unit is processed individually, so each one looks at the army, reasons that it has virtually no chance to win attacking on its own, and so chooses not to.
On the other hand, the army change though does seem like a bug fix.
Having seen inside the EXE, it definitely is a bug fix. Actually there were two major bugs affecting AI army usage. First was some logic that must have been intended to prevent the AI from adding units to an army that would slow it down. The problem was that it compared the unit's speed to the army's speed and failed to consider that armies have an extra move. For example, an army with a knight in it has 3 moves, so the AI wouldn't add any additional knights since they have only 2 moves. Second the AI wasn't creating many armies in the first place since it was using its MGLs to rush any kind of city production, which it should not have been able to do.
 
I think you very much went outside the game designers intended game and did something drastically different by significantly increasing how much artillery AI makes. What you've tried to do to make the AI have a smart combined arms stack I also think unlikely that the game designers intended. What would such look like to a new player, and even semi-experienced, with a smart AI combined arms stack coming at them? I'm not sure that they wanted that much challenge. Also, there exist some comments on the internet suggesting civ III the toughest of the series.
If you want less of a challenge, there is always difficulty levels to adjust. The AI being inept at artillery unit usage while cheating at so many other aspects certainly isn't something that was desired by many.

Also, consider the industrial era after Replaceable Parts and before tanks. There exist old notes around calling such a stalemate. ICS combat settlers were not part of intended play by the game designers ... they were trying to get rid of ICS as optimal, as evidenced by the increased settler cost and corruption model. Multiple armies by the human player attacking probably were part of the intended game play, but that takes more effort than combat settlers. That probably was part of the intended means for players to break the stalemate of such a war.
Artillery comes with the same tech as infantry. Stacks of infantry make for a hard to move front line (WW1 style), but can be ground down by stacks of (rather cheap) artillery. Railroads really help with this. It is by no means a stalemate, and cavalry is still viable at this point. I believe that artillery and infantry coming at the same technology was not without a reason.

I also believe that pillaging of rubber even deep inside of AIs territory was part of the intended way to play for players.
I think that is very much an assumption of your own, without anything to back it up.

But, with the number of artillery around my experience leads me to believe that such becomes rather difficult or can be significantly costly, more so than the game designers intended.
Again just your assumption.

I had a cavalry army (with explorers) going around pillaging in an Emperor Always War game. I would take care, most of the time, not to end up directly adjacent to a city and I could pillage a lot with rifles around. But, then the richest civ on the map, the Dutch, got infantry and artillery proper two or more turns after I had started pillaging their land, and my cavalry army got bombarded to the red and killed.
That's excellent - just how it should be. A lone army shouldn't be an invincible unit.
 
Another feature idea that just came to mind after replying to a different thread: With the sub bug fixed, do you think it would be possible to also add a scenario-specific config file to force declare a war between civs after a certain number of turns? (Or to have two civs start at war with another without the need for a locked alliance war)
 
If you want less of a challenge, there is always difficulty levels to adjust.

Of course difficulty adjusted is possible for another game. However, with a more difficult AI, gradations of difficulty likely become narrower for human players. Also, there exist fewer possibilities of strategies that work.

Stacks of infantry make for a hard to move front line (WW1 style), but can be ground down by stacks of (rather cheap) artillery.

So an AI can do that. Not every Dutch city looks like this, but I took at The Hague a little later. I counted 21 artillery inside of it, and this is only Emperor. It's also only a standard sized map. And I had done pillaging.

upload_2022-7-12_18-39-42.png


Supposing that I were to advance a stack WITHOUT combat settlers towards this city, wouldn't a fair number of units get bombarded, then attacked, and killed by the Dutch? Possibly the artillery wouldn't be in that city, if I had a sizeable force of units closer to that city, they might not sit in there.

I'm not objecting to Flintlock doing what he's doing. It is interesting to me.

I don't know what the game designers intended. But, I think the artillery changes, and the desired artillery changes of AIs using them smartly, are not a bug fix. They definitely fall along the lines of a mod that has a different concept about how the game best works. The mod is not a "patch" in how artillery works. It's a mod.
 
The AI doesn't properly understand that, before the industrial era, it's not worth it to try to build enough artillery to redline all defenders when attacking a city, but it is still worth it to build enough to knock off one hit point from each.

If one redlines all defenders before the industrial era, then one has less probability of elites dying while attacking. An elite archer attacking a redline spear can lose, and I think I had one lose lately, and that implies it can more easily lose when attacking a 2/3 or 2/4 spear. Also, elites don't wound as much with more wounding of enemy units, and need less time to heal away from barracks before attacking again. Army production thus can be quicker with redlining of as many AI units as possible before the industrial era when attacking a city.
 
Flintlock updated C3X with a new update entry:

Release 11

New in this version:
- Buildings can generate resources
- Buildings can be set as prerequisites for unit production
- On the city screen, hold shift when clicking a specialist to switch to the previous type
- Can cancel out pop pollution with negative pollution amount on building flagged as removing pop pollution
- Disallow workers from improving water tiles
- Exempt invisible and hidden nationality units from trespassing restriction
- Do not group units with differing charm statuses

Read the rest of this update entry...



Edit For some explanation of the cancelling out pop pollution thing: I implemented what I mentioned here: https://forums.civfanatics.com/thre...s-in-exe-modding.666881/page-31#post-16236956. That is, the pollution calculation is adjusted so that a building that's flagged as reducing pop pollution applies its pollution amount to the pop pollution "category" instead of the building category. This doesn't change anything under the standard rules, but it makes it so that modders can completely eliminate pop pollution by putting a large negative pollution value on a mass transit like building. Or, if they prefer, can put it on a hospital like building so pop pollution never appears but level 3 city sizes are still gated by a building.
 
Last edited:
Top Bottom