Resource icon

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

Unfortunately I have to report a freeze in my current test game with the R17 preview 2 version. Britain and China have a Military Protection Pact (MPP). An attack on the territory of each of these countries (by land, sea-bombardment or air-bombardment) leads to a freeze of the game after the first diplomatic screen of the Foreign Advisor is appearing. When clicking on the option "I said do it!" the music is stopping and the freeze of the game appears before the following diplomatic screens, that we have lost the supply of Cotton and that the attack causes the other country to declare war on us.

MPP-Freeze2.jpg


Edit: When continuing the test game with the R16 exe, first a screen with the Trade Advisor will appear, that I have lost the supply of Cotton, followed by a screen with the Foreign Advisor that the other civ has declared war on us because they had a MPP. As this is working with the R16 exe, it is clear that this is a problem of the R17 preview exe. As the MPP function is also working in a new start of the save file and the R17 preview 1 exe, I think it is clear that the freeze is a special problem of the R17 preview 2 exe.

Trade Advisor Loss of Cotton.jpg


Foreign advisor MPP.jpg


Edit 2: It seems the freeze in the R17 preview 2 version is triggered by the fact, that the image of the trade advisor with the message of the lost supply resource is not popping up. I made some attacks on other civs with MPPs, where no supply resource was lost and the image of the Foreign Advisor with the message, that the other civ declared war on us, popped up without any freezes.
 
Last edited:
Would there be a way to let Cities draw upon Food from outside their Zone? (essentially treating Food like a Resource.) Civ2 had an inept, quasi-pseudo-semi-sort-of implementation of this in Convoys. But, e.g., a true Rome scenario depicting the Roman dependency on Egyptian Wheat would be fabulous.
 
Hi Flintlock. :) I thought I would bring up an issue which is quite fundamental, as it applies to every mod that allows a cultural victory (including mine). It is the fact that the amount of culture points needed for a cultural victory doesn't scale with map size.
I agree this sounds easy but it concerns a part of the code I'm not familiar with so I'd have to look into it to be sure. The best solution is probably to take in a list of culture limits from the config file like you mentioned and then, when the player enters the civ selection screen after picking a map size, set the appropriate threshold as a custom limit. That way the player is still able to modify the limit. My first thought was to set the limit after the game was created but then you risk overwriting the player's setting.

As an aside, this is similar to how the varying civ & leader names now work. They're set as custom names as if they had been input through the "customize your tribe" form during game creation. One of the complications doing it that way was I had to make sure not to overwrite custom names actually input by the player.

Unfortunately I have to report a freeze in my current test game with the R17 preview 2 version.
That's annoying but on the bright side the freeze was found in the preview version instead of a full version. That is what preview versions are for, after all. I'll investigate and see if I can replicate this, if not I might need the save file to figure out what's the matter. It looks like it's related to Trade Net X since the freeze doesn't happen in R16 and has something to do with resource access.

Would there be a way to let Cities draw upon Food from outside their Zone? (essentially treating Food like a Resource.) Civ2 had an inept, quasi-pseudo-semi-sort-of implementation of this in Convoys. But, e.g., a true Rome scenario depicting the Roman dependency on Egyptian Wheat would be fabulous.
Right now there's no good way to do that. You could create a building that requires wheat and adds food to its city by generating a bonus resource with yields. The problem is that building could be built in every city so it wouldn't be like transferring food but more like duplicating it. To simulate a transfer it would be necessary to have the building not just require the resource but consume it so players could be limited to, say, one building per wheat resource. That's difficult since game doesn't track anything like that at the moment. It shouldn't be too difficult to add.
 
That's annoying but on the bright side the freeze was found in the preview version instead of a full version. That is what preview versions are for, after all. I'll investigate and see if I can replicate this, if not I might need the save file to figure out what's the matter. It looks like it's related to Trade Net X since the freeze doesn't happen in R16 and has something to do with resource access.
This freeze is a speciality of the R17 preview 2 version of your mod. When I use the R17 preview 1 exe or the R16 exe and than load the save file before the action that triggers the freeze, the freeze is not happening when attacking into British or Chinese territory. The freeze is even not happening with the R17 preview 2 exe, when the attack into the territory of a MPP civ is not influencing the trade of resources.

Of course I can send you the save file and than you have to attack into Chinese or British territory using that save file with the R17 preview 2 exe to trigger the freeze, but the question is, if this file is of any use for you without the additional CCM 3 files. There are big changes in the CCM 3 settings compared to CCM 2.5 (mostly to make a better use of your brilliant mod) and the CCM 3 biq and save files cannot be played by using the CCM 2.5 files.
 
Last edited:
This freeze is a speciality of the R17 preview 2 version of your mod. When I use the R17 preview 1 exe or the R16 exe and than load the save file before the action that triggers the freeze, the freeze is not happening when attacking into British or Chinese territory. The freeze is even not happening with the R17 preview 2 exe, when the attack into the territory of a MPP civ is not influencing the trade of resources.

Of course I can send you the save file and than you have to attack into Chinese or British territory using that save file with the R17 preview 2 exe to trigger the freeze, but the question is, if this file is of any use for you without the additional CCM 3 files. There are big changes in the CCM 3 settings compared to CCM 2.5 (mostly to make a better use of your brilliant mod) and the CCM 3 biq and save files cannot be played by using the CCM 2.5 files.
The fact that the freeze doesn't occur in preview 1 indicates it's not Trade Net X that's the problem. That's what I expect too after reviewing the code. I don't see any reason why TNX would malfunction when recomputing trade networks after a war declaration but not malfunction in all the other instances where a network is recomputed. There's just nothing special about the war declaration.

I have come up with an idea as to what the problem might be. I suspect it's caused by some code I inserted that recomputes resource access whenever a resource trade is cancelled and the traded resource is an input to a generator building. There's a relatively easy way for you to test this for me and I'd really appreciate it if you did. You can test it by editing the mod file civ_prog_objects.csv. First find the following line:
Code:
inlead,       0x55ED60,    0x56AE10,    0x55ED10,    "Leader_erase_export",                "bool (__fastcall *) (Leader * this, int edx, int importer_civ_id, int resource_id)"
You can use CTRL+F in Notepad to find it easily. Then replace the first word "inlead" with "define". You'll also have to reinstall the mod after making this change. If the game doesn't freeze after this change then that confirms my theory. Otherwise, I'll need the save file since I don't think I'll be able to replicate the bug on my own. I tried with a simple scenario but it didn't appear. Unfortunately I would also need all the files necessary to run the save since the way I would investigate it would be by letting the game freeze then check what it's doing while it's frozen using a debugger.
 
I know that this one is a "Hail Mary," but would it be possible to limit how many Units could be kept/built with, say, one Oil Resource? In WW2, Germany had access to Romanian Oil, but needed much more.
 
Flintlock, I had no problem to find line 478 that should be changed. After replacing in my 2010 Excel program the word inlead by define, I received a formatting warning and the new csv file after the replacement had 3 KB more (59 KB instead of 56 KB), even in a version where I completely deleted the contents in line 478. The installation file of your mod was not able to detect the new csv file with the replaced word.

CVS-Error.jpg


So I need a working csv file with that replacement that I can insert for installing the new C3C exe to do the test, if the freeze is disappearing when the new R17 preview 2 exe is used.

BtW.: The stopped supply of the resource Cotton in the new version of CCM is no input to a generator building of CCM. The speciality of the freeze is, that the normal graphical popup message of the Foreign Advisor in a MPP, that a civ has declared war to the player, is hold back until the popup message of the Trade Advisor, that the supply of a resource is lost, has appeared in the game - and this triggering popup of the Trade Advisor in R17 preview 2 is not coming.
 
Last edited:
I think Excel will always break the formatting of csv files when saving, you need to modify it in a text editor for it to work.
 
I think Excel will always break the formatting of csv files when saving, you need to modify it in a text editor for it to work.
Yes, this was also the advice by Flintlock. :yup: The problem was, that in the original download of the R17 Preview 2 files, that file was a csv file. I treated it with Notepad++ and after some tries I received the attached civ_prog_objects.csv with the change in line 478 from "inlead" to "define" and this new file was accepted for the new installation of the R17 Preview 2 exe.

When I started the new R17 Preview 2 exe, first I had no more access to all my save files. I found them in the virtual store of my pc and pasted them into the normal C3C saves folder. Now I was able to start the save file.

The new exe worked well. Now I was able to attack into the territory of both MPP civs. After the attack the Trade Advior, than the Foreign Advisor messages popped up and I was able to continue the game.

The freeze is gone! :bounce:
 

Attachments

  • civ_prog_objects.zip
    14.4 KB · Views: 3
I know that this one is a "Hail Mary," but would it be possible to limit how many Units could be kept/built with, say, one Oil Resource? In WW2, Germany had access to Romanian Oil, but needed much more.
One complication here is that the game doesn't record how many copies of each resource are connected to cities off the main trade network. (This is why the phantom resource bug exists. The game only stores one full set of resource info per player and any cities off the capital's network have only rudimentary info.) I can imagine some simple workarounds, for example cities off the main network could be considered to have at most one supply of any given resource. Other than that, it would be necessary to count how many of each unit type a player has. That's doable of course, it's just not easy or efficient since the game doesn't normally track that.

The new exe worked well. Now I was able to attack into the territory of both MPP civs. After the attack the Trade Advior, than the Foreign Advisor messages popped up and I was able to continue the game.

The freeze is gone! :bounce:
Great! That means I'm probably correct about what the problem is. I'll fix it in preview 3, it's a pretty simple fix. The issue is that the mod triggers a recomputation of resource access whenever a trade deal is cancelled for a resource that's an input to a generator however the game itself also cancels deals during those recomputations. So the game can get caught in an infinite loop when it recomputes resource access, which involves breaking a deal, causing the mod to start another recomputation, which breaks a deal, which starts another recomputation, etc. BTW, in your case, the cotton resource isn't necessary the problem. It could be another resource causing the freeze before the game gets a chance to show the popup for the cotton resource. Thank you for helping me narrow this down.
 
Other than that, it would be necessary to count how many of each unit type a player has. That's doable of course, it's just not easy or efficient since the game doesn't normally track that.
C3C is tracking how many of each unit type a player has. In the military advisor the military units of the player and of all civs with stolen military plans can be shown listed by unit types and numbers.

Military Advisor.jpg
 
Hello
1. Bug. Great wonder treasury earns 5%. When it becomes obsolete, it still continues to give gold.
2. AI is playing without the fog of war. What if AI will play with the fog of war like human player? Will it be better?
3. AI often sends naval transport half-empty. If the naval transports are fully loaded it will be better. Except when AI will send settler in naval transport.
 
General Question

I remember the 'enslave' unit capability had a 33% chance of converting a defeated enemy unit into another unit. According to a quick search I see that this 33% chance is hardcoded.

Any chance the Flintlock mod unlocks this number so that one can change the chance to enslave to 100%?
 
C3C is tracking how many of each unit type a player has. In the military advisor the military units of the player and of all civs with stolen military plans can be shown listed by unit types and numbers.
I'm pretty sure the way it works is the game sums up how many units of each type there are when the military advisor screen is opened. If it kept track of those numbers at all times I surely would have noticed by now. I've found that the game tracks something similar, how many units each player has for each AI strategy. Those numbers are used by the AI to balance its forces. Unfortunately not useful for us.

Hello
1. Bug. Great wonder treasury earns 5%. When it becomes obsolete, it still continues to give gold.
2. AI is playing without the fog of war. What if AI will play with the fog of war like human player? Will it be better?
3. AI often sends naval transport half-empty. If the naval transports are fully loaded it will be better. Except when AI will send settler in naval transport.
Hi!
  1. This would be relatively easy to change. I wouldn't classify this as a bug though since I can't be 100% sure the developers didn't intend for obsolete buildings to continue contributing interest. They probably didn't, it's easy to forget to check for obsolescence. They did remember to check that the wonders aren't tied to a different government.
  2. There's no single point in the code where it's determined whether or not AIs can see through the fog of war so it's difficult to fix this. I would have to locate and fix each case separately. What I could do is fix the more obvious ones, like how the AI can see all resources when deciding where to settle. One of the reasons I haven't done that is I expect it would make the AI worse, and the Civ 3 AI is bad enough as it is.
  3. This is something I'd like to do, along with making the AI build more transports when appropriate and making it gather its transports for one large invasion instead of trickling them in. I would need to learn a lot more about the unit AI before I could attempt any of these.

Any chance the Flintlock mod unlocks this number so that one can change the chance to enslave to 100%?
Sure. Simply changing the 33% chance to some other number would be easy. It's only a matter of overwriting that number in the game logic and I've already found where it is. Doing something fancier, like having an enslavement chance that varies by unit type, would be more difficult but still doable.
 
Revisiting a few old questions of mine. Apologies if they've since been answered, or even implemented:

Did you find out if the "defense" of terrain improvements/overlays vs bombardment uses the same value as citizens or buildings, and if not can you make it configurable?

City base maintenance. I think you said it would be doable to add a cost but you didn't know how to show it in the UI. How difficult would it be to vary the cost by size level and/or government? Visually, I think it would make sense to show the cost as red coins either to the right of "IMPROVEMENTS", or in place of the treasury gold at the top (why is that even relevant here?)

Did you ever find the problem with culturally linked starting locations?

And a new request: Both thematically and for gameplay, it's unfortunate that you can only see 1 tile away from your starting location. For random maps, would it be practical to either expose a larger radius, or automatically trigger the "maps of their region" goody hut effect?
 
1. AI sends his defense unit to pillage strategic resource. When defense unit is staying on tile with strategic resource I bombard him. Wounded AI's unit run away to heal but he can to pillage tile with strategic resource. He heal and then to attempt pillage again. Again and again. I think will be better if wounded AI's unit is so far from healing zone he must pillage.
2. Can AI upgrade obsolete unit? I often see AI's units different eras together. It is the big problem for him because his army is weak.
 
City base maintenance. I think you said it would be doable to add a cost but you didn't know how to show it in the UI. How difficult would it be to vary the cost by size level and/or government? Visually, I think it would make sense to show the cost as red coins either to the right of "IMPROVEMENTS", or in place of the treasury gold at the top (why is that even relevant here?)

Personally, I use the treasury gold count sometimes if I'm upgrading units in cities or cash-rushing - it's nice to be able to see where it'd leave you off without having to exit the city screen then re-enter it again.

The base maintenence cost could just be graphically displayed as red coins added to the end of the base city square's output?
 
The base maintenence cost could just be graphically displayed as red coins added to the end of the base city square's output?
Ooh that's an interesting idea, but it could be misleading depending on how the math works. I imagined this would be a maintenance charge against the budget, after the net GDP is calculated. If instead it's a direct deduction from the city tile yield, this makes perfect sense.

Edit: The more I think about it the more nuanced it gets. As a base modifier, it becomes more powerful because that's commerce that won't be multiplied by buildings and specialists, which I like, but on the other hand it might have been lost to corruption anyway. Then I'm not sure if the game allows for negative tile yield, and almost certainly not a negative net city yield, but I want this to outweigh the output of a newly founded city. I can work out a balance either way it's calculated, as long as building a new city becomes a net expense.
 
Last edited:
The AI will upgrade units as long as they have an AI strategy in the editor and as long as they have the cash for it. I'm not sure if the AI will upgrade if it has 0 cash but the upgrades themselves too require no cash.

The challenge is that the AI doesn't move its units into a city with the required improvement (barracks, harbor, airport) to be upgraded like the human would. The units would just be upgraded in whatever city they're stationed in if they're lucky to have the needed improvement. To remedy this, perfume the 3 above mentioned improvements so that they get built in every city. But that could mess up early game AI performance.

So my personal solution is to have an AI exclusive set of half prized+no maintenance barracks and harbors (the AI only harbor doesn't give food) that are heavily perfumed (100000) and timed with medieval technology like Chivalry (where a 40 shield barracks pays off when you make 70 shield knights). The AI will end up building both the regular barracks and harbor as well as the AI exclusive ones. But the net gain is absolutely worth it. Late game, the AI will be at war and things like barracks and harbor get ignored and many of their far flung or newly conquered cities end up churning out standard units. But with only another 50 shields, their units get upgraded and are all veterans.
 
And a new request: Both thematically and for gameplay, it's unfortunate that you can only see 1 tile away from your starting location. For random maps, would it be practical to either expose a larger radius, or automatically trigger the "maps of their region" goody hut effect?
You can give the civs special starting settlers with the radar flag.
 
Top Bottom