Resource icon

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

By compensating that problem of the additional line by shifting the misplaced labels forward one spot, I hope that this is not disturbing the multiplayer functionality of the steam version, as this is the only advantage the steam version has compared to the GOG version.
I can't imagine how it would stop multiplayer from working. In the worst case scenario it would just mess up the labels like they already are when you use the wrong labels.txt.
 
One thing that I didn't expect with having buildings as a prereq for building certain units, is that you can still build an obsoleted unit in a city if it doesn't have the building needed to make the new unit. For example, I have cavalry obsoleted by early tanks. And to build an early tank you need to have a factory in the city. However, you can still build cavalry, even after the tech for early tanks has been discovered, if the city doesn't have a factory. Not a big problem, just something I didn't anticipate.
 
Does "Unit limits (stops players from producing units of a given type once they reach a maximum quantity)" apply to all players including AI?
 
Adding R18's new stuff now. Building resource generation adds a lot of new options. Unit limiting sweet too, although by number of buildings as well as cities would have been even sweeter (I have no idea of what is technically possible of course).So many per Barracks and so forth. Busy adding 600+ units to the config file (phew).

I guesss we all have a wish list for this. I would like to have civs placed near selected terrain types and resource types so civs can start near their cultural homelands (Norsemen near mountians and fish and so forth).
 
Thanks again to Flintlock for doing a great job creating and maintaining the C3X mod.
I noticed a few small problems with the mod.
1. Sometimes the route of movement of units when using a combination of roads and railways is not chosen optimally.
For example, the script settings are given:
- driving on the road =6;
- movement by rail (in the scenario - imperial road) =12;
- unit movement =2 (along the road =12, along the imperial road also =12).
The picture shows the movement of two units between the cities of Massilia and Ariminum. The shortest distance between cities is 11 tiles.
Unit 1 goes from Massilia to Ariminum, the length of the C3X route is 11 tiles (optimal).
Unit 2 goes from Ariminum to Massilia, the length of the route C3X is 12 tiles (not optimal).
The thin red line is the unit movement suggested by C3X.
Blue line - the section with the imperial road is used.
The green line is one of the sections of the optimal route (with a regular road).
Unit 2 prefers to travel along a longer section with a railway instead of traveling along a short section with a regular road.
Moving_units.jpg

2. Problem when city defense structures fire at passing ships. A ship that has received health damage down to level 0 (and the workers on it) hangs on a water tile. After the destruction of this civilization, the workers disappeared, but the ship remained in the game. The pirate ship of the AI civilization (not barbarians) disappeared 20-25 turns after freezing, the reason for the disappearance is unknown. It is impossible to attack these ships with your own ships. They can only be fired upon by ships with lethal bombardment, but they could not be sunk.
Bombing_of_ships.jpg

3. In some scenarios, military units can build roads, fortifications and clean up pollution. The description of the action before the unit name is very useful information. But it does not allow you to visually quickly identify units that are working.
Therefore, I ask you to return the “blue indicators” to the unit activity menu (or the ability to configure them), if possible.
I also ask you to replace the “green indicators” (with or without a sword) with “red” ones for stationary units.

4. Addition to the calculation of the cost of maintaining units - extra_unit_maintenance_per_shields.
If I understand correctly, then each unit with a construction cost above the specified limit extra_unit_maintenance_per_shields = X counts as 2, 3 or more units.
For example:
- in government type settings, the cost of maintaining a unit = 8;
- number of free units = 30;
- in the C3X_R18B settings it is specified - extra_unit_maintenance_per_shields = 100.
I have 30 units that require payment, of which 4 cost 150, and 1 costs 250. Then in the units window (F3) it will be indicated that I have 36 units, and the cost of their maintenance = 48.
Did I count correctly?
Is it possible to add a unit cost factor (or %) from the government type specified in the settings?
For example, the coefficient will be set to 0.6. Then the maintenance of each unit costing 0-99 will be =4.8; 100-199 will be =9.6; from 200-299 it will be =14.4.
This will allow you to more optimally adjust the cost of maintaining units during the game, without making changes to the *.biq file.
Rounding to whole numbers can be done in two ways:
- immediately: 0.6*8=4.8 (=5), in the above example 5*6=30;
- when calculating the final amount: 4.8*6=28.8 (=29).
Is it possible to add such changes to C3X?

A few more proposals, some of which have already been voiced earlier.
1. Prohibition of pollution in impassable areas.
Some scenarios have impassable areas. For example, in the Rise and Fall of the Roman Empire (RFRE) scenario, these are mountains, volcanoes and swamps. These tiles are often contaminated by cities and volcanoes, but workers can never clean them up.
Is it possible to prevent the appearance of contaminants on impassable tiles? After all, marine tiles do not suffer from pollution. Or another option is to automatically clear impassable tiles after X moves.

2. Resumption of workers' activities after interruption of work.
Often the work of units is interrupted due to enemy attacks on workers/military units who are improving tiles or removing pollution. For example, 5 workers are building a road, 70 out of 75 are built. There is only 1 turn left. It's a shame that the work will have to start all over again.
Is it possible to make it so that the amount of work performed on a tile is remembered, and re-construction after an interruption begins not from 1, but from 71?

3. "Rubber" tiles.
When there are a lot of units in the game, they invade enemy territory in a huge mass. There can be 100 or more units on one tile. This looks implausible. Is it possible to limit the number of units that can be on one cell at the same time?
There may be multiple restriction settings.
1) No more than X units in total - this gives preference to certain types of units.
2) No more than Y units of each type - forces the use of different types of units.
3) No more than Z units in the city, but taking into account the values of X and Y - depending on its size (number of residents).
This will force players to expand the front line, organize defense not only in the cities themselves, but also in the surrounding cities. This is especially important for 20th century scenarios where the front line must be continuous.
This rule should not apply to units building roads, mines, fortifications or removing pollution (having a "blue indicator").

4. Possibility of improving armies.
When a leader appears in the game, he can speed up production in the city or create an army. But this army cannot be upgraded to another army. This is necessary so that different civilizations have different armies. I couldn't do this in the standard editor.
Is it possible to solve this problem?

5. Bridges over rivers?
Units can cross the river at any place without interrupting their progress (after studying the technology with the “allow bridges” checkbox). This looks implausible. Is it possible to build bridges across rivers? But I don't have any ideas how this can be done.
 
Last edited:
Unit limiting sweet too, although by number of buildings as well as cities would have been even sweeter (I have no idea of what is technically possible of course).
It's technically possible but it's more difficult than limiting based on city count since the game already tracks city counts for each player but it doesn't track how many buildings of each type they have. I'd have to insert some logic to track that like I already had to do for units.

I guesss we all have a wish list for this. I would like to have civs placed near selected terrain types and resource types so civs can start near their cultural homelands (Norsemen near mountians and fish and so forth).
Ideally I could adapt the game's logic for seafaring starts to work for other terrain types however I don't know how practical that would be. The logic for placing starting locations is surprisingly complicated. I think that's because it has to deal with the fact that scenarios may have any number of starting locations already set. I don't know how that interacts with the seafaring trait.


1. Sometimes the route of movement of units when using a combination of roads and railways is not chosen optimally.
Thanks for reporting this, I'll look into it. Right off hand, I have no idea what would cause this. It doesn't look like that other case where the pathfinder was failing to find the shortest path due to an integer overflow.

2. Problem when city defense structures fire at passing ships. A ship that has received health damage down to level 0 (and the workers on it) hangs on a water tile. After the destruction of this civilization, the workers disappeared, but the ship remained in the game. The pirate ship of the AI civilization (not barbarians) disappeared 20-25 turns after freezing, the reason for the disappearance is unknown. It is impossible to attack these ships with your own ships. They can only be fired upon by ships with lethal bombardment, but they could not be sunk.
How odd. Do you have the mod configured to make zone of control lethal? The code for zone of control is mostly shared between units and coastal fortresses so it's possible the mod's changes allow coastal fortresses to knock the last hit point off a unit but the game doesn't check afterward whether it should die, because of course that could never happen in the base game. I'm also surprised you can't attack a unit with zero HP. Back when I was working on the ZoC and defensive bombard changes I accidentally created zero HP units and found that they could still fight and even win combat as long as they took no damage, but maybe that was just on attack.

3. In some scenarios, military units can build roads, fortifications and clean up pollution. The description of the action before the unit name is very useful information. But it does not allow you to visually quickly identify units that are working.
Therefore, I ask you to return the “blue indicators” to the unit activity menu (or the ability to configure them), if possible.
I also ask you to replace the “green indicators” (with or without a sword) with “red” ones for stationary units.
I like having the right-click menu LEDs match the ones from the base game because it's simple and requires no explanation. Players should be able to look at them and immediately understand them without having read anything in the readme or this thread. The blue indicators would be helpful but it's not immediately obvious what they mean. I suppose I could make the blue indicators optional and could even replace the base game's indicators with blue when appropriate so it's consistent.

4. Addition to the calculation of the cost of maintaining units - extra_unit_maintenance_per_shields.
Did I count correctly?
Is it possible to add a unit cost factor (or %) from the government type specified in the settings?
That's correct. It would be possible to multiply the total unit maintenance costs by some percentage but if the only point is to avoid editing the BIQ then I'm not sure it's worth it. I suppose there are other things you could do with that ability like make units cost 1.5 gold each in certain governments, but still. Wouldn't it be nice if you could reload the BIQ for a game in progress? I got a request for that a while back and it's something I've been meaning to look into but haven't gotten around to yet. Hopefully some day. I believe you can already do that (with some caveats) using Quintillus' editor though I've never tried that myself.

Also, since you mentioned it, I don't like how the extra unit maintenance feature changes the numbers on the military advisor. "Total Units" should be relabeled to "Maintained Units" in that case so it's clearer that it's not an actual unit count. I don't remember if the feature affects the "Allowed Units" count as well, I think it does. That should be relabeled to "Free Units" or something. This is another thing I wanted to do earlier but never got around to.

1. Prohibition of pollution in impassable areas.
2. Resumption of workers' activities after interruption of work.
3. "Rubber" tiles.
4. Possibility of improving armies.
5. Bridges over rivers?
  1. This would be easy. I could modify the code that skips water tiles when searching for a spot for pollution to spawn to skip impassible tiles as well.
  2. I'm not sure. The problem here is that the progress is stored by the workers themselves not the tile being worked. The game presumably resets the progress counter whenever a worker is given a job and removing that logic could cause problems if other parts of the code assume it works that way.
  3. This would be an easy experiment at least. I could make tiles inaccessible if they have too many units on them like how I made tiles inaccessible to implement the trespassing restriction. The real question is if that would cause any other problems, particularly for the AI. In the case of the trespassing restriction there were a few secondary issues but nothing too serious.
  4. I'll look into this. I don't know why armies wouldn't be upgradable, maybe there's some special rule just for them?
  5. This would be hard to do for several reasons. For one, I don't yet have a way to pack additional data into save game files so I wouldn't be able to store which tiles have bridges. Second, the worker jobs are hard-coded into the game logic, except for what you can change through the editor. I don't see any practical way to add a new job. Though I could probably work around this issue, for example by reusing the build road job but modifying it. I did something similar for stack bombard, which isn't really a full-fledged unit action but a variation on the bombard action. Third, I would have to modify the unit AI so it was able to build bridges. I don't even know what that would entail.
 
I'll look into this. I don't know why armies wouldn't be upgradable, maybe there's some special rule just for them?
Armies can be made upgradeable in the base-game, but a less-advanced Army-flagged unit can only be upgraded to a better one in a town which has both a Barracks (= improvement-flag "Allows Veteran units"), and the MilAcad (= SW-flag "Allows building Armies without an MGL").

Since it's SW-dependent, it can only happen in that one town, so rotating older Armies back to be upgraded is inconvenient for the human (and turn-consuming prior to unlimited Rail-movement), and the AI won't do it intentionally, only by accident.
 
Hey, my setup is MacBook Pro M1 and running GOG Civ 3 Conquests using PortingKit (wine). I’m trying to apply the patch and get the following error:

Found GOG executable in ”Civ3Conquests.exe”
<string>:97: error: ”;” expected (got ”bool”)

Alert with title Error:
Ep.c;989 (in_runmain):
Assertion failed:
success != -1

That points to injected_code.c and the struct for pause_for_popup. Now all I know about C struct is based on 30seconds of Googling but it looks fine to me. On one occasion it managed to get by this error and instead complained about unknown type for ”long long” on line 99 in same file.

The way I’m running the patch is by using the Command prompt for the wrapper, navigate to the C3X folder that is placed inside the Conqeusts folder and type ”INSTALL.bat”.

Any ideas more than welcome. Thanks!
 
@BenjiTre the way that I do it is to right-click on Install.bat, choose open with PortingKit (I already have PortingKit running), then it will prompt me "what port do you want to use to run ...", and I choose the Civ3 3 Port that I used to install C3C initially.
 
@SayHayKid Great tip! Had no idea it was that easy. Sadly I still get the same error so not sure what's up on my end.
@BenjiTre I see what you are saying. I just tried a clean install of the GoG version via Porting Kit. C3C Installed and ran fine. Then I tried installing/running the patch like I did previously and I got the same error as you. I don't know what changed. I am not a programmer, so hopefully @Flintlock will have an idea.
 
Last edited:
Armies can be made upgradeable in the base-game, but a less-advanced Army-flagged unit can only be upgraded to a better one in a town which has both a Barracks (= improvement-flag "Allows Veteran units"), and the MilAcad (= SW-flag "Allows building Armies without an MGL").
That explains it. C3X already has an option to remove the barracks/harbor/airport requirement for upgrading, as of version 18. I should extend it to remove that SW requirement as well, or maybe add a separate option for that. I didn't even know that rule existed.

@BenjiTre I see what you are saying. I just tried a clean install of the GoG version via Porting Kit. C3C Installed and ran fine. Then I tried installing/running the patch like I did previously and I got the same error as you. I don't know what changed. I am not a programmer, so hopefully @Flintlock will have an idea.
Unfortunately I don't know what's going on there either. It must be something to do with the environment or configuration of the compiler since, if the code itself were wrong, that would affect Windows and Linux too. The error about "long long" being unknown is really weird. I thought that type would have been built in to the compiler but evidently not. I don't know where it's defined, presumably in some header file that's not getting loaded. I also don't know why this problem would show up only now. What's the most recent version that works? I don't own a Mac so I can't test on my own.
 
That explains it. C3X already has an option to remove the barracks/harbor/airport requirement for upgrading, as of version 18. I should extend it to remove that SW requirement as well, or maybe add a separate option for that. I didn't even know that rule existed.

I meant to ask about this as I haven't had a chance to try the new version yet. We have the in-game limit of only allowing the upgrade of armies in a Military Academy building. We also have the building requirements that CXE adds. Can you upgrade a unit in a city that doesn't allow building the upgraded unit? Being able to limit unit production by city is great, but being unable to upgrade them outside such cities would not be helpful for the AI. Not sure if anyone has tested all this yet.
 
Unfortunately I don't know what's going on there either. It must be something to do with the environment or configuration of the compiler since, if the code itself were wrong, that would affect Windows and Linux too. The error about "long long" being unknown is really weird. I thought that type would have been built in to the compiler but evidently not. I don't know where it's defined, presumably in some header file that's not getting loaded. I also don't know why this problem would show up only now. What's the most recent version that works? I don't own a Mac so I can't test on my own.

This is quite a conundrum. If I do a fresh install of the GOG Windows version of C3C via PortingKit I can only apply up to patch version 15. Starting at version 16 I get the error. However, I have installed versions of 16, 17, and even 18b on other installations of the game. When you install a Windows game/app via wineskin (PortkingKit) it creates a XYZ.app. You can then duplicate that app and have multiple versions of C3C installed. I do this all of the time for mods.

For example, I have base install of C3C with no mods. I then duplicated the app to have a separate version of C3C for developing my mod, another copy for CCM, and an other copy with a bunch of other mods for ideas/testing. I was able to install versions 16, 17, 18 on all of those instances, but not on a new clean install. So, I am perplexed.
 
Version 15 works for me as well. What was added from version 15 to 16 and is causing the problem is this part in injected_code.c

C:
struct pause_for_popup {
    bool done; // Set to true to exit for loop
    bool redundant; // If true, this pause would overlap a previous one and so should not be counted
    long long ts_before;
};

I can’t see any issues with it. And since this have worked in the past for @SayHayKid I’m suspecting the problem to be with a PortingKit/Wine update. I tried using the the advanced options to install Civ3 with an older version of Wine (2.0.4) but the installer gets stuck half way through so I haven’t been able to confirm if this works on older Wine versions. Or if it would help to use a different windows version when installing.
 
I meant to ask about this as I haven't had a chance to try the new version yet. We have the in-game limit of only allowing the upgrade of armies in a Military Academy building. We also have the building requirements that CXE adds. Can you upgrade a unit in a city that doesn't allow building the upgraded unit? Being able to limit unit production by city is great, but being unable to upgrade them outside such cities would not be helpful for the AI. Not sure if anyone has tested all this yet.
Good question, you can't upgrade to a unit type unless you can also build that type in the city in question. So if a unit type has a building prereq, you can only upgrade to it in cities that have that building. This also explains why upgrading armies requires a military academy. I could expand the allow_upgrades_in_any_city option to ignore all building requirements, and probably should. Also, that option really ought to be renamed. It doesn't bypass resource requirements and so doesn't actually allow upgrades in *any* city.

This is quite a conundrum. If I do a fresh install of the GOG Windows version of C3C via PortingKit I can only apply up to patch version 15. Starting at version 16 I get the error. However, I have installed versions of 16, 17, and even 18b on other installations of the game.
Version 15 works for me as well. What was added from version 15 to 16 and is causing the problem is this part in injected_code.c
That pause_for_popup struct was only added in version 17 Preview 1. It's part of the turn timer. It stores when a popup window is opened so that, after it's been closed, the mod can determine how long it was open and deduct that amount from the turn time. The turn timer was added at the same time as Trade Net X since I wanted to use it to measure my progress at optimizing the trade net calculation. Either you guys are mixing the versions up or there's something really weird going on here.

Assuming the problem started with 17P1, I can make a guess as to what it is. Around when I added Trade Net X, I also deleted a bunch of files from the compiler's folder (tcc) that I thought were not being used. The point of that was to bring the size of the mod back under 1 MB. You could try restoring that stuff by replacing the mod's tcc folder with one from an earlier working version.
 
Assuming the problem started with 17P1, I can make a guess as to what it is. Around when I added Trade Net X, I also deleted a bunch of files from the compiler's folder (tcc) that I thought were not being used. The point of that was to bring the size of the mod back under 1 MB. You could try restoring that stuff by replacing the mod's tcc folder with one from an earlier working version.

Darn. I tested it out. I still got the same error. I still don't know why I was able to install 16, 17, and 18 on another install of the game, but can't install any version after 15 now. I'll try to do some more investigating and post back if I come now with anything new.
 
@Flintlock You're correct, I kind of assumed it was because v15 was the last one working for me and @SayHayKid . When I try installing version 16 I get another error:
Code:
<string>:226: warning: implicit declaration of function ’slice_matches_str’
<string>:659: error: field not found: integer_config_offsets

That part is also missing from v15.
 
How odd. Do you have the mod configured to make zone of control lethal? The code for zone of control is mostly shared between units and coastal fortresses so it's possible the mod's changes allow coastal fortresses to knock the last hit point off a unit but the game doesn't check afterward whether it should die, because of course that could never happen in the base game. I'm also surprised you can't attack a unit with zero HP. Back when I was working on the ZoC and defensive bombard changes I accidentally created zero HP units and found that they could still fight and even win combat as long as they took no damage, but maybe that was just on attack.
I took a closer look at the occurrence of “Healt 0/X” cases.
The ship would sometimes take damage down to 0/X health when passing by a city that was simultaneously occupied by:
- Portus building (Naval Defense: 15, Naval Bombard Def: 15);
- Velites land unit: “Bombard Range” 1, “Zone of Control” ability, but without the “Lethal Sea Bombardment” ability;
- Triremis naval unit: “Bombard Range” 0, “Zone of Control” and “Lethal Sea Bombardment” abilities.
When a ship passed my city with Portus, but without Velites and Triremis units, the damage was dealt correctly (Healt 1/2), without animation.
When the ship passed by my city, which only had a Velites unit, without Portus, the damage was dealt correctly (Healt 1/2), without animation.
When a ship passed by my city, which had only the Triremis (“Bombard Range” 0) unit, without Portus, the damage was dealt correctly (there were cases of the ship being sunk), the animation did not show my ship, only with flying arrows.
C3X settings:
show_zoc_attacks_from_mid_stack = true
special_zone_of_control_rules = [all]
Most likely, the “Healt 0/X” damage is associated with the “Zone of Control” ability and a combination of several types of damage.

I also noticed the following:
- when attacking a ship with health level 0/X, it does not sink. My ship does not lose the ability to attack again, but with each new attack its movement range is reduced by 1;
- when shelling a ship with a health level of 0, my ship was never able to sink it. At the same time, my ship loses the ability to fire;
- when a city is attacked by AI units from a transport ship, the captured slaves are not loaded onto this or another transport ship (there is space on the ships). They remain on water tiles and cannot be captured. When my ship is attacked, they disappear. At the same time, my ship does not lose the possibility of a new attack; in one turn it was able to attack 2 tiles with workers, and then sink the ship.
Another situation. An AI (non-barbarian) player's pirate ship is attacking my city, which contains a ship and a land unit.
If you remove a land unit from the city, there will be no attack.
If you remove the ship from the city (or leave it), then the attack will happen in any case.
At the same time, first the animation of my ship can be shown in the city, then the animation of the battle between my land unit and the pirate ship.
Possible results of the battle:
- my unit loses health points and the pirate ship sinks;
- my unit dies, but the pirate ship does not capture the city, even if there are no other units in the city.
The presence or absence of a building in the city that is protected from naval bombardment does not change anything.
 
Top Bottom