Resource icon

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

I'm afraid there's some misunderstanding here. I wasn't complaining about existence of invisible units in the game but the fact that when you fight invisible unit you cannot see it which looks stupid.
I never said it was a bug in your mod but a bug/oversight from game developers.

Yes, sorry this was a misunderstanding, as now for me it is clear what you are hinting to. As far as I remember, there is indeed a constellation when C3C makes an invisible unit for a very short time visible, even when there is no unit with the 'detect invisible' option near that unit: When a transport ship lands an invisible land unit in your territory, one can see the invisible unit for a short time leaving the ship.
 
maybe there could be a way to make units engaged in combat always visible, regardless of their visibility status?
The list is getting pretty long, this is added at #15.
Hi if you wish I can run tests for the executable. I'm available.
That would be great. I'll post the next version with the no unit limit patch soon, like within a few days. I'd appreciate it if you'd try it out and get back to me if it's not working as expected.
I'll look into the era limit at some point. Based on that I've seen so far, the limit is not baked into the EXE at all, the array of era objects can be made to be any arbitrary size. I wonder if the limitation is just part of the BIQ format.
(Quoting myself here for an update) After a quick search, I found the point in the EXE where it errors out of loading a BIQ that doesn't have 4 eras. I can go ahead and patch that out, though that will also be an untested change for the moment. Testing it will be a bit difficult as it requires a custom editor.
 
I'll post the next version with the no unit limit patch soon, like within a few days. I'd appreciate it if you'd try it out and get back to me if it's not working as expected.

This is great news! :)

In my current testgame with the CCM mod (24 civs on a 180 x 180 random map) until now all is working well. The only very small problem are some unit graphics and the scrolling in the game working 'by fits and starts' (I hope this is the correct English term for "ruckartig") for a short period of time soon after loading a save file. The new stealth attack setting is working like charm and the warning and stop about unrest in the cities is very comfortable. There is even a different warning text when there are more cities of a civ in unrest. The different options for dealing with that warning in my eyes are funny, as for normal players there should only be the option to look into the city and to deal with the unrest.

My testgame is not yet in an era with submarines, so at present I cannot say anything about the fix of the submarine bug.

To add 8192 + 1 units on the map (may be in Debug mode) for testing the 'no unit limit patch' could become a painful task. May be somebody here can post a save file with more than 8192 units on the map for this test.

The stack command for worker jobs on a tile (a kind of a 'worker army') in my eyes would be another very comfortable addition for the C3C game.

(Quoting myself here for an update) After a quick search, I found the point in the EXE where it errors out of loading a BIQ that doesn't have 4 eras. I can go ahead and patch that out, though that will also be an untested change for the moment. Testing it will be a bit difficult as it requires a custom editor.

To have more than 4 eras (plus era none) can become a very tricky task. Per example there must be additional leader graphics (forward and backwards) for each additional era and these additional eras must be different from era none. To create a custom working editor and creating additional leader graphics for these additional eras, could be too much effort for the resulting benefit.

But it would be nice, if in the existing system of 4 eras, a civ could have different names in different eras (per example in my CCM mod at present I have to give civs combinations of names like Rome/Italy or Greece/Byzanz) and different leadernames in each era.
 
In my current testgame with the CCM mod (24 civs on a 180 x 180 random map) until now all is working well. The only very small problem are some unit graphics and the scrolling in the game working 'by fits and starts' (I hope this is the correct English term for "ruckartig") for a short period of time soon after loading a save file.
Glad to hear the mod is working for you. What's the problem you're having with unit graphics? I haven't noticed anything like that myself and the mod does not currently touch the unit graphics at all, or at least not intentionally. I have noticed that the map scrolling is choppy for a while after loading a save. But there too the mod doesn't affect map scrolling, or at least it shouldn't, and it doesn't add any significant code that gets run continuously that could cause performance problems. So I don't know what to make of this issue. What makes it even more mysterious is that it only seems to affect the GOG version and not the Steam version of the game.
The different options for dealing with that warning in my eyes are funny, as for normal players there should only be the option to look into the city and to deal with the unrest.
While implementing the warning I debated with myself how the options should be worded and what's the best default option, and I don't know that there's even a right answer to that question. The default is to just not end the turn because I figured most unhappiness problems are dealt with using the luxury slider or by importing resources.
To add 8192 + 1 units on the map (may be in Debug mode) for testing the 'no unit limit patch' could become a painful task. May be somebody here can post a save file with more than 8192 units on the map for this test.
Yeah, with the other parts of the mod it was easy to make a scenario to test that the changes were working but with the no unit limit even setting up a scenario is quite a bit of work. If I were to make my own test I would inject some code to spawn thousands of units after some trigger is activated, but even that's not trivial.
To have more than 4 eras (plus era none) can become a very tricky task. Per example there must be additional leader graphics (forward and backwards) for each additional era and these additional eras must be different from era none.
Ah, I hadn't thought of the leader graphics. That's likely to be another place where the era limit comes into play. As for changing a civ's name depending on its era, I've added that to the list, it probably wouldn't be too difficult.
 
Ah, I hadn't thought of the leader graphics. That's likely to be another place where the era limit comes into play. As for changing a civ's name depending on its era, I've added that to the list, it probably wouldn't be too difficult.

The leader for the fifth era is not so critical, you can use the graphics of the previous era. But there are also graphics for cities, which it is desirable to change.
 
The leader for the fifth era is not so critical, you can use the graphics of the previous era. But there are also graphics for cities, which it is desirable to change.

The leader for additional eras in my eyes is as critical as the additional city graphics, because there must be created additional slots in the civilization registry for these graphics in the biq.

Leader-biq.jpg
 
The only very small problem are some unit graphics and the scrolling in the game working 'by fits and starts' (I hope this is the correct English term for "ruckartig") for a short period of time soon after loading a save file.

Dear Civinator, I believe that such an event is related to the number of units and the complexity and processable elements of the game. I also had this event. I also noticed that the processing delay between shifts is related to the air units, specifically with the fighters. To reach this conclusion I tested two games, in my particular mod, in which I have more than 20k units. When the AI has between 300 to 400 fighters. There is one between giant shift (30min). But when I eliminate AI fighters, the shift runs in an acceptable way. here I talk about 300 to 400 fighters for 3 AI. I will now implement a game in which I change the fighter strategy to also bomb (as I tested it on the standard Civ3 strategy). I believe it is related to the fact that AI performs the turn-by-turn interception mission and also the reconnaissance mission. Thus, one way to manage such an event is for the fighters to also carry out the bombing, in which they will be destroyed and intercepted more frequently, thus decreasing the stock of air units that accumulate throughout the game. But I need to confirm this.
 
Rômulo Prado, thank you very much for your kind reply. In my case this small problem only appears in the first actions of the human player after loading a save file and when these first actions are over (mostly in the same turn when the saved game is started), C3C with the Flintlock patch is running normally without that problems for hours. When knowing about that starting problem and that the reactions of the game in this very short phase are 'slowed down', the actions of the human player also should be 'slowed down' to avoid that the units are sent to a wrong tile or the wrong diplomatic action is clicked on.

In my case it is not a problem of many units on the map and not a problem of aircraft units, as my testgame is still in an era without any planes. But as posted, this is only a very small issue, that is fixed by itself in the same turn when the save file is started and I really enjoy the the game with the Flintlock patch a lot. :)
 
I believe that such an event is related to the number of units and the complexity and processable elements of the game.

I just reported that this is an initial delay in loading information and what may be related to the fact. Besides, I completely agree with you.

I also noticed that the processing delay between shifts is related to the air units, specifically with the fighters.
...

From here I report something that I observed in my tests, because I use another bypass solution of the maximum limit of units. Therefore, I am convinced that these elements are not related to the Civ3X mod. My sincere apologies if I implied something different to that.
 
Speaking of pathfinding code, one of the most annoying AI features is no respect for borders, and since the AI knows which civ the tiles belongs to (since we can ask him to leave), I hope it would be possible to exclude tiles of friendly peaceful civs without ROP from AI path searching.
 
C3X Release 4
New in this version:
  • Detailed city production info
  • Option to limit railroad movement
  • Removed unit limit
  • Altered scripts so they work when run as administrator.
  • Bypassed era number check (not yet a real implementation of no era limit)
  • Warning message instead of crash if config file is not found
Full README:
Spoiler :

C3X: Executable Mod for Civ 3 Complete
Release 4

INCLUDES (* = new in latest version):
* Detailed city production info
* Option to limit railroad movement
* Removed unit limit
Stack bombard
Disorder warning
Bugs fixed:
- AI pathfinding collides with invisible units (called the "submarine bug")
- Science age beakers not actually awarded
- Pink line in Civilopedia
Option to prevent autoraze and razing by AIs
Stealth attack activates even when there's only one target

INSTALLATION AND USAGE:
Begin by extracting the mod and copying its folder into the Civ install directory (that is, the folder containing Civ3Conquests.exe). Then activate the mod by double-clicking the INSTALL.bat or RUN.bat scripts. INSTALL.bat will install the mod into Civ3Conquests.exe, RUN.bat will launch Civ 3 then apply the mod to the program in memory. The mod's behavior is highly adjustible by editing a text configuration file. It is named "default.c3x_config.ini".

Notes about installation:
1. When installing, the original executable will be copied over to "Civ3Conquests-Unmodded.exe".
2. To uninstall the mod, delete the modded executable then rename the backed up version mentioned above to "Civ3Conquests.exe".
3. It is not necessary to uninstall the mod before installing a different version; the installer knows to check for the backed up EXE.
4. Even after installation, the mod still depends on some files in the mod folder, specifically the config file and the Art & Text folders (which you must NOT merge into the game's main folders or you'll break your install).
5. I've received multiple reports that RUN.bat doesn't work while installing does, so know that installation is the more reliable option.

COMPATIBILITY:
The mod is only officially compatible with the GOG and Steam versions of Civ 3 Complete. It may be compatible with other versions if they use the same executable as one of those two. Multiplayer is untested.

STACK BOMBARD:
Activate stack bombard on any unit capable of bombarding by clicking the stack bombard button or by activating normal bombard then CTRL+clicking the target tile. The selected unit will bombard the tile, then all other units of the same type on the same tile will automatically bombard the target as well. Stack bombard is pretty smart and will stop bombarding once it can no longer do any damage, and it knows about lethal bombard, that you can't damage air units in an airfield, etc.

DISORDER WARNING:
If you try to end the turn with unhappy cities, the domestic advisor will pop up to warn you and give you the option to continue that turn. One minor annoyance is that the game does not recompute city happiness when you sign a deal to import a luxury, so doing so won't remove the warnings. To make the game recompute city happiness, simply bump the luxury slider back and forth. I hope to fix this annoyance for the next version (this time for sure).

LIMITED RAILROAD MOVEMENT:
The mod adds the option to limit railroad movement to a certain number of tiles. To enable this, edit the config file. The limitation works like in Civ 4 in that it applies the same limit to all units regardless of how many movement points they have. Be advised, because this setting affects how movement is calculated, changing it in the middle of a turn (i.e. after some units have already moved) is likely to cause units to have extra or missing moves.

NO-RAZE:
NoRaze has been re-implemented inside C3X but is not enabled by default. To enable it, edit the config file mentioned above.

HOW IT WORKS:
Some parts of the mod (bug fixes, no-raze, no unit limit) are really just hex edits that are applied to the Civ program code. The real secret sauce is a system to compile and inject arbitrary C code into the process which makes it practical to implement new features in the game. The heart of the system is TCC (Tiny C Compiler) and much work puzzling out the functions and structs inside the executable (and thanks to Antal1987 for figuring out most of the structs years before I came along).

The injected code, along with the rest of the mod, is fully open source. If you're curious how stack bombard was implemented, check out "patch_Main_Screen_Form_perform_action_on_tile" in "injected_code.c", I assure you the code is quite readable.

MORE INFO, QUESTIONS, COMMENTS:
See my thread on CivFanatics: https://forums.civfanatics.com/threads/sub-bug-fix-and-other-adventures-in-exe-modding.666881/

SPECIAL THANKS:
1. Antal1987 for his work reverse engineering Civ3. See: https://github.com/Antal1987/C3CPatchFramework
2. Rômulo Prado for his help testing the mod

Link: https://forums.civfanatics.com/resources/c3x.28759/
Speaking of pathfinding code, one of the most annoying AI features is no respect for borders, and since the AI knows which civ the tiles belongs to (since we can ask him to leave), I hope it would be possible to exclude tiles of friendly peaceful civs without ROP from AI path searching.
Added to the list. I haven't actually dug deep into the AI's pathfinding yet so this one might be difficult.
 
Flintlock, one more time a big thank you very much for all you have done for the fans of Civ 3! :thanx:

You are faster in programming achievments in improving Civ 3, than I can play my testgame with C3XR3. In my interesting testgame I´m now reaching the phase when I can build submarines and there are about 20 civs left in that testgame with CCM2.50. With the exception of the first few actions slowed down after loading a save file, all is running very well with C3X3. Now I will produce and lay submarines in the naval routes of all civs I am in peace with and to see what will happen with the submarine bug. To watch the reactions in a normal game in some situations can sometimes deliver much better results than looking at artificial tests in Debug Mode.

The implementation of a configurable railroad movement in C3XR4 and no more unit limits on the map are other great improvements in C3C. :worship: If this is working, the new settings for railroads will be used in the mod WW2 Global Gold.

There is another issue in C3C, where a fix could be very useful. I didn´t post it until now, to avoid annoying you with too many wishes:

It would be great, if Small Wonders (SW) could be able to provide buildings to every city of a civ on the map or on a continent like this can be done by Great Wonders (GW). There would be a cornucopia of benefits, if this option would be available for SWs, too. Per example micromanagement in the later phases of the game could be massively reduced, if ministeries of a civ, becoming available with a certain later tech, could build some basic infrastructure for cities automatically (a Ministery of Commerce could automatically give a marketplace to every city in a civ, a Ministery of Education a school or library to every city and so on). This would also be very useful for dfferent religions and in colonial scenarios for giving special buildings on different continents, and so on.

In the Firaxis editors this option for SWs is grayed out. In the Quintillus editor this option can be set for SWs, but unfortunately it is not working.

SW1.jpg


SW2.jpg
 
With the exception of the first few actions slowed down after loading a save file, all is running very well with C3X3.
Glad to hear it :). I still don't know what the slowdown is about and unfortunately all I can do is guess at the cause. I've a tried a couple of simple things that haven't helped.
It would be great, if Small Wonders (SW) could be able to provide buildings to every city of a civ on the map or on a continent like this can be done by Great Wonders (GW).
Added to the list. I think I could already do a sloppy implementation of this by patching the City::has_improvement function to loop over cities & small wonders. A proper implementation would build on how the game already stores free improvements, which is with some hash table that I don't yet know the details of.
 
(Thoughtfully) Is there a technical possibility in the game to make a unit that moves ONLY by rail? Freight train, armored train?.. I don't see such a possibility, but maybe I don't know about something or forgot about it...
 
I've also always wanted to be able to play around with the interface more than what the game gives. Like change the coordinates of buttons. Currently, we have to use graphical tricks in the pcx images, but there are certain button areas that are hard coded that would be nice to change. Like moving the advisor buttons to the top part of the screen, rather than the left. Coming from this, also, auto resolution fixes. Using KeepRes, it zooms everything out the bigger your computer resolution. If we could adjust the size proportions that would be awesome.
Something just occurred to me: no-one seems to have mentioned the Transport-box graphical bug, the one where about 4 pixels' width of the right-hand side of the box stays onscreen after you select a non-unloadable unit, because the box has been drawn in the 'wrong' place (or is not erased in the right place)?

Was this another of the things Antal1987 fixed?

Or is it simply a question of editing the relevant .pcx file? (If so, does anyone have a link to a tutorial, or an edited version of the default file?)
Another advantage to having config files is that they can be layered on top of each other. In other words, my plan is that there will be a base config that players can set how they please for the epic game and then there will be scenario-specific configs that can override some settings necessary for the scenario e.g. enabling autoraze.
That would be great. Over the weekend I was replaying the Firaxis Napoleonic Conquest, and even though in this scenario, cities retain Culture on capture, the preset map is not particularly crowded (nowhere near 512 towns!), and Settlers are unbuildable(!), the AI-Civs are still razing captured towns!
INSTALLATION AND USAGE:
Begin by extracting the mod and copying its folder into the Civ install directory (that is, the folder containing Civ3Conquests.exe). Then activate the mod by double-clicking the INSTALL.bat or RUN.bat scripts. INSTALL.bat will install the mod into Civ3Conquests.exe, RUN.bat will launch Civ 3 then apply the mod to the program in memory. The mod's behavior is highly adjustible by editing a text configuration file. It is named "default.c3x_config.ini".

Notes about installation:
1. When installing, the original executable will be copied over to "Civ3Conquests-Unmodded.exe".
2. To uninstall the mod, delete the modded executable then rename the backed up version mentioned above to "Civ3Conquests.exe".
3. It is not necessary to uninstall the mod before installing a different version; the installer knows to check for the backed up EXE.
4. Even after installation, the mod still depends on some files in the mod folder, specifically the config file and the Art & Text folders (which you must NOT merge into the game's main folders or you'll break your install).
5. I've received multiple reports that RUN.bat doesn't work while installing does, so know that installation is the more reliable option.
Do I understand right that I can pick and choose which of your fixes I want to use? i.e. If I put my preferred settings into the config-file and then install the C3X mod, then only those preferred settings will be permanently incorporated into my conquests.exe?

EDIT:

Ooh, and no-one yet seems to have mentioned the various bugs with MGLs + Armies which were introduced in Conquests, possibly as a side-effect resulting from the introduction of SGLs. Unlike in Vanilla and PtW, the AI

— can't/won't use MGLs to build Armies anymore (but can allegedly still rush Wonders with them, which the human can't)
— can't/won't finish loading (multi-unit) Armies that it's been given (e.g. at Scenario-start, or via autoproduction) so rarely/never sends them out to fight

If any of the above could be improved, that would be amazing.
 
Last edited:
(Thoughtfully) Is there a technical possibility in the game to make a unit that moves ONLY by rail? Freight train, armored train?.. I don't see such a possibility, but maybe I don't know about something or forgot about it...
That should be easy to mod in. The function I patched to make limited railroad movement possible (Trade_Net::get_movement_cost) can indicate that a move is impossible by returning -1. It's a simple matter of checking if a unit is moving along a railroad (true if and only if the base function returns 0), then if it isn't and its unit type ID is on a list of units note allowed to move off rails, return -1 to deny the move.
Transport-box graphical bug
I'll look into it. I don't recall Antal fixing it and if he did that wasn't included in the patches Tsubasanut sent to me a couple of weeks ago.
Do I understand right that I can pick and choose which of your fixes I want to use? i.e. If I put my preferred settings into the config-file and then install the C3X mod, then only those preferred settings will be permanently incorporated into my conquests.exe?
You're right that you can pick and choose, in fact if you set everything in the config file to "false" the modded game will behave exactly like the unmodded version. But the config file has nothing to do with the installation process. The config settings are loaded and applied each time the modded game is launched.
Ooh, and no-one yet seems to have mentioned the various bugs with MGLs + Armies which were introduced in Conquests, possibly as a side-effect resulting from the introduction of SGLs.
Added to the list. I expect trying to modify the AI's behavior will be difficult but I can't say anything for sure since I haven't looked at that part of the code yet at all.
 
Well, if we are talking wish lists here. The last reply on armies got me thinking. It would be nice if I could unload units from the army. After a unit is replaced on the tech tree, it is still unupgradable if it is in an army. The ability to unload the army, upgrade the unit and then reload it in the army would be nice or maybe just be able to upgrade while the unit is in the army?
 
Back
Top Bottom