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.
 
Back
Top Bottom