Resource icon

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

This would be pretty difficult. The formula for corruption is rather complex and it's computed by one large function in the game, about 350 lines decompiled. If the decorruption effect from buildings were computed by a separate function, I could easily replace it or modify what it returns, but it's computed by a simple for loop in the main function. Modifying loops like that is possible, but it's more involved than modifying function calls. It's tempting to reimplement the whole thing in mode code, that way I could make it completely configurable. The downside is it would be a fair bit of work and I'd have to be careful to make sure my reimplementation computes exactly the same thing.
I understand. Don't worry about it then, sounds like a disproportionate effort. :)
 
A while back, Trade Net X was implemented, which greatly speeds up turn times for the AI players. I think it might be possible to speed up turn times for the human player too, especially during the late game and on larger maps. By tweaking the unit auto-selector.

Let's say you have marched up a large army to attack Constantinople. You want to resolve the siege before doing anything else. So you manually scroll down your long list of units, select your artillery to soften up the defenses first, then the strongest attackers. But every time you move a unit, the auto-selector insists on jumping back to an insignificant Worker on the other side of the map. So you keep on scrolling back the map, and scrolling down the unit list. Which is time consuming and annoying.

So I wonder, would it be possible to make the auto-selector finish all units in the currently selected stack, one type at a time, before moving on to something else?
 
As I understand that would mean no use for AI for example of weak unit that can stealth attack another weak unit in a stack, because it would think it attacks a most defense unit in a stack which is suicide. I was hoping there's somewhere a unified function that determines if unit can attack other unit in tile which would be used by AI automatically making it aware of all rule tweaks.
That's right. There's a function that determines whether a given unit can stealth attack another one and a function that searches for a stealth attack target for a given unit on a given tile, but neither of those are used by the unit AI to decide where to move or attack.

I wish there was a way to have unit AI as a C/C++ source to tweak it, it would open so much possibilities for improving game experience.
Unfortunately tweaking the unit AI is difficult. It's easy to replace it entirely, at least in terms of editing the EXE, but the catch is that you'd have to reimplement everything it does. For example, the offensive unit AI can perform airdrops and load up for naval invasions and has logic to handle the special game modes capture the princess, regicide, and victory point scoring. It would be nice if it were possible to modify only how it selects targets to attack but I don't see any way to do that. I have already rewritten one of the simpler AI strategies, the one for leader units, here's what that looks like: https://github.com/maxpetul/C3X/blob/02e62c512f8db10656486604b551b4d29cab725f/injected_code.c#L5974

So I wonder, would it be possible to make the auto-selector finish all units in the currently selected stack, one type at a time, before moving on to something else?
I'm looking into this now since this annoys me too. I believe it's possible, yes.
 
Hello Flintlock,

Thanks again for continuing to develop features on this superb mod/patch, I've recently been enjoying the implementation by ajb in Star Wars: The Mod Awakens EPIC. As a potential further refinement, I wonder if it would be possible to adjust the length of time before wonders start to generate tourism? In many scenarios they are pre-built at the start of the scenario and should already be established attractions, and in others (indeed, most) the timescale of the scenario is much too short for the tourism effect to get started.
 
I always thought forced resettlement penalty should apply to foreign citizens only which would make sense for xenophobic government and make it more interesting for civs without much foreign population.
Also cities under strong cultural pressure could start changing citizens nationality instead of silly things like culture flipping, preparing them for future military conquest or diplomatic transfer.
I also never understood culture flipping idea and would prefer having unhappy citizens and possible riots instead.
Just some thoughts.

upd: Another idea is to limit airlift capability for airports/airfields to 1 total incoming/outgoing airlift per turn, currently only outgoing airlift is limited so you can send like 100 units to one airfield in one turn if you have enough cities, limiting it to 1 per turn can make it more balanced while still useful. And since the game already stores flag for outgoing airlift this shouldn't be very hard I guess.
And preventing unit airlift if enemy has air superiority over airfield tile would also make sense probably.
 
Last edited:
I also never understood culture flipping idea and would prefer having unhappy citizens and possible riots instead.
Another idea is to limit airlift capability for airports/airfields to 1 total incoming/outgoing airlift per turn, currently only outgoing airlift is limited so you can send like 100 units to one airfield in one turn if you have enough cities, limiting it to 1 per turn can make it more balanced while still useful.
I support both of these ideas. 👍
 
Hello Flintlock,

Thanks again for continuing to develop features on this superb mod/patch, I've recently been enjoying the implementation by ajb in Star Wars: The Mod Awakens EPIC. As a potential further refinement, I wonder if it would be possible to adjust the length of time before wonders start to generate tourism? In many scenarios they are pre-built at the start of the scenario and should already be established attractions, and in others (indeed, most) the timescale of the scenario is much too short for the tourism effect to get started.
With these scenarios, you could use C3X to make these Wonders generate a bonus resource called "Tourism" and set that resource's tile bonus to increase tax.
 
Thanks again Flintlock for the tremendous efforts!

Just being a squeaky wheel about the building limits. Similar to the unit limits you already implemented. Would love to have something like a "Tank Factory" limited to 1 every 5 cities; "Barracks" limited to 1 every 2 cities; "University" 3 per empire; etc.

Might even be an idea to limit buildings to other buildings. Currently if you need 5 of something, once achieved you can build infinite amounts of other buildings. Would be nice to have build one building per x number of other buildings.

Examples:
TANK Factory: limit 1 per 5 cities
Industrialization: no limit
Heavy Industrialization: limit 1 + 1 per 3 "Industrialization"
Advanced Industrialization: limit 1 + 1 per 4 "Heavy Industrialization".
----> creates specific resource "Advanced Tanks" Required for "Advanced tank factory"
Advanced Tank Factory: limit 1 + 1 per 10 cities

So, a number of limitations changing between cities and buildings. Note: there would be a number of resources needed to be within the city to build "Industrialization" to begin with.
 
Last edited:
Is there a way to enhance the "box" on the mini map? On maps larger than huge a white box is hard for me to locate against a faint blue civ. Man, being old has so many downers.
I was poking around the minimap code to answer your question and noticed something very convenient, that the size of the minimap is completely dynamic. Changing its size is as simple as changing two integers inside the program for width and height. Here's what increasing them by 100 each looks like:
larger_minimap.JPG

It no longer fits in its frame, but other than that everything works. I'll add an option to double the size of the minimap to R25 since it's so easy. To answer your original question, modifying the white boxes is doable but awkward. I don't see any easier way than to replace the entire method that draws them and that method is surprisingly complicated due to the fact that it can vary a lot which pixels on the minimap correspond to which tiles. I'm not sure what would be the best way to change the boxes even if it were possible, maybe give each a little drop shadow?

I wonder if it would be possible to adjust the length of time before wonders start to generate tourism? In many scenarios they are pre-built at the start of the scenario and should already be established attractions, and in others (indeed, most) the timescale of the scenario is much too short for the tourism effect to get started.
This would be quite easy. The game has a separate little function that determines the tourism amount for any given building and it would be simple to replace.

I always thought forced resettlement penalty should apply to foreign citizens only which would make sense for xenophobic government and make it more interesting for civs without much foreign population.
Also cities under strong cultural pressure could start changing citizens nationality instead of silly things like culture flipping, preparing them for future military conquest or diplomatic transfer.
I also never understood culture flipping idea and would prefer having unhappy citizens and possible riots instead.
Personally I hate the way culture flipping works in Civ 3 and always turn it off. It's an interesting question how it could be changed to be fun instead of a massive annoyance. Pollution is another mechanic that could use a rework, I've thought about that one a bit but haven't come up with anything really good. Reworking the game rules is something I'd like to leave for the future after I have Lua integrated into the mod.

Another idea is to limit airlift capability for airports/airfields to 1 total incoming/outgoing airlift per turn, currently only outgoing airlift is limited so you can send like 100 units to one airfield in one turn if you have enough cities, limiting it to 1 per turn can make it more balanced while still useful. And since the game already stores flag for outgoing airlift this shouldn't be very hard I guess.
And preventing unit airlift if enemy has air superiority over airfield tile would also make sense probably.
You're right that it wouldn't be hard to limit airlifts to one incoming per turn. I've already limited airlifting to once per turn for units and could do something similar for tiles instead. I wouldn't want to reuse the flag for outgoing airlifts since then you wouldn't be able to do both an incoming and outgoing airlift on the same tile in the same turn.

Just being a squeaky wheel about the building limits. Similar to the unit limits you already implemented. Would love to have something like a "Tank Factory" limited to 1 every 5 cities; "Barracks" limited to 1 every 2 cities; "University" 3 per empire; etc.
Might even be an idea to limit buildings to other buildings. Currently if you need 5 of something, once achieved you can build infinite amounts of other buildings. Would be nice to have build one building per x number of other buildings.
I'll add this to the top of my list of things to do with Lua, up there with anti-prereqs for buildings.
 
You can see if these fit or need adjustment.
Thank you, it looks like it fits:
larger_minimap_frame.JPG

Although I'm not sure this is the final size I want. I simply added 100 px to the width and height as an example to show it's possible. I was planning to double the original width and height, though that's not necessarily the best idea either. This enlarged minimap is 329x208 pixels. I measured the original to be 229x105, which feels like a very arbitrary size. By the way, there's probably an off-by-one error there and the original developers intended the width to be 330 px. Relatedly, there's a one pixel gap between the minimap itself and the inner left edge of the frame. Probably not worth worrying about as I never noticed until zooming in on these screenshots.

Here's what the minimap looks like when it's doubled in size, in the original frame:
double_size_minimap.jpg

Clearly too large for a 1024x768 window, but I was planning to limit this change to HD resolutions anyway. I think the minimap looks better when it's more square, but the the tiles are twice as wide as they are tall, so maybe it makes more sense to keep the ratio close to 2:1 like the original devs had it. What do you guys think?

As maps has been brought up, is it possible for water to show as the civilization territory colors? Would be super helpful for scifi games which have water as "space".
Yes, it would be possible and very easy. The game calls a function to check if a tile is water before coloring it on the minimap, and I could redirect that call to return that any tile is not water so they all get colored. I'll add that to the list for R25 since it's so simple.
 
AI routine for "caravan units", which are modded units whose purpose is to be disbanded for shields -- This is like the custom unit AI for pop units, only for modded units that add shields instead of pop points. To be considered a caravan unit (the name comes from Civ 2), a unit must use the terraform AI strategy, have no worker actions enabled, have the ability to disband, and have zero attack, defense, & bombard strengths. The AI will move such units to an appropriate city and disband them for shields. The AI logic is relatively simple, it tries to get the full shield value from disbanding, prioritizes less corrupt cities when disbanding into infrastructure, and is smart enough not to try to disband into wonders.
Caravans, that's very interesting.
:woohoo:
:worship:
:clap:
:worship:
:woohoo:


Unfortunately, this raises many questions in my curious mind. :hmm:

If a caravan costs 100 shields and a city is only 99 (or 24 at a transfer ratio of 75%) shields short of completing a building, does that mean that the AI will not decide to use the caravan to speed up production at that moment and will instead send the caravan elsewhere? When is the decision made on how to use a caravan? I am referring to cases where, before the caravan arrives at its destination to speed up production, the building may already be nearing completion and will therefore not meet this condition ("it tries to get the full shield value from disbanding,"). If the condition is not met, will the caravan wait in the city or leave for another location, if one exists?

If they use a terraform AI strategy, does that mean they will respond to threats by hiding in the city like ordinary workers? Are they able to assign a defensive escort to themselves like artillery?

It does not, my main concern was just getting the full disband value of the unit. I programmed it to avoid disbanding into buildings in highly corrupt cities since I thought that otherwise the AI would waste its caravan units on the stupid infrastructure projects it tends to start in worthless cities. It's true, though, that that means the AI loses out on the option of using caravans as a way to build things in highly corrupt cities despite their corruption. I don't see any easy way to solve that without second guessing all of the AI's production choices.
What should the desired behavior be? If I created a test scenario with 20 cities in a row. On one side, the capital city with no corruption, and on the other side, the city with the highest level of corruption. All cities are connected by railroad. Then I would create 200 caravans. Let's assume that all cities are building something that can be accelerated by a caravan. What behavior can we expect from the caravans?

If the optimal number of cities is 10, to how many cities will the AI never send a caravan? Or rather, what percentage of corruption is classified as highly corrupt cities? In my opinion, the AI should strive to transform peripheral cities, which are only a burden on thriving cities. And the sooner it manages to eradicate corruption, the better and more effective the AI will be.

Does their location matter?
If I place all the caravans in one place, will they all go to speed up construction in one city, and once the building is finished, will they go to speed up construction in another place, or will each caravan go to a different destination to speed up construction?
Will this behavior change if I place 10 caravans in each city? Or if the cities are only connected by roads, or not connected at all? In the case of islands, are they able to use transport ships (In the case where the caravan has a special action Load) or airports (In the case where the caravan has a special action Airlift)?

Are caravans immediately assigned tasks, or can they be kept in reserve (caravan escrow amount = 1 per 5 cities)?
These caravans in reserve should be specifically focused on accelerating the construction of buildings that reduce corruption in cities with high levels of corruption. Is it so difficult for AI to recognize that a city has high levels of corruption and therefore designate it as a city that needs caravan assistance when it builds a building that reduces corruption? During wars, these caravans should again be primarily intended as assistance for military and cultural buildings for cities close to enemies, as @Predator145 pointed out. But here I am definitely getting into territory that should be covered by Lua, where one would customize something like caravan priorities and which buildings (or rather the effects of buildings) and cities to search for.

If I had two types of caravans, the first type requiring support and the second not, would the AI be able to primarily assign tasks to caravans that require support in order to get rid of them as quickly as possible (for cases where it has too many units and has to pay for them) and keep the caravans that don't require support in reserve?

I also considered connecting caravans with locally generated resources. For example, steel produced locally in a city factory could be transported by a caravan to another city for local use only. Upon arriving at the destination city and attempting to enter it, a table of options (Enter the city; Import steel) would appear with resources produced (only if any exist) in the caravan's city of origin that are lacking in the destination city. After the connection was established, the caravan would of course disappear as used and steel would be available in both cities. For simplicity, this connection would be unlimited in time. The flow of steel to the second city (or other cities) would only temporarily stop if the factory in the first city stopped producing steel due to a disruption in the production chain or if the trade network was disrupted. The connection would be permanently interrupted by the destruction or sale of the steel factory, or by changing the nationality of the city of Import or Export. I guess the PROBLEM would be that the caravan would have to remember the city where it was manufactured and what resources are locally generated in that city in order for this micro-trade connection to be successfully implemented. Also, the fact that a local resource is imported (shared) somewhere must be remembered somewhere. Yes, I consider this whole point to be highly challenging and therefore more like something from the world of dreams, but I can't help but ask about its feasibility?

When I wrote the unit AI for caravans, I had in mind that they would be autoproduced from wonders. I didn't think of them as a way to transfer shields, so the AI's mostly just concerned with getting their full value immediately. I don't think it makes sense to use carvans to transfer shields since you lose 75% along the way. I can't imagine ever wanting to do that. Although, that 75% loss is something that could easily be changed.
I can imagine that one type of caravan would be produced automatically by the wonder. Such a unit would cost, say, 400 shields, so at 75% it would give 100 shields as aid. However, another wonder could allow the construction of a second type of caravan, which would cost, say, 50 shields and would also give 50 shields as aid, thus ignoring 75%. Is it true that the number of shields also tells the AI how much to value a given unit? If so, the loss of a caravan worth 400 shields during the war would be far more painful in the eyes of the AI than its actual value as aid.
 
I am playing a test game with the next version of RARR and that version modified by starting with 31 civs and the C3X option "Barbarians can capture cities" enabled. To my surprise the Barbarians were able to capture big parts of a continent and are the "player" who eliminated the most civs in the game. It is a pitty, that I cannot spy into those Barbarian towns.

Barbarian Havoc.jpg


Edit: The naval exploration shows big "killing fields" on that continent and three Barbarian cities in the reach of one naval movement turn. The Barbarian towns all show the "walled" city graphics and the RARR Barbarian Rider as their defense units.

Killing fields.jpg


In the red marked region of the minimap I only found Barbarian towns:

Barbarian continent.jpg
 
Last edited:
Back
Top Bottom