Resource icon

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

I desperately need the option to have a negative prerequisite for a building, i.e. if a city has a resource in its pool, or an existing building, then it cannot built a certain building, which has that resource / building, as a negative prerequisite. That is in order to implement city profiling in a mod that I work on for some time already. The idea is to create true city profiling, where each city is dedicated to a certain trait, e.g. a military complex, a research hub, financial center, etc. This can be done if a building or a resource exists in the city, that blocks the creation of other buildings. Then the city can follow a certain building chain, unlocking other buildings later, while unable to building the other building chains. Also, an option to have a resource as a tech prerequisite would be quite interesting to explore. Thanks :)
 
I desperately need the option to have a negative prerequisite for a building, i.e. if a city has a resource in its pool, or an existing building, then it cannot built a certain building, which has that resource / building, as a negative prerequisite. That is in order to implement city profiling in a mod that I work on for some time already. The idea is to create true city profiling, where each city is dedicated to a certain trait, e.g. a military complex, a research hub, financial center, etc. This can be done if a building or a resource exists in the city, that blocks the creation of other buildings. Then the city can follow a certain building chain, unlocking other buildings later, while unable to building the other building chains. Also, an option to have a resource as a tech prerequisite would be quite interesting to explore. Thanks :)
I'd like similar too.

The flag "replace this with that" AI doesn't understand and will get into a cycle of building the same two building over and over again.

What I'd like to see is if the AI builds something with "replace this with that" whatever that other building is, can no longer be buildable.

Better yet, what you requested --- this would be amazing if Flintlock can make this happen.
 
A few more suggestions for improving the game:
- when choosing a scenario to load at the start of a game, the game displays a preview of the entire map, which in an exploration-focused Eldorado-style mod ruins much of the scenario's interest. Is there a way to disable this preview and replace it with a question mark, for example?
- I find it completely illogical that a unit that still has 1 movement point can climb a mountain that costs 5 movement points (there are explorers to do this). It would be great if C3X could manage unit movement in a more rational way, with an optional setting to disable this option for those who wish to maintain the original game's movements.
- The FogOfWar.pcx file seems to be useless! I've modified it to look more like civ6, but the game still puts black boxes for unexplored areas of the map (hardcoded?).
 
Last edited:
Is there a way to disable trade network calculations?

Could we have a setting, where we check "ignore trade network calculations: roads/airports/harbors?

I'd like to have the symbol for a harbor/airport show, but none of the related trade network connections.
I should have added further details, I'd like to still have trade network calculations done for roads, just not airports or harbors.
I think I understand what you're trying to achieve, @ajb . You just want the Harbor/Airport symbols, but no trade effects. Have you considered using this C3X setting?

; Causes cities to display harbor/airport icons if they have buildings that grant the relevant unit effects (produce veterans & heal in one turn)
; instead of buildings that grant sea/air trade. This makes no difference under the standard rules but is useful with mods that separate the unit
; effects and trade abilities into different buildings.
city_icons_show_unit_effects_not_trade = true


It will cause the desired symbols to be shown when you set "Veteran Sea Units" or "Veteran Air Units" flags for the building. Leave the "Allows Sea Trade" or "Allows Air Trade" flags turned off. The only side effect is it will cause sea/air units to become veterans. But you said the Harbor buildings won't even be on the coast, so at least ships won't be affected then.
 
  • Like
Reactions: ajb
Can you post a save along with the mod files needed to open it? That way I can have it crash on my own machine and inspect what it was doing with a debugger. Otherwise I could only guess as to what the problem is. I don't know of any bugs in resource generation at the moment.
Here's a link to a Google drive folder with the relevant files, let me know if anything doesn't seem to work: https://drive.google.com/drive/folders/1UYeLK_WHfUBpGFzLGB_PBrlQOrJAaAj5?usp=drive_link.

I've built a Monastery in Arbela, and opening that city screen is what seems to crash things. I've included a save file titled "Persia" where you can try this.

UPDATE: The Monastery in Arbela seems to be working, but now I'm running into the same crash a bit later on when I try to open the Palenque city screen. The issue there might have to do with the option to build a Factory, which in this mod requires a Coal strategic resource and produces a Consumer Goods luxury. It might also have to do with displaying the "Consumer Goods" luxury, because I have already built a Factory in another city in this save file. When I remove the "Consumer Goods" luxury from my scenario config file, the crash no longer takes place. I've included a save file titled "Persia 2" where you can try this.
 
Last edited:
I desperately need the option to have a negative prerequisite for a building, i.e. if a city has a resource in its pool, or an existing building, then it cannot built a certain building, which has that resource / building, as a negative prerequisite. That is in order to implement city profiling in a mod that I work on for some time already. The idea is to create true city profiling, where each city is dedicated to a certain trait, e.g. a military complex, a research hub, financial center, etc. This can be done if a building or a resource exists in the city, that blocks the creation of other buildings. Then the city can follow a certain building chain, unlocking other buildings later, while unable to building the other building chains.
If you only require 1 city to build each chain, then maybe you could enable each chain with a wonder, instead of blocking the other cities with resources? Just make the first building in a chain a small wonder (each civilization may have only one). Then make the next (normal) building in the chain require the small wonder to build, etc.

You will have to provide splash screens for the wonders though, or the game will crash.
 
Last edited:
If you only require 1 city to build each chain, then maybe you could enable each chain with a wonder, instead of blocking the other cities with resources? Just make the first building in a chain a small wonder (each civilization may have only one). Then make the next (normal) building in the chain require the small wonder to build, etc.

You will have to provide splash screens for the wonders though, or the game will crash.
That would have been easy, but I want each city to have the option to choose its development path, i.e. having more than one military centers, financial, etc. For now I have this done with the mutually exclusive toggle (same that used for the power plants in vanilla), but that doesn’t prevent the option to toggle from one building to another (I have 4 base buildings which determine which way the city goes). Therefore, it is not exclusive option, unless I have a negative prerequisite available. That is crucial to the mod, as later on other buildings, units and strategic resources are unlocked, depending on how many military centers, financial hubs, scientific, etc the player has built. I use 4 strategic resources, which serve as prerequisites for building each type of city. That is ok, unless a city has more than one, within its limits. Then comes the issue with the toggle loop, the AI may decide to change from one base building to another, which will ruin the the whole idea 🤪 I just need an option to have a negative prerequisite, that will serve as a building lock, i.e. blocking the toggle option
 
I'd like similar too.

The flag "replace this with that" AI doesn't understand and will get into a cycle of building the same two building over and over again.

What I'd like to see is if the AI builds something with "replace this with that" whatever that other building is, can no longer be buildable.

Better yet, what you requested --- this would be amazing if Flintlock can make this happen.
Indeed, that is the loop issue I face; the AI will probably change from one building to another, which will open the building options for all locked buildings, which I don’t want; I can achieve an exclusive choice only with a negative prerequisite, or eventually with a resource prerequisite for a tech;
 
So you agreed with Babylon to attack the Portuguese in exchange for Babylon attacking... you, and you're paying them 26 GPT for their trouble. It must be that when the agreement came up for renewal, the AI tried to compute the value of it for itself and for you, and the value for you depends on the distance from your capital to the nearest city belonging to the target of the alliance, except the target is you, so the distance was of course zero. I don't suppose you have any idea how this happened?
Yep, I negotiate some awesome deals, don't I?

Going back through the saves I see that there had been a previous alliance between Babylon and me against the Portuguese with no other conditions. So I started cycling through the turns but that previous alliance never expired. It goes from 3 turns to 2 turns to 1 turn remaining, but then I went through five more turns without it coming up for renewal. I don't recall seeing anything unusual with it during the original play through.

So maybe the game save just got corrupted somehow. At this point it doesn't seem like I can go back and reproduce it.
 
I desperately need the option to have a negative prerequisite for a building, i.e. if a city has a resource in its pool, or an existing building, then it cannot built a certain building, which has that resource / building, as a negative prerequisite.
Negative prerequisite is an interesting thing after all. I have already asked for two similar things a little earlier:
1) To prohibit the construction of some improvements or wonders for specific governments.
2) The inverse function building_prereqs_for_units, so that the presence of some improvement in the city prohibits the production of listed units.
I am still really looking forward to the implementation of the first idea, but I have temporarily abandoned the second one recently, but your request made me return to the idea that negative prerequisite is a necessary thing in its various forms. I hope @Flintlock somehow will find time for it.

I find it completely illogical that a unit that still has 1 movement point can climb a mountain that costs 5 movement points (there are explorers to do this). It would be great if C3X could manage unit movement in a more rational way, with an optional setting to disable this option for those who wish to maintain the original game's movements.
I have also raised this question recently, but it went unnoticed. Now I see I'm not the only who interested in this, that's why it's a good chance to remind about it:
I am almost sure that I remember how in some version of the game (maybe it was some mod) my units (with 1 move) lost their next turn when entering a tile with forest and hills, and lost the next 2 turns on mountains, marshes, jungles, volcanoes and tundra.
I think that this solution is better than a strict ban on entering a tile with some terrain for those who do not have enough movement points. It can be justified by the overspending forces by the unit at the turn and its subsequent rest at the next turn/turns. And yes, if it would possible to implement, that would be cool!
 
There was another similar idea and no less interesting method of its implementation. It would be interesting to know @Flintlock 's opinion on how feasible it is.

it would also be interesting to somehow divide units according to the space they take in the transport: Infantry, workers, settlers, cruise missile, etc. - 1; cavalry, wheeled units - 2; heavy armored vehicles - 3 or 4. This could be implemented by listing the units, that would be time consuming but qualitative, or by units's abilities (foot, wheeled, etc.), which gives less room for maneuver, but is most likely easier to implement.
[EDIT]: I have an idea. What if the space required for each unit could be set in the Civ 3 Editor? There is a field called "Transport Capacity", which is normally used for the opposite, to set how many units can be loaded onto a transport. But that field is never used for normal units, so it's free and available to use. As long as you don't set the "Unload" flag or give them the "Transport" role, as far as I know, the units will behave normally (haven't tested this, though). So for example, if the Transport Capacity field is set to a value higher than 1, then that is how many slots this unit will occupy in a transport. If set to 1, or left at the standard 0, then the normal 1 slot is required.

By the way, this can also be used to ban certain units from being transported. For example heavy bombers on an aircraft carrier. Just set the number higher than the transport's total capacity, and it won't fit.
 
I should have added further details, I'd like to still have trade network calculations done for roads, just not airports or harbors.
I don't know of any really easy way to do that. The easiest would probably be to edit the rules so that harbors and airports don't allow sea/air trade. As EPW pointed out, you can do that without losing the map icons as long as you have the city_icons_show_unit_effects_not_trade C3X setting turned on.

Any idea as to the added burden of 20-50 airports and harbors (MAX) to a game with 512 connected cities with roads (MAX)?
Harbors really will be in locations with no water -- can I assume this will not add to the calculation burden?
Airports will typically be duplicates or triplicates in the same city -- can I assume this would be treated the same as if 2 or 3 cities had an airport?
By far the slowest part of recomputing trade networks is searching for connections between cities with harbors. That's because that involves the pathfinder and has to be done for each pair of harbor cities. Recomputing the road networks also involves the pathfinder but it's an operation that's done once per road network, not per city, so when you have 512 cities it's negligible compared with the sea trade calculations. In my testing on the Monstrosity map, computing road networks took much less than 1% the overall turn time.

The less water the better because it means the pathfinder has fewer tiles to check while searching for a path. I don't think it's an exaggeration to say computing sea trade would be 1000x times faster for a city on a 10 tile lake compared to one on a 10000 tile ocean.

Computing airport connections would take almost no time since it doesn't involve pathfinding at all, though I haven't bothered to measure it. Multiple airports in the same city would not make any difference compared to having only one. Adding airports could even speed up the overall trade network calculation if the airports connect cities that otherwise would have been connected by harbors. That's because the calculations first check if two cities are connected by road or air before searching for a connection by water. The trade network calculations are pretty inefficient but not completely stupid.

By the way, if you want some hard numbers, C3X has a feature that times the trade network computation and overall interturn time. It's something I added while working on Trade Net X. The option is named measure_turn_times.

Also, I know this has been asked before, but there still are some units which won't stack properly, so I'll see Tank, Tank, Tank, vs (3x) Tank. Most units work fine, haven't been able to figure out what the issue is.
Units with a transport capacity > 0 will never stack, I don't suppose those tanks are modded to be able to carry units? That would explain it, otherwise I have no idea. In my own testing, I've never seen unit stacking not work properly.

I desperately need the option to have a negative prerequisite for a building, i.e. if a city has a resource in its pool, or an existing building, then it cannot built a certain building, which has that resource / building, as a negative prerequisite.
I'm reluctant to add things like this because they'd be perfect for little Lua scripts. All you really need is a little function that rules out build options based on the state of the city: the presence or absence of buildings and resources. Splitting that out over many different config variables is a much uglier way of making it work. I realize that Lua is still a long way off so maybe I'll add this kind of thing anyway, but it'll be for R24 at the earliest since I've already decided what will be the final things for R23.

- when choosing a scenario to load at the start of a game, the game displays a preview of the entire map, which in an exploration-focused Eldorado-style mod ruins much of the scenario's interest. Is there a way to disable this preview and replace it with a question mark, for example?
Not that I know of. I've never looked at that part of the code, but it doesn't sound difficult.

- I find it completely illogical that a unit that still has 1 movement point can climb a mountain that costs 5 movement points (there are explorers to do this). It would be great if C3X could manage unit movement in a more rational way, with an optional setting to disable this option for those who wish to maintain the original game's movements.
The big problem with this (I'm guessing you're asking for Civ 2 style movement) would be the pathfinder. I don't think it would be feasible to modify the pathfinder to handle that kind of movement rule. The only option would be to replace the whole thing which would be a huge job.

Here's a link to a Google drive folder with the relevant files, let me know if anything doesn't seem to work: https://drive.google.com/drive/folders/1UYeLK_WHfUBpGFzLGB_PBrlQOrJAaAj5?usp=drive_link.
Alright, I got it, thanks. I'll look into this sometime in the next few days.

There was another similar idea and no less interesting method of its implementation. It would be interesting to know @Flintlock 's opinion on how feasible it is.
Right off hand, I don't see any reason it wouldn't be feasible. It might mess with armies, but it shouldn't be a problem to carve out an exception just for them. The game already does something similar to this where armies take up more space in transports than single units (under the hood an army is a single unit with its own passengers), so that's another indication that it's possible.
 
I looked into what's going on with the movement of empty armies. The calculation of their maximum available movement points returns one less than one full move's worth of MP. Under the standard game rules, one full move is 3 MP, so armies have 2, which is why they can only move two tiles along roads. I'm sure this is a bug. The calculation works like this (in pseudocode):
Code:
function GetMaxMovePoints(unit):
    if unit has army ability:
        slowestMemberMP = -1
        for other units on the same tile:
            if other is contained in unit:
                if (slowestMemberMP is -1) or (other.GetMaxMovePoints() < slowestMemberMP):
                    slowestMemberMP = other.GetMaxMovePoints()
        fullMoveMP = scenarioData.roadMovementRate
        if (slowestMemberMP + fullMoveMP != -1) ## <==== BUG!
            return slowestMemberMP + fullMoveMP

    return unit.GetUnitType().GetMaxMovePoints()
The code sets slowestMemberMP initially to -1 then loops over all units in the army and sets it to the least max movement points that any of them have. Of course, this is to limit army movement to the slowest member. The bug comes after that loop, instead of checking whether slowestMemberMP is -1, i.e., that it has not been set and the army is empty, the condition checks whether slowestMemberMP + fullMoveMP is -1. The intention was to return slowestMemberMP + fullMoveMP only for non-empty armies, however because of the mistaken condition, it's returned for any army as slowestMemberMP + fullMoveMP will never be -1. So the logic works for occupied armies, they get one more move than their slowest member, but empty armies get one more move than -1, in other words one less than a full move's worth of MP. This will be fixed in the next mod version, the fix is simply to reimplement this bit of logic without the bug.
 
I have a question about resources generated by improvements--are their yields impacted by improvements that increase taxes? For example, if a Tea Plantation improvement produces a Tea luxury with +2 tax (with the "yield" command), would a Marketplace in the same city bring the yield from that Tea luxury to +3 tax, or would the +2 tax go straight to the treasury?
 
I have a question about resources generated by improvements--are their yields impacted by improvements that increase taxes? For example, if a Tea Plantation improvement produces a Tea luxury with +2 tax (with the "yield" command), would a Marketplace in the same city bring the yield from that Tea luxury to +3 tax, or would the +2 tax go straight to the treasury?
Yields from generated resources are considered the same as tile yields, in fact under the hood they're added in with the overall tile yields for their city. So, yes, they benefit from buildings like marketplaces, libraries, and factories, and also are hit by corruption.

I had a look at your save that was crashing. The crash occurs when the game tries to load a small luxury icon to display in the luxuries box on the city screen. Your mod doesn't include a custom version of Art\city screen\luxuryicons_small.pcx, so the game falls back on the base version of that file which isn't nearly large enough for all the resources you have. I was able to stop the crash by taking the base PCX and scaling it up 10x in both width and height so it provided enough icons.
 
Yields from generated resources are considered the same as tile yields, in fact under the hood they're added in with the overall tile yields for their city. So, yes, they benefit from buildings like marketplaces, libraries, and factories, and also are hit by corruption.

I had a look at your save that was crashing. The crash occurs when the game tries to load a small luxury icon to display in the luxuries box on the city screen. Your mod doesn't include a custom version of Art\city screen\luxuryicons_small.pcx, so the game falls back on the base version of that file which isn't nearly large enough for all the resources you have. I was able to stop the crash by taking the base PCX and scaling it up 10x in both width and height so it provided enough icons.
Nice, this is extremely helpful, thank you! Did you drop the scaled-up PCX in the drive? No worries if not, I can figure out how to make one (or just pirate one from around the forums).
 
Nice, this is extremely helpful, thank you! Did you drop the scaled-up PCX in the drive? No worries if not, I can figure out how to make one (or just pirate one from around the forums).
You're welcome. I uploaded it just now, though it's really nothing special. I didn't fill in any icons, the additional space is all blank.
 
You're welcome. I uploaded it just now, though it's really nothing special. I didn't fill in any icons, the additional space is all blank.
While I have you, I've been trying to incorporate tradeable none-era techs that enable resources as a way to simulate the diffusion of those resources. The goal is to have sets of civs start with techs that give access to a particular set of organic resources (Amerindian civs start with Maize, Middle Eastern with Cattle, Asian with Rice, etc.), and for these resources to spread across the world as civs with different starting organic resources make contact and start trading--basically the diffusion of domesticates across the Old World, the Colombian Exchange, etc. I'd rather not do this with city improvements, the way I did religions, because I want these organic resources to proliferate across the landscape in appropriate terrains.

Is there a way to enable the trade of none-era techs?
 
Is there a way to enable the trade of none-era techs?
Looking at the code to assemble trade options, in order to be tradable, a tech must be owned by the seller, be an available research option for the buyer, not have the untradable flag, and pass some kind of flavor threshold (for the AI). The issue is that era none techs are not available as research options, so they can't be traded either. This would not be particularly difficult to change but it wouldn't be trivial either. Maybe for R24. R23 is almost done and I don't want to delay it with last minute additions.
 
Back
Top Bottom