Resource icon

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

The risk of losing bombers is actually quite high once sufficient air defence is created. A stack containing 4 battleships shoots down a bomber with 31.699%, a stack of 4 AEGIS Cruisers with 42.825% and a stack with 4 Mobile SAM with 51.775%. Stealth bombers cut it down to 26.497%, but they cost twice as much as radar artillery with similar bombardement power.

Here's a pre-Conquests link about Ant-Air Defense Combat.
 
Hey Flintlock, have you found anything while digging through the game's code that shows how civs value government types? Ozy pointed out an interesting post in my thread about the subject, and it got me thinking of how to best manipulate civs to follow the time lapse of history in relation to governments.
 
Hey Flintlock, have you found anything while digging through the game's code that shows how civs value government types?
I have, while making anarchy length adjustable. I found the function that evaluates governments for the AI and determines which one it will pick once it emerges from anarchy. I don't know how the AI decides when to overthrow its government, but it probably uses the same function. If you want to bring it up yourself, it's at 0x4446C0 in the GOG EXE. It's already named in the Ghidra archive on GitHub, I called it ai_eval_government.

As for the actual logic, that post by embryodead is correct about what's factored in. For some actual numbers, the AI evaluates governments in points, where 1 point = 1 GPT maintenance. Not having the tile penalty is worth 8 points for each city the AI controls, and the trade bonus is worth another 8 points per city. Military police is worth one point per city. The point value is reduced by how much building & unit maintenance the AI would have to pay under the govt. There is actually (contrary to what embryodead said) a formula for corruption types: minimal is worth 12 points per city, nuisance is worth 8 per, problematic & communal are worth 4 per, and rampant 2 per. Shunned/favorite government is worth 12.5%, i.e., the point value of a civ's favorite government is multiplied by nine-eights and the value of its shunned govt is multiplied by seven-eights, or reverse if the value is negative.

War weariness is factored in too but I didn't look into the details since it's not as obvious as the other stuff. Hope this helps, if you want to know more just ask.
 
Hope this helps, if you want to know more just ask.

It does, tremendously. Thank you. By the way, were you referring to Antal's GitHub? Per your recommendation, I was interested in seeing what files were in there. I need to find/remember what program I used to read the files so I can see their integers. I am jealous of your powers!
 
The risk of losing bombers is actually quite high once sufficient air defence is created. A stack containing 4 battleships shoots down a bomber with 31.699%, a stack of 4 AEGIS Cruisers with 42.825% and a stack with 4 Mobile SAM with 51.775%. Stealth bombers cut it down to 26.497%, but they cost twice as much as radar artillery with similar bombardement power.

This is very interesting. For CCMs2, vanilla and a map I created I was running some tests to see about air activity .
This I posted on the CCMs2 forum

"After some debug games I have to give the nod to Antal1987 exe as being most aircraft intensive followed by a vanilla (with increased bombardment attack values) then the flintlock patch. Mind you my observations are largely anecdotal and in the debug mode I might be missing things that would show up more in the main game."

FYI these are conquest games with diplomatic, space race whatever turned off to drag the game on as long as possible to watch for air activity.
In general i did not notice a whole lot of air activity compared to, for example, what I remember about Civ 2 and the "ant farm" games I ran with that.
And certainly not at all compared to the amount of ground and sea activity. For the most part, I have observed in AI vs AI games it is quite safe to move units around and not get airblasted.

But You may have explained it, the aircraft are quite readily destroyed because of strong AA and along with that I wonder if AI calculates any risk reward? Hence it is just not worth it for the AI to build them compared to ground/sea forces.

In short I wonder if this is something that can be addressed with editing aircraft values or something that is better done with the .exe.
:
 
It does, tremendously. Thank you. By the way, were you referring to Antal's GitHub?
You're welcome. I was referring to my own GitHub for C3X: https://github.com/maxpetul/C3X, the relevant stuff is in the "Decompilation" folder. As far as I know Antal never shared his work labeling functions inside the EXE, though he did help me a lot by sharing his work decoding the data types. Those files in Decompilation are Ghidra project archives so you'd need to use Ghidra to open them. I posted a bit about how to use Ghidra here: https://forums.civfanatics.com/thre...es-in-exe-modding.666881/page-7#post-16066922 but don't use the project attached to that post since it's old and missing a lot by now.
"After some debug games I have to give the nod to Antal1987 exe as being most aircraft intensive followed by a vanilla (with increased bombardment attack values) then the flintlock patch. Mind you my observations are largely anecdotal and in the debug mode I might be missing things that would show up more in the main game."
C3X affects the AI's production choices but it shouldn't be preventing the AI from building air units, at least not directly. The only change it makes to air production is to switch the AI's choice from fighters to bombers to keep a minimum ratio of 7:10 bombers to fighters. The point of that change was to stop the AI from stockpiling dozens or even hundreds of unused fighters, as it sometimes does. To test this change I watched the AI play a few games in debug mode, and I remember one game having almost no air combat. It's possible that there's some subtle bug in the mod that's causing that, but I doubt it. I think the reason is that the AI doesn't build many air units unless it's triggered to do so by getting bombed itself. So human players usually see the AI with a large air force, since they provoke it to build one, whereas AI vs AI wars often feature few air units since neither side provokes the other to build any.
 
Good point, I forgot that bombers were much weaker before Conquests.

I went ahead and looked up the criteria for the mobilization bonus in the decompilation. Most of the relevant code is in a function located at 0x4BFEE0 in the GOG executable, which is already named in the Ghidra project on GitHub. The rest of the code, a small but important piece, is located after the call to that function, for whatever reason. Translating the code to English: A unit being built receives the mobilization bonus if its attack strength is greater than zero and neither of the following applies:
  1. Its transport capacity is > 0, it does not have the "Transports Only Aircraft" ability, and it does not have the "Transports Only Tactical Missiles" ability
  2. It has zero attack, zero defense, zero bombard strength, and does not have the "Nuclear Weapon" ability
So it's clear that the developers deliberately excluded troop transports from the mobilization bonus. That's a bizarre choice IMO, but it's not a bug. And the reason bombers and artillery don't get the bonus while stealth fighters do is due to attack strength. I don't know if they implemented the strength check with that in mind.

The second condition looks like it can't even ever be matched anyway: The target needs to have an attack > 0, but the second condition, which is evaluated afterwards, requires an attack = 0. So anything that would pass the second test wouldn't pass the first one anyway.


Flintlock said:
I think the reason is that the AI doesn't build many air units unless it's triggered to do so by getting bombed itself. So human players usually see the AI with a large air force, since they provoke it to build one, whereas AI vs AI wars often feature few air units since neither side provokes the other to build any.
I remember exactly this being reported in vanilla C3C years back, too. The AI sucks at taking the "air initiative". Faint memories say that they did this much better in Civ3 vanilla. I never played PtW.
 
I wish there was a way to make the AI use fighters to establish offensive air superiority by looking to shoot down your fighters (preferably before they send in their bombers). The closest I can get is to have the AI use a SW auto producing fighters that are 'air bombard' strategy and mod fighters to have the same attack as defense stats.
 
The second condition looks like it can't even ever be matched anyway: The target needs to have an attack > 0, but the second condition, which is evaluated afterwards, requires an attack = 0. So anything that would pass the second test wouldn't pass the first one anyway.

The second condition seems to be meant to enable the mobilization bonus for nuclear weapons, but as they have attack zero it will not apply.
 
Greetings Flintlock,

Thanks again for all your work on C3X! I have done some play-testing of the land-sea intersections mechanic and have two points to report that you might consider bugs. [These tests were done with version 8 of C3X]

1. Currently, harbors do not seem to allow the connecting of resources through the new land-sea intersections.

2. It appears that in the CivIII code, a body of water is considered "freshwater" if it consists of 20 or fewer water squares. It does not matter if it is purely coast or some combination of coast, sea, and/or ocean; the cutoff is 20 squares. Thus, if a city is built next to a little pool of water at most 20 squares large or smaller, the city cannot build boats or buildings like harbors. Currently, the land-sea intersection code still treats the land-sea intersections as boundaries on bodies of water for the purpose of this calculation. Thus, a city on a C3X "coast river" would not be able to build boats to sail on the river.

Even as things stand, the land-sea intersections are still a great boon to custom map design and have, for instance, greatly improved the map of my multiplayer scenario.

I would be delighted if you added these two items to your list!
 
Thanks again for all your work on C3X!

:goodjob:

It appears that in the CivIII code, a body of water is considered "freshwater" if it consists of 20 or fewer water squares. It does not matter if it is purely coast or some combination of coast, sea, and/or ocean; the cutoff is 20 squares.

I think the actual number is, "23." - And: Some nice points, @Sutsuj :clap:
 
I would be delighted if you added these two items to your list!
Sure thing. I set up a scenario to test trade routes through land/sea intersections and noticed something curious. But first, trade routes do pass through the intersections as far as I can tell. Here's the setup I used:
trade_thru_land_sea_intersection.png

It's based on a scenario I made for testing my fix for the phantom resource bug so the resource's icon is "35" b/c it's the 35th resource (and notice: no phantom resource). What's curious is that I did this little test, saw the result above, and then realized I had forgotten to toggle on land/sea intersections in the mod config. So I tested again with the unmodded executable and found that the trade route still passes through the intersection. So that's how trade routes work in the original game. It's surprising since I've never seen that mentioned anywhere. And I'm sure I didn't accidentally test with C3X active both times since the second time the phantom resource (saltpeter in this case) did appear.

About the second thing you mentioned, I'm sure I could make that happen, it would just require some effort to program. In fact I thought of that issue briefly when I was implementing land/sea intersections in the first place but didn't consider it a priority. I'm more likely to do it now knowing it's something people care about.
 
:eek: Mind-boggling, there's still things we're learning about this game 21 years later.

I wanted to say that I think removing the phantom resource bug is an extremely important addition. Not being restricted to only 32 strategic and luxury resources is game-changing. What I think would also be most transformative to how we mod and play Civ3 are:
  1. removing the resource limit altogether
  2. removing the improvements (buildings) limit altogether
 
:goodjob:

I think the actual number is, "23." - And: Some nice points, @Sutsuj :clap:

Thanks Ozymandias! I don't know if C3X is different from original CivIII in this regard, but I was definitely able to get a city to build a ship with a body of water only 21 squares large. However, I was not able to do this with a body of water 20 squares large. Here's an example of the 21 enabling galleys:

Proof_of_21.png


City_with_horses.png
 
Sure thing. I set up a scenario to test trade routes through land/sea intersections and noticed something curious. But first, trade routes do pass through the intersections as far as I can tell. Here's the setup I used:
<image>
It's based on a scenario I made for testing my fix for the phantom resource bug so the resource's icon is "35" b/c it's the 35th resource (and notice: no phantom resource). What's curious is that I did this little test, saw the result above, and then realized I had forgotten to toggle on land/sea intersections in the mod config. So I tested again with the unmodded executable and found that the trade route still passes through the intersection. So that's how trade routes work in the original game. It's surprising since I've never seen that mentioned anywhere. And I'm sure I didn't accidentally test with C3X active both times since the second time the phantom resource (saltpeter in this case) did appear.

About the second thing you mentioned, I'm sure I could make that happen, it would just require some effort to program. In fact I thought of that issue briefly when I was implementing land/sea intersections in the first place but didn't consider it a priority. I'm more likely to do it now knowing it's something people care about.

Thanks for considering this Flintlock! That's fascinating. I had no idea the base game worked that way.

My test had a chain of intersections. Perhaps that is what made the difference. In the City View of Ur from my reply to Ozymandias immedately above and in the two images below, you can see that Ur can build horsemen but Sumer cannot.

River_Connection.png


City_without_horses.png
 
Great to see this is still in development, I was using it for a game today and had forgotten about the improvements to the AI's use of artillery. I grabbed a couple of US cities early on using an army of Roman legions, and imagine my surprise when a rather large group of catapults guarded by spearmen marches towards me to try and take it back (and of course when I managed to capture some of them, stack bombard is a nice feature as well)!

It's a small thing but I really like that you've managed to add 'ease of use' features that make use of the in-game UI rather than as a completely separate window or even a separate program. It keeps the immersion and makes it feel like a proper update rather than a hack. Looking forward to what you come up with next.

I did notice a discussion about a rather amusing bug this morning, apparently if your first and only city is destroyed by a volcano, you automatically win by conquest! Not sure it's really worth looking at as it's difficult to make that happen by accident, but figured I may as well mention it.
 
Alekseyev=>>I remember exactly this being reported in vanilla C3C years back, too. The AI sucks at taking the "air initiative". Faint memories say that they did this much better in Civ3 vanilla<<

Maybe it can be figured out what changed between the two versions in this regard .

Predator145=>>I wish there was a way to make the AI use fighters to establish offensive air superiority by looking to shoot down your fighters (preferably before they send in their bombers). The closest I can get is to have the AI use a SW auto producing fighters that are 'air bombard' strategy and mod fighters to have the same attack as defense stats<<

That is an interesting work around, the aircraft to have a low defense so maybe upping that will change some type of behavior. But anyways since AI does use the aircraft once the human player attacks it is not as noticeable and problematic, certainly not like the glaring sub bug and some other things that were already corrected by the exe fix.
 
Hey Flintlock, for the next version of this could you shift the hotkey for viewing the AI's city founding preference overview from the L key to something else, possibly the O key?

I don't believe the O key has any hotkey function assigned to it in Civ III, at least not from what I could observe when testing it recently anyway.

The reason I'm asking is because for me it is really tedious to manually click load/unload for units that I'm loading onto transports, or transports that I'm unloading units from, and I suspect that there will be other people out there using the mod that feel the same. I can say that the Ctrl+L and Shift+L keys are both already assigned to a couple of hotkey functions, which from memory Ctrl+L is load game and Shift+L is open up one of the advisor screens, so neither of those key combinations are able to be used instead for activating/deactivating the overview.

Apart from that request, this mod is extremely useful to have installed, I really like what you are seeking to do with it and I strongly commend you for taking on this project to make Civ III better for everyone that still plays it. Keep up the great work.

Cheers, Jakob.
 
Hey Flintlock, for the next version of this could you shift the hotkey for viewing the AI's city founding preference overview from the L key to something else, possibly the O key?
Yeah, seconded!

Bitter experience has taught me to (prefer to) use the hotkeys rather than than the unit-action buttons for the most part, so when I finally got round to installing R9 yesterday, it was rather irritating to find that the 'L[oad]' key had been hijacked.

(I'd assumed that this setting would have been set to 'false' by default in the C3X_R9 config file — but I fully admit it's on me for not having double-checked that before booting up the game...)
 
Last edited:
Interesting you guys mention this now, I myself just recently stumbled over the hijacking of the L key while playing a game. I fixed it by making the unit load command take precedence over activating the city location highlighter. That fix will appear in R10 which is coming soon. Remapping the highlighter to O would work too but I like having it bound to L since it's supposed to be short for "location", as in AI city location. Similarly the P key binding is supposed to be short for "production". At first I wanted those key bindings to include shift, control, or alt, but that turned out to be surprisingly difficult since the game processes those key presses in some functions other than the ones I'm familiar with.
 
Top Bottom