Resource icon

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

That's an interesting idea about letting fortified units unlock access to enemy roads. I imagine it would be extremely powerful when used against the AI.
i really like that if you could make it happened. regarding the ai. the only problem i see here is that it would usually destroy roads if it does not attack with a unit

I have also being playing with the artillery fix on and i can say that the AI can be frighteningly effective if it approaches your cities with a 60 artillery 60 defender stack. if it also brings offensive units. i have also noticed tho that you can still outsmart the AI and actually make the AI build more artillery game-breakingly overpowered for the human player. the problem is that once you capture a critical amount of artillery you can simply control the AI by making use that you either bombard the AI stacks into red and then kill them or if the amount is unmanageable exploit that the AI will move any damaged units back to heal.
The reason why this is game-breaking is that you use artillery captured from the AI and it does not cost maintenance. I have over a couple hundred captured catapults in my current sid game, while i can support only around 80 units without inevitable bankruptcy.
Slave units should count at least somewhat to uphold cost like for example 3 slave units count as one unit for maintenance purposes
maybe only slave military units should have maintenance (not slave workers)

About multiplayer, I've had that in the back of my mind for a while now
Pretty please. With the multiplayer lag using artillery stacks takes minuted of b, mouse click, shift ]

That reminds me of another suggestion: one of my greatest annoyances is the order in which civ3 handles units. Cycle order only is respected when you are cycling and not when a unit finishes activation after it did an action. i would suggest that if possible you could rewrite cycle order to do the following order for single unit type cycle:
1. same unit 2.same tile 3. healed before unhealed 4. unit ai strat(eg.g offensive, defensive, bomb) 5. unit type (land, sea) 6. loaded before unloaded
and for multi unit cycle
1.same tile 2. same unit rest same
Also the game should respect the order not only when cycling but also when it switches to the next unit

this also brings me to another problem. i would like to have more wake all / fortify all buttons:
1. Wake/Fortify all by type (e.g. wake all swordsman)
2. Wake/Fortify all fully healed/damaged
With multiplayer every action takes a long time and sorting through a stack after and before a fight can take minutes when it should take one click

In one case I was able to reduce the turn time very significantly, from ~6 min to 1 min 12 sec, with a relatively simple edit to the code.
I think this is very very awesome. wait time are really one thing that kills the fun in SP games on huge or extreme maps. i have made bigger version of my dads fav scenario for him and he does love it but at some point the turns take just too long.


The other thing that i know does a lot of lag is recalculating trade routes. i think i had suggested a better algorithm for that about 1 or 2 years ago here, and i would gladly implement it for you as long as i am able to nicely interface with the games methods.
Basically the point is that game completely recalculates all trade router every single time any change happens that could incur any change. e.g.: building a new city, building a harbour or airport, building a road, bombing a road tile resulting in the destruction of said road, sea-blockading a harbour. the calculation itself is O(N!M²) where N is the number of cities and M is the map size.
On maps bigger than huge this quickly means that any action that would trigger a recalculation means a minute long wait. for example using a bomber on a road, or founding or capturing a city. while the human can just avoid these actions at the cost of fun the AI will perform them anyway. on huge maps i would estimate that 99% of all calculation time is just trade route recalculations.

my algorithm for solving the problem is as following:
1. instead of calculation city to city trade, each tile is associated with a trade region. a trade region is a any connected (by road, or airport [and maybe harbour]) with the same trade restrictions (i.e. owned by the same civilisation).
2. tile changes that warrant recalculation instead check if the change would split or fuse any two trade regions (O(M²) check, flood fill O(1))
3. only if a fuse or split happened we need to recalculate trade at all (most recalculation can be avoided)
4. trade region graph is very small in all real-life situations so should be fast even if we implement O(T!) where T is the number of trade regions
I am not quite sure how harbours exactly work in civ3, so most likely oceans need to also be divided as per tile type (coast/sea/ocean) and it appears that visibility also seem to play a role
with this change it would also be possible to allow trade routes to go through enemy territory if a route is completely controlled by allied units
 
I have captured these large Arty stacks before, but I destroy all of them in an effort to keep the game fair and competitive with the AI. Also, I think you can change the ratio the AI builds Arty in config file too.
 
I am running Civ3 on a M2 MacBook Air using the Gig Windows version in a WINE wrapper. Since Macs can't run bat files by default, I had ignored this great resource created by @Flintlock. However, I think I managed to be able to mod the EXE using the command line tool that mimics Windows in WINE. I am not exactly sure how to test since I don't think there is anything noticeable right off the bat, correct? Is there something I can check at the start of the game to see if it worked?
 
Don't know if it has been asked, but does this works with mods? And also, could it be possible to finally unload units from armies?

Finally, could it be possible to have units with different upkeep and/or limited like say armies or with some arbitrary limits? Say, you can have only 5 fighters per each airport, or 15 fighters in total. And fighters cost 1 gold per turn while bombers cost 2 and nukes 10?

If doable, could it be possible to implement such limits on units that are spawned every X amount of turns by a building. Like, say the Statue of Zeus only spawn 5 units and stops, and starts spawning more only if the units die and are below 5 (this could or not count the regular Ancient Calvary units, if not the solution is as simple as to create a "clone" unit type for the building to spawn).
At least on a technical level, C3X works with any other mod (and if it doesn't, that's a bug, you can report it to me and I'll fix it). Like tjs said, the mod does change the gameplay somewhat with bug fixes and AI tweaks, so you might need a scenario config file for best results. My hope is that mod authors will create those and include them with their mods, then it should "just work" for players as C3X will automatically search for and load the scenario config file.

It should be possible to implement a maintenance cost multiplier per unit type. I can't say for sure until I've done it, but that's the impression I got after working with the maintenance code a few months ago. It would have to work based on unit counts, so a certain unit type would count for 2, 5, 0, etc. units for maintenance purposes. That's necessary so it fits in with the rest of the maintenance code. The formula for unit maintenance is max(0,(N-F-K)*C), where N is the total number of units that player has, F is the no. of free units from gov't and difficulty, K is the no. of king-flagged and captured units, and C is the maintenance cost per unit from gov't type. The mod could temporarily swap out the total unit count for the maintenance computation, or adjust the calculation of one of those other variables.

Restricting players to a maximum number of units of certain types should be possible too. I can't say much about that as I haven't looked into it.


That reminds me of another suggestion: one of my greatest annoyances is the order in which civ3 handles units. Cycle order only is respected when you are cycling and not when a unit finishes activation after it did an action.
I don't know about changing the cycle order of units, again I've never looked at that part of the code so I can't really say anything, other than that I'll add it to the list.
this also brings me to another problem. i would like to have more wake all / fortify all buttons:
1. Wake/Fortify all by type (e.g. wake all swordsman)
2. Wake/Fortify all fully healed/damaged
Stack fortify is already part of the mod, but it's probably not available in multiplayer. It should be possible to tack a "fortify all" or "wake all" option onto each group of units on the right click menu. The only reason I can think of why that wouldn't work is, again, multiplayer. What if one of the units dies between when the menu is opened and when it the option is clicked? The game has a way of dealing with that, after all there are already fortify/wake all options, but additional complications like that are why I have been putting off making mod features work in multiplayer. That and it's harder to test the mod's functionality in MP compared to SP.
The other thing that i know does a lot of lag is recalculating trade routes. i think i had suggested a better algorithm for that about 1 or 2 years ago here, and i would gladly implement it for you as long as i am able to nicely interface with the games methods.
Recalculating trade routes is a big part of what makes turns so slow, but not necessarily the way you'd expect. It's not the way I expected at all, the results I got from running the game in a profiler were very surprising. I'll post all the details in a thread soon, but for now: In that case I mentioned with the 6 min processing time, the single worst function, accounting for the most CPU time (231 sec) was City::has_improvement. That's the function that determines whether a given improvement is present in a given city. It's not horribly slow on its own but it becomes a hotspot because it gets called so often. 96.5% of the calls are from City::can_trade_via_water and City::can_trade_via_air as part of the trade net recalculation. Those can_trade_via functions are very inefficient b/c they loop over all improvements defined in the scenario, calling has_improvement for each one. Fixing that inefficiency massively reduces the turn time, at least in that case (keep in mind that's only one data point).

Thanks, I would gladly collaborate on programming C3X. I've offered several times but sadly no one has taken me up on it yet. About interfacing with the base game, I've starting laying the foundation for integrating the base game with code compiled from C++ into a DLL. I put that aside after actually profiling the code and realizing that there's a lot you can do without that setup. Right now the mod is written in C and organized to work like a script, so there's no DLL, it compiles the code to inject when you install the mod. That has a lot of advantages, but one big disadvantage is that the compiler has to be TCC, which does not perform optimizations. Normally that's not a problem, but if we're going to replace the trade net code for speed, the replacement code must be optimized or that defeats the point.

I've pushed the work in progress to my GitHub if you want to have a look. See e.g. TradeNetX.cpp, which would contain the C++ code that gets compiled to TradeNetX.dll, which would then be stitched into the game's existing code by C3X. Already it can access a lot of base game data types and addresses (see Civ3Conquests.hpp) but it will probably be necessary to find more in time. Doing so is an ongoing process and part of developing this mod.


I am not exactly sure how to test since I don't think there is anything noticeable right off the bat, correct? Is there something I can check at the start of the game to see if it worked?
There is. If you go to the preferences screen, there will be a "C3X Info" button in the top right if the mod is active.
 
Is there a way to turn off the Barbarians completely without any encampments. In scenarios these things tend to force AI Civs to send large forces into the wilderness.
 
What's the code for the army unit ability to be able to pillage for free? The AI does it all the time regardless of it being detrimental to them later (like cutting off their wheeled artillery SOD). Is there a way to turn that off or assign it to another unit line?

Speaking of pillaging, the AI always pillages with defensive units escorting their artillery. This often ends up slowing them down or even trapping the entire SOD if they pillage a wheeled-inaccessible tile. I'm considering removing the wheeled ability for land units all together as its very easy to trap the AI.

And did you know that giving a unit the cruise missile ability will automatically give it lethal land and sea bombard? Well, there goes my tactical nuclear weapon idea. Now the best I can do is make them expensive cruise missiles.
 
Hi flintlock,
hello everyone,

a few weeks ago I noticed strange behavior in a scenario I was playing, maybe a bug, related with the c3x-feature of resource-generating-buildings (rg-buildings).
The scenario uses the rg-buildings-feature of c3x very excessivly. It's a Colonization-like scenario, which generates the most goods by bulidings using C3x.
All works fine until I build a larger number of rg-bulidings, so it seems I reach a "critical quantity" of resources that are generated by buildings.
At this point the system of available resources collapse and I have no longer any resources available, that are generated in my oversea-colonies (look the attached screenshots).
It seems not only my own trading network collapsing, but every other player's trading network as well!
I am able to restore functionality of my trading network by selling rg-buildings, so I'm pretty sure there's some sort of "critical quantity", a kind of overflow, a memory allocation failure or such thing...
I'am very sad about this, because I love the new possibilities that C3X has created for Civ3, but the bug makes it impossible to play this scenario!

To further investigate that strange behavior I have created a debug-scenario with vanilla civ3-rules (also to rule out that the error is due to the scenario data).
It contains 57 cities for Player 1.
55 cities are connected by streets to a trade-network. 2 cities are connected by sea-routes.
Each city have 5 bulidings which are generating resouces (Barracks: Incense, Granary: Dyes, Temple: Oil, Marketplace: Iron, Library: Coal) by the rules of the scenario.c3x_config.ini.
In the 1st turn 55 resources of each kind are available (should be 57).
In the 2nd turn 57 ressources of each kind are available, after establishing the sea-routes.
Ok, so at this point all looks fine.
But then I tried to cut off cities from the trading network by destroying streets with the warriors, that are placed near the cities.
No matter how large the remaining local trading network is, the other cities always have only the resources available that are available in the capital's (local) trade network too.
But why? I think something is not working as it should and something similar happened in my scenario as well.
By the way, local created resources (that are just available in the city with the rg-building) seems not to be affected by this trade network-bug.

I didn't find a solution for my own for this problem...
To exclude that it's just a problem on my local machine, I attached my debug-scenario so letting confirm other people, that the problem appears on other devices too?
Does anyone have any ideas or suggestions as to where the problem could be?
 

Attachments

  • City.jpg
    City.jpg
    720.1 KB · Views: 45
  • ResourceScreen.jpg
    ResourceScreen.jpg
    946.1 KB · Views: 44
  • testit.zip
    testit.zip
    38.4 KB · Views: 24
El_Constructor, some points to your post in short, as at present I don´t have much time due to RL reasons:

- A limitation for luxury icons in the city screen comes from the luxuryicons_small file in the city screen folder.

- For the inland trade net the number of available resources in your empire is not relevant, as one kind of resource for the inland trade net is the maximum needed.

- The number of available resources of the same type becomes relevant for the external trade. For such a trade the other capital must be connected by a trade network with the other capital (Civ 3 vanilla manual, pg. 123).

- Your testit biq with its combination of my German conquests biq and the English names for the resources and buildings in the scenario.c3x_config file will not work for most civers here, as the names must be in the language of the biq, not the English BLDG_ entries (when played with the German version) or English names in the biq and the English scenario.c3x_config, when played with the English version.
 
Some notes, unrelated to the post by El_Constructor above:

1) when using the stack bombard, units with 2 movement points and the Blitz ability only bomb once and lose all movement points. (tested with aircraft but not land units)

2) suppressing the maximum hypertext links message works unless there's so many units that require a resource that the game just crashes
 
Is there a way to turn off the Barbarians completely without any encampments. In scenarios these things tend to force AI Civs to send large forces into the wilderness.
I'm not sure what you're asking for exactly compared to the existing "no barbarians" and "sedentary" options. Stopping barb units from spawning would probably be easy. Ideally it would be possible to stop the AI from running its units across the planet to attack them, but I expect that would be quite a bit more difficult.


What's the code for the army unit ability to be able to pillage for free? The AI does it all the time regardless of it being detrimental to them later (like cutting off their wheeled artillery SOD). Is there a way to turn that off or assign it to another unit line?

Speaking of pillaging, the AI always pillages with defensive units escorting their artillery. This often ends up slowing them down or even trapping the entire SOD if they pillage a wheeled-inaccessible tile. I'm considering removing the wheeled ability for land units all together as its very easy to trap the AI.
The code for free pillaging with armies is very straightforward. When a unit pillages a tile, the game checks whether the unit has the army ability and, if it does, skips over deducting a movement point. It also checks whether the tile has a barricade, if it does the unit loses all of its remaining moves regardless of whether or not it's an army.

I can also see the code where the AI decides whether or not to pillage. Interestingly, the original developers had thought of wheeled units there. There is a condition stopping AI units from pillaging tiles if doing so would leave the unit itself stranded. It would be possible to add another condition to prevent pillaging in case any friendly units on the same tile would be left stranded.

By the way, all this pillaging might be causing performance issues. The game recomputes a bunch of stuff related to trade networks whenever a road is destroyed. In that game I mentioned with the 6 minute turn time, the turns after that slow one were much faster, and at the same time a couple of wars between the AIs ended. It's possible that allowing the AIs to use armies and to escort their artillery into the field significantly slows down the game since the AIs pillage a lot more, causing a lot more trade net recomputation. This would also explain why the original developers never addressed this performance issue.


In the 2nd turn 57 ressources of each kind are available, after establishing the sea-routes.
Ok, so at this point all looks fine.
But then I tried to cut off cities from the trading network by destroying streets with the warriors, that are placed near the cities.
No matter how large the remaining local trading network is, the other cities always have only the resources available that are available in the capital's (local) trade network too.
There is a bug in the game where it won't display the correct number of copies of resources available to cities that are not on the capital's trade network. This is because of a limitation, the game only tracks one set of those numbers per player, for their capital network. The city screen displays the player's numbers on all cities regardless of which network each city is on. The presence or absence of resources is still correct. Fixing the display would be relatively difficult since I'd have to inject some code to track something the game doesn't already. An easier workaround would be to hide resource copy counts for cities off the capital network since they don't matter anyway as those resources can't be traded.

About the trade networks collapsing at a certain point: It's possible you're running into a limit on the number of tiles + the number of resource generating buildings. That's the only limit I can think of for resource generation. I've already tried to remove that limit as an issue, but it's possible I missed something. Is your scenario on an extremely large map? Like more than 60k tiles? The specific limit would be 65536.


1) when using the stack bombard, units with 2 movement points and the Blitz ability only bomb once and lose all movement points. (tested with aircraft but not land units)
Thanks for the bug report. I'll look into this.
 
I'm not sure what you're asking for exactly compared to the existing "no barbarians" and "sedentary" options. Stopping barb units from spawning would probably be easy. Ideally it would be possible to stop the AI from running its units across the planet to attack them, but I expect that would be quite a bit more difficult.
This reminds me, is it possible to have an option to have barbarians without goody huts? I like to have raging barbs on to provide some sort of early threat but I dislike how quickly the first age goes as a result of rampant tech trading due to free techs from goody huts, which has led to me disabling barbs completely so I get a chance to use some of the earlier units.
 
I dislike how quickly the first age goes as a result of rampant tech trading due to free techs from goody huts, which has led to me disabling barbs completely so I get a chance to use some of the earlier units.
If you're willing to mod the game, you could always make some/all of the Ancient techs non-tradeable.

Obviously, that won't stop them getting popped from Huts, but it would stop the AIs from passing them around like candy (so the advantage of making early contacts with your neighbours will then be reduced to 'only' the reduction of the total-beaker-values needed to research already-known techs).
 
Hi Flintlock,

I do not post here very often and do not follow all the updates you do but I played during the weekend and done some testing with an old and new versions of your tool and noticed something what might give a clue about treasuries. I had a question in the past about cashing treasuries in capitol which were working in default game but not in Conquest with your cx3.exe v9. When I installed v10 and newer v14-15 versions treasuries no longer can be cashed in both games. So it looks like somewhere withing those changes you have done recently is a switch for treasuries which makes them work or not.

And question about another matter. In Conquest game you can play 31 civs on any size map you like in defult game this is limited to size of a map and on biggest map you can play no more than 20? I don't no remember now how many excatly but less than 31. Do you think you could improve that?

Many thanks
 
I had a question in the past about cashing treasuries in capitol which were working in default game
??? The default Firaxis epic-game doesn't use Treasure-units, so I don't know what you mean here.

IIRC, cashable Treasure-units are only used in the Firaxis Conquest-scenario "Age of Discovery" (the "Middle Ages" Conquest uses the same Treasure-graphic for the 3 Holy Relics, but treats them like Princess-units; and the "Three Sisters" Conquests uses the actual "Princess" unit).
When I installed v10 and newer v14-15 versions treasuries no longer can be cashed in both games. So it looks like somewhere withing those changes you have done recently is a switch for treasuries which makes them work or not.
I suspect that this has nothing to do with Flintlock's patch.

For any random-map (epic) mod that does not have Treasure-units activated by default, while setting up the game-parameters in the "Choose your Civ" screen, the player must manually activate the appropriate check-box(es) in the right-hand column of the "Rules" section (not sure which check-boxes offhand: maybe "Capture the Princess" and/or "Victory locations"? @Civinator will know, since he included Treasures in CCM).

If the player forgets to do that, then while Treasure-units may still appear during the game (e.g. if autoproduced by buildings), they will not be collectable/ cashable.
In Conquest game you can play 31 civs on any size map you like in defult game this is limited to size of a map and on biggest map you can play no more than 20? I don't no remember now how many excatly but less than 31.
The Firaxis epic-game allows up to 16 playable tribes (plus the Barbarians) on a Huge map, i.e. 17 "Civs" in total.

However, the game can be modded in the Editor to put up to a maximum of 31 playable tribes (plus Barbs) on any size map (i.e. for a solo-game, that would be 1 human-controlled tribe, and 31 AI-controlled tribes — 30 of which would be 'real' Civs, with the 32nd civ-slot reserved for the "Barbarian Chiefdom").

But 32 Civs is a hardcoded limit, so cannot be increased without essentially rewriting the entire game.
 
Ok, just noticed one thing in game editor which was not checked for treasure unit. The patch v9 fixed it somehow in epic/default game and it did not in conquest game. I always thought it was something to do with patch itself :) and stopped looking. Thank you for that and Flintlock please ignore my question about this.

The Firaxis epic-game allows up to 16 playable tribes (plus the Barbarians) on a Huge map, i.e. 17 "Civs" in total.

However, the game can be modded in the Editor to put up to a maximum of 31 playable tribes (plus Barbs) on any size map (i.e. for a solo-game, that would be 1 human-controlled tribe, and 31 AI-controlled tribes — 30 of which would be 'real' Civs, with the 32nd civ-slot reserved for the "Barbarian Chiefdom").
In fact I can only play 15 tribes plus Barbs on huge map. I have set in editor 31 tribes to play but only in Conquest game 31 are playable, in epic/default game are not.
 
Last edited:
In fact I can only play 15 tribes plus Barbs on huge map. I have set in editor 31 tribes to play but only in Conquest game 31 are playable, in epic/default game are not.
Oh, sorry, I misunderstood: I didn't realise you were talking about the original 'Vanilla' Civ3 release from 2001!

(To be honest, it didn't occur to me that anyone was still playing that version!)

But (AFAIK) no, you can't put more than 16 Civs into that version, because the Vanilla editor won't allow it. And if you open and edit a .bic (Vanilla ruleset) file using the Conquests Editor, any changes you make will be saved in the .biq format anyway — and the Vanilla executable can't read .biq files.

But then it's all moot anyway, because this patch is only for the Civ3Complete(/Conquests) executable (originally released in ... 2003?), and then only the downloadable versions currently available through GOG/ Steam — and I can't imagine Flintlock has much/any interest in porting his changes all the way back to the Vanilla executable...
 
I don't have Vanilla? I use Conquest 3 Complete bought on GOG few years ago 3-4 yrs
Well then, now I'm really confused. If you're playing Civ3 Complete from GOG, then I don't understand the distinction you're making between the "epic/default game" and the "conquest game" — unless you simply mean a "mod"?

If you start a "New Game" in Civ3Complete/Conquests, you will be using the "conquests.exe" executable, and the default Firaxis ruleset, so that is the "default/epic game" — and yes, there will only be a maximum of 16 Civs (out of 31 available) placed on a Huge (random) map, and no, Flintlock's patch doesn't change that (and doesn't need to, since such a change can easily be made by modding the .biq).
Spoiler Probably unnecessary detail :
When you open the Complete/Conquests Editor, it will automatically make a copy of the default/epic Firaxis .biq, renamed as "Untitled.biq" to avoid accidentally over-writing the original Firaxis .biq. When you've finished modding and go to save your file, you'll be prompted to give it a new name, and that new modded .biq file will then be stored by default in the "../Civ3/Conquests/Scenarios" folder — assuming that the Editor has permission to write to that folder, anyway (if it doesn't, then that's a whole 'nother problem, and completely unrelated to Flintlock's patch). Modded .biq files are then accessible to play through the "Civ-Content" option on the Start-menu.

However, if you want to play every game using your modded .biq, without having to go through Civ-Content, then you will need to replace the Firaxis .biq with your modded .biq file — so rename/ make a back-up of the Firaxis file first (so you can restore it if something goes wrong!). Then move/copy your modded .biq up one level to the "../Civ3/Conquests/" folder (where the executable is), and rename it to use the default filename (IIRC, that's "civ3conquests.biq").
To play a game using more than the Firaxis-default number of Civs, you have to change the "Number of playable Civs" separately for each map-size in the Editor. i.e. If you only change that parameter for one map-size out of five (IIRC, the Editor initially defaults to showing the parameters for the "Standard" 100*100 map), obviously that change won't be visible if you then start a game using one of the other 4 (still-unmodded) map-sizes!
 
Ehh, that's how it is when you do things once a year :) Yes I mean to start a "New Game" in Civ3Complete/Conquests I thought everyone understand as default. Just found that thing about World Size in editor. Thank you for helping me to find an obvious :)
 
Bombardment improvement: Is it possible to have the AI target terrain improvements every once in a while with the Artillery, Navy and Air Units. They will only target this if you have Worker on the tile without an escort.

PS : The old PTW style bombardment is amazing to have again, many thanks!!
 
Back
Top Bottom