Resource icon

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

Were you ever able to make armies so that you could load and unload units from them?
You can already give the Army unit the "Unload" command in the Editor. The catch is that you will then not be able to load Armies onto a boat or plane themselves (although MGLs would still be so transport-able, and Armies could instead be made Airlift-able to allow moving them around between landmasses in the late game).
 
I really wanted to upgrade units in an army. Currently, to the best of my knowledge, you cannot upgrade a unit in an army. I thought the easiest way to do that would be to enable units to be unloaded from the army, so that they could be upgraded.
 
This mod is so amazing, and has been working wonderfully without issue. Thanks so much for making it.

There is a bug in vanilla civ 3 that I've heard about that would be nice to look into, namely, the flag "removes disease from floodplains" supposedly does nothing. (It would be applied to sanitation in the base game.)
 
First: thank you. this has breathed new life into the game and my mod. Top marks.

Bug: Not sure if this is the place to report this, and I haven't read through this thread, there is a lot of it, but I have a bug running Version 18. Once the unit limit is reached and a city is about to spit out that unit, if you switch to a building that will also be completed next turn (pretty sure this is the scenario). You get a free unit created as well. It looks to be a random one, although no doubt there is some mechanism at work here. It can leave you with some odd units you shouldn't be able to build.

That aside having heaps of fun limiting unit numbers so nobody gets too many dragons then limiting them to only be buildable in a city hosting a hatchery.Tons of flavour. Also sweet to add resources to buildings, added a few bonus ones. Just experimenting with minus food to some (this 'bonus' doesn't show in the building list though but works), so the hatchery consumes food, you have to feed your brooding dragons right?. Have to be careful I guess as the AI might build too many improvements requiring food in a city with a limited supply and it'll shrink to nothing, not sure what happens then!

Once again: great stuff.
 
Last edited:
When making my mod, I didn't take into account via testing to how well the AI would handle buildings which produce resources.

These resource producing buildings don't seem to be built by the AI. I have those building cost significant maintenance as I don't want there to be more than one or two built per civilization. I'm worried this may make to the AI these buildings low on the build priority. The resources produced are strategic in nature and quite needed.

Can someone point me to whatever dive there has been on how AI handles buildings which produce strategic resources?
 
Hello, @SuedecivIII and thanks for featuring C3X on your channel. I'll put a link to your video on the mod's main page the next time I update it. I was thinking of making a video myself showing how to install the mod since I've gotten a few questions about that but never got around to it.

This mod is so amazing, and has been working wonderfully without issue. Thanks so much for making it.
There is a bug in vanilla civ 3 that I've heard about that would be nice to look into, namely, the flag "removes disease from floodplains" supposedly does nothing. (It would be applied to sanitation in the base game.)
Glad to hear it. I'll make note of that bug and at some point look into the logic for triggering disease. I remember reading something like that too.

Bug: Not sure if this is the place to report this, and I haven't read through this thread, there is a lot of it, but I have a bug running Version 17. Once the unit limit is reached and a city is about to spit out that unit, if you switch to a building that will also be completed next turn (pretty sure this is the scenario). You get a free unit created as well. It looks to be a random one, although no doubt there is some mechanism at work here. It can leave you with some odd units you shouldn't be able to build.
The unit limit can cause cities to create a different unit than the one they had queued if creating the queued unit would violate a limit. Presumably that's why you're getting a seemingly random unit. Though I have no idea why you'd get any unit if the city is set to produce a building. I'll have to look into that. When you changed production to a building, did you do that the normal way on the previous turn? Or did you do something like zoom to a different city on the turn production completed then shift over to the city showing the bug to change production? Not that I see how it would matter.

By the way, the unit you get if you can't finish the queued one due to a limit isn't really random. The mod tries to a find a different unit to build that fits the same role as the original unit, based on AI strategies, and that is as expensive as possible so as not to waste shields. It's kind of like how the game will switch production off a wonder that can't be completed, only in that case it simply picks the most expensive alternative. Originally I wanted to pop up a little advisor window with a drop-down menu to let the player pick something else to build but that turned out to be too much trouble.

These resource producing buildings don't seem to be built by the AI. I have those building cost significant maintenance as I don't want there to be more than one or two built per civilization. I'm worried this may make to the AI these buildings low on the build priority. The resources produced are strategic in nature and quite needed.
Can someone point me to whatever dive there has been on how AI handles buildings which produce strategic resources?
The AI doesn't consider resource production when choosing what to build, it doesn't know about that feature at all. There are two things in C3X already that can help with your problem. First, you can see how the AI ranks all of its production options by pressing the P key on the city screen when viewing an AI city. Second, you can pump up the value of any build in the AI's eyes by applying "perfume", which is simply a flat number of points added to the AI's evaluation of that build option. Perfume is kind of a blunt tool, for example you wouldn't be able to increase a building's value only if the AI doesn't already have the resource it produces, but you should be able to push the building up into the range of things the AI sometimes builds.
 
When making my mod, I didn't take into account via testing to how well the AI would handle buildings which produce resources.

These resource producing buildings don't seem to be built by the AI. I have those building cost significant maintenance as I don't want there to be more than one or two built per civilization. I'm worried this may make to the AI these buildings low on the build priority. The resources produced are strategic in nature and quite needed.

Can someone point me to whatever dive there has been on how AI handles buildings which produce strategic resources?
Use the perfume function to make the AI prioritize building things. Stockgame's priority isn't good when it comes to time sensitive things like strategic resource producing improvements or autobuild improvements/small wonders. If you want them built ASAP you'd need to give them a very high perfume value like 1000.
 
  • Like
Reactions: ajb
The unit limit can cause cities to create a different unit than the one they had queued if creating the queued unit would violate a limit. Presumably that's why you're getting a seemingly random unit. Though I have no idea why you'd get any unit if the city is set to produce a building. I'll have to look into that. When you changed production to a building, did you do that the normal way on the previous turn? Or did you do something like zoom to a different city on the turn production completed then shift over to the city showing the bug to change production? Not that I see how it would matter.

By the way, the unit you get if you can't finish the queued one due to a limit isn't really random. The mod tries to a find a different unit to build that fits the same role as the original unit, based on AI strategies, and that is as expensive as possible so as not to waste shields. It's kind of like how the game will switch production off a wonder that can't be completed, only in that case it simply picks the most expensive alternative. Originally I wanted to pop up a little advisor window with a drop-down menu to let the player pick something else to build but that turned out to be too much trouble.


The AI doesn't consider resource production when choosing what to build, it doesn't know about that feature at all. There are two things in C3X already that can help with your problem. First, you can see how the AI ranks all of its production options by pressing the P key on the city screen when viewing an AI city. Second, you can pump up the value of any build in the AI's eyes by applying "perfume", which is simply a flat number of points added to the AI's evaluation of that build option. Perfume is kind of a blunt tool, for example you wouldn't be able to increase a building's value only if the AI doesn't already have the resource it produces, but you should be able to push the building up into the range of things the AI sometimes builds.

Thanks for the quick reply. I'll add oodles of perfume to a few things to make sure they get built, especially the food buildings as these give a decent bump. .As for the bug pretty sure it happens when I got a pop-up about the limit being reached and didn't want the proffered alternative so went to city view and selected a building instead that would be produced next turn as I had plenty of shields for a big build and didn't want to waste them. .At the start of the next turn I get the building and an unexpected unit, one not usually available to that civ so far anyway. Hope that helps.
.
FYI - sometimes the alternative unit option on the pop-up is the same as the one you were trying to build, pretty sure it was in this case (perhaps this bugette triggers the creation of unbuildable ones?). I am going fairly hard on unit limits so civs have a balanced army, only a few top knights, a fair number of trainied infantry and lots of militia.
 
For the Perfume specs, checking AI cities, I only get feedback for unit builds. I don't have any clue what buildings are. I should add there are numerous buildings and units available for build at all times (more or less). Any suggestions on how to determine Building build values by the AI?
 
Version 20 Preview 1 is ready. It's on GitHub like the preview versions usually are, here: https://github.com/maxpetul/C3X/releases/tag/Release_20_Preview_1. The big addition is the removal of the 256 city improvement limit. That turned out to be relatively easy to implement, assuming it works right and I haven't missed anything. Actually it took me longer to create a test scenario than it did to remove the limit. To make the test scenario, which I've attached below in case any of you want to try it out, I filled the scenario's improv list with placeholder buildings until there were 300 total and then I copied all the game's improvs after that and made the original ones unbuildable. So the game rules are the same as the standard game only, under the hood, all the game's city improvements are in slots 300-382 instead of 0-82 like normal. If the improv limit removal is working correctly, the test scenario should play exactly like the standard game. All the original improvs and placeholders are still visible cluttering up the Civilopedia, just ignore them.

As for how the limit removal works, it's actually quite straight forward. Basically, the problem with having more than 256 city improvements is that each city only stores whether each improv type has been built or not for up to 256 different types. If you go beyond that, the game will start accessing beyond the end of its lists of 256 entries and you'll get phantom buildings, crashes, etc. Fortunately those lists are accessed through functions which I can modify to safely handle entries beyond the first 256. Those extra entries are recorded elsewhere in memory allocated by the mod, and the mod will allocate as much as it needs for however many improv types are in the scenario data. Other than that, I don't know of any technical limits on how many improv types you can have. The only other issue is that the entries for the additional improvs need to be kept in the save game but that's an issue I've finally solved.

Packing additional data into save games turns out to be easy, in fact if I'd known how easy it was I would have done it earlier. It's just a matter of tacking some additional data onto the game's save data before it writes it to a file and, on the other side, inserting some code that runs after the game has loaded save data to read back in the additional mod data from the end of the file. I was concerned there would be problems with save compression or the game getting confused by the extra data while loading, but as it turns out it just works. The game just does generic compression over whatever save data it has, so that can include the mod's save data too for free, and, when loading, it ignores any extra data at the end of the file, so again it works just fine with the mod's additional data, no modifications necessary. The fact that the game ignores extra data at the end means that saves created with C3X, with extra data packed in, are still loadable by the unmodded game. BTW, I've seen some people assume that C3X saves are not compatible with the base game but that's not true. As of R19, C3X is fully save compatible with the base game, as in it doesn't even modify the save games at all so there's no difference between the two. Even now, when saves contain extra mod data, they'll still work with the base game, with the caveat that loading the game and saving it back out with the base game will lose any extra mod data.

Here's the full list of changes in R20P1:
  • Remove city improvement limit
    • Controlled by config option remove_city_improvement_limit
  • Option to show unit hitpoints on the stealth attack target selection popup (named show_hp_of_stealth_attack_options in config)
  • Option to have a warning when the building you've selected to build would replace another already built in the city
    • Named warn_when_chosen_building_would_replace_another in config, off by default
  • Option to prevent stealth attacks from targeting units that are invisible and unrevealed (named exclude_invisible_units_from_stealth_attack)
  • Stop barbarian spawns from bankrupting the barbarian player (matters only if barbs are allowed to capture cities)
  • Option stopping pollution of impassable tiles also covers volcanic eruptions
  • Make barbarians defend cities they've captured as if they were camps
  • Load a third config file, custom.c3x_config.ini, if present
  • Fix describe_states_of_units_on_menu setting being ignored
  • Stop units from airdropping multiple times in one turn
    • This only matters when dont_end_units_turn_after_airdrop has been activated
  • Do not group together units with different names on right-click menu
  • Record which units have used extra defensive bombards in save files
  • Touch up action descriptions for auto precision striking and fortified exhausted units
  • Correct description of lethal zone of control setting in default config


FYI - sometimes the alternative unit option on the pop-up is the same as the one you were trying to build, pretty sure it was in this case (perhaps this bugette triggers the creation of unbuildable ones?).
Thanks for the info. I don't know what's going on here, I'll have to look into it. It might be related to unit type duplication, but I thought I addressed that when I programmed this in the first place. Anyway, thanks for reporting this.

For the Perfume specs, checking AI cities, I only get feedback for unit builds. I don't have any clue what buildings are. I should add there are numerous buildings and units available for build at all times (more or less). Any suggestions on how to determine Building build values by the AI?
The AI production ranking is definitely supposed to include buildings. I have no idea why it wouldn't. This is another thing I'll have to look into.
 

Attachments

  • Improv Limit Removal Test.biq
    284.1 KB · Views: 4
Superb work!
Thank you very much Flintlock for these important improvements to the game.
The 256-building limit was a major constraint on the scenarios. Now it makes me want to get back to creating scenarios and mods for civ3!
All I have to do now is find my old excel files that contained all the ideas I had in my head, at least 15 years ago now...
 
The AI production ranking is definitely supposed to include buildings. I have no idea why it wouldn't. This is another thing I'll have to look into.
I think it is because I didn't see any scroll on the list. I should add the entire screen from top to bottom was filled with units and such, perhaps all the building information was cut off. I have a lot of buildings and units you can build.



Also, WOW on the new preview! Question, do you need some type of advanced editor to go beyond 256 or is the stock editor fine?
 
BTW, I've seen some people assume that C3X saves are not compatible with the base game but that's not true. As of R19, C3X is fully save compatible with the base game, as in it doesn't even modify the save games at all so there's no difference between the two. Even now, when saves contain extra mod data, they'll still work with the base game, with the caveat that loading the game and saving it back out with the base game will lose any extra mod data.
This pleases me on a spiritual level. :cool:

  • Option to show unit hitpoints on the stealth attack target selection popup (named show_hp_of_stealth_attack_options in config)
  • Option to prevent stealth attacks from targeting units that are invisible and unrevealed (named exclude_invisible_units_from_stealth_attack)
 
I think it is because I didn't see any scroll on the list. I should add the entire screen from top to bottom was filled with units and such, perhaps all the building information was cut off. I have a lot of buildings and units you can build.
That makes sense. I don't know about adding a scroll bar, that would probably require creating a whole custom window. Right now I'm just reusing some base game methods to create that popup and others like it. Those methods are easy to use but limited as to what they can do. An easier solution would be to have multiple popups when there are too many items to fit on just one.

Also, WOW on the new preview! Question, do you need some type of advanced editor to go beyond 256 or is the stock editor fine?
The stock editor is limited to 256 buildings. I used Quintillus's editor to create the test scenario.
 
The unit limit can cause cities to create a different unit than the one they had queued if creating the queued unit would violate a limit. Presumably that's why you're getting a seemingly random unit. Though I have no idea why you'd get any unit if the city is set to produce a building. I'll have to look into that. When you changed production to a building, did you do that the normal way on the previous turn? Or did you do something like zoom to a different city on the turn production completed then shift over to the city showing the bug to change production? Not that I see how it would matter.

By the way, the unit you get if you can't finish the queued one due to a limit isn't really random. The mod tries to a find a different unit to build that fits the same role as the original unit, based on AI strategies, and that is as expensive as possible so as not to waste shields. It's kind of like how the game will switch production off a wonder that can't be completed, only in that case it simply picks the most expensive alternative. Originally I wanted to pop up a little advisor window with a drop-down menu to let the player pick something else to build but that turned out to be too much trouble.


The AI doesn't consider resource production when choosing what to build, it doesn't know about that feature at all. There are two things in C3X already that can help with your problem. First, you can see how the AI ranks all of its production options by pressing the P key on the city screen when viewing an AI city. Second, you can pump up the value of any build in the AI's eyes by applying "perfume", which is simply a flat number of points added to the AI's evaluation of that build option. Perfume is kind of a blunt tool, for example you wouldn't be able to increase a building's value only if the AI doesn't already have the resource it produces, but you should be able to push the building up into the range of things the AI sometimes builds.

FYI: I have been experimenting and this is how the extra unit is created - you try and build a unit that has reached the number limit. You get the pop-up and go to city view. You pick a building instead of another unit, one where you have enough shields to build it immediately. Bingo: you get the building and a free unit.

I've set limits for every unit, why not, however it is tricky to manage since it's not clear when you'll hit the limits, I can't even see an easy way to find out how many cities I have. It woud be helpful to know on some menu or list how many units of each type you are free to build if a limit has been set. I spend a lot of time managing production and trying to work out if it is worth trying to build something, you can waste a lot of shields for the big units when you are forced to switch. It's easy to set too many cities to build units when you've only one more to go.

Edited to add: looks like you also need a full set of shields for the unit you were trying to build.
 
Last edited:
Top Bottom