K-Mod: Far Beyond the Sword

Glad to hear that it works.
Does the integer value represent a percentage, or a bizarre integer weight
For instance, if I set this to 5, and then to 10, what would be the mathematical difference.
They're percentage points that the AI adds to the true combat odds (AI_attackOdds). When deciding whether to attack, the AI will often compare those (biased) odds with a fixed threshold, e.g. in the frequently used function for opportunistic attacks (AI_anyAttack). In that case, the weighted odds function rewritten by K-Mod (AI_weightedOdds) is used, which adjusts the AI_attackOdds further based on the stakes of the battle, i.e. how much each side stands to win and lose. I suspect that that function is the main reason why K-Mod Barbarians are less suicidal than in BtS. The randomization of the odds bias apparently happens once per turn and applies equally to all Barbarian units. Two dice are rolled, each with iAttackOddsChangeRand minus 1 sides (CvPlayerAI::AI_doMilitary).

So it seems that your change will, on average, add 35 points to the true odds, which ... seems like a lot. The odds thresholds are, for the most part, 20% or less, so I'd expect the Barbarians to attack pretty much always if the odds are treated as 35 percentage points greater than they truly are. But I might be missing something here.
 
Glad to hear that it works.They're percentage points that the AI adds to the true combat odds (AI_attackOdds). When deciding whether to attack, the AI will often compare those (biased) odds with a fixed threshold, e.g. in the frequently used function for opportunistic attacks (AI_anyAttack). In that case, the weighted odds function rewritten by K-Mod (AI_weightedOdds) is used, which adjusts the AI_attackOdds further based on the stakes of the battle, i.e. how much each side stands to win and lose. I suspect that that function is the main reason why K-Mod Barbarians are less suicidal than in BtS. The randomization of the odds bias apparently happens once per turn and applies equally to all Barbarian units. Two dice are rolled, each with iAttackOddsChangeRand minus 1 sides (CvPlayerAI::AI_doMilitary).

So it seems that your change will, on average, add 35 points to the true odds, which ... seems like a lot. The odds thresholds are, for the most part, 20% or less, so I'd expect the Barbarians to attack pretty much always if the odds are treated as 35 percentage points greater than they truly are. But I might be missing something here.

They do. When its a huge lakes map, with zero water (on raging barbs) the only way to survive is if they attack immediately. And it's still not easy lol.

Without this change they form multiple doom stacks of 30-40 barbs, pillaging everything, leaving both the player and the AI's in the stone age until 1500 AD.
 
Hi, I'm having trouble with OOS Errors occurring late game even with use of k-mod. I was wondering if there is a version I don't have right or something. I'm on 1.46 k-mod with Steams latest version of BTS.
 
I doubt that the Steam changes to the EXE can lead to OOS errors, but installing Steam's "beta"/ original version is generally considered to be on the safer side with DLL mods like K-Mod. Maybe your game has just taken an unlucky turn that runs into some rare-ish OOS problem not fixed by K-Mod.

I think there's one OOS problem I've encountered and fixed that turned out to be introduced by K-Mod 1.38 (K-Mod Git commit; my bugfix). Your description in the tech support forum ...
I was wondering if there is a fix for OOS errors with K-mod installed. I have 18 civs on but after about 2 turns it always goes oos, making it unplayable. Is there something I can do about it?
... perhaps fits. The bug in question, I reckon, would occur in between turns every couple/ few turns, maybe every turn. Could be worth a shot switching to my (minor) inofficial update for K-Mod. Will need to be renamed to "K-Mod" after unzipping. And both players would need to do this. Of course neither player having modified their original files also is potentially important for staying synchronized.

I haven't actually tested this latest version of my code at all. I add some small change now and then that I've tested in my own mod and deemed safe. A few players have been using earlier versions and didn't report any issues.

I suppose all the BUG options in K-Mod should be network-safe, but probably, for some, this was never tested, so, if you want to try everything, one player could send their BUG INI files (My Games\Beyond the Sword\K-Mod\Settings) to the other(s) to get on the same page and then perhaps only to make personal changes considered essential.
 
Ok, thanks for the suggestions ill give these a try. Although the game was absolutely fine up until near end game. Is there any way of knowing before i get to that point or would i just have to see it through to the modern age?
 
Last edited:
Without having a clue what BtS or K-Mod bug is responsible, I can't speculate about any early warning signs. If such a bug is even the cause; but, as you write, it's odd that the game worked fine thus far and a bug in code that (probably) runs only in the late game could explain that, and a bug that only affects some games could explain why K-Mod (including the last few version) is generally reported to be pretty stable in network games contrary to your experience. That one bug I'm aware of is an uninitialized boolean variable in AI code for evaluating techs; hard to predict when and how frequently this could lead to the variable being zero for one player and nonzero for the other. Conceivable that just having a sufficiently complex game state will do it. Or that there's some other bug in the code that will usually cause problems with this many AI players (no idea if such large K-Mod multiplayer games are frequently played). For testing if my bugfix helps, it should be possible to load your existing savegame with my K-Mod version. Unfortunately, AI Auto Play isn't available for network games; that would be helpful for gauging whether future games with those or other settings are doomed. Wondering if the Autorun feature in CivilizationIV.ini would work for a network game set up on a single machine (connecting to 127.0.0.1) ... Nope, not in a quick test. Only one player gets automated and the game immediately goes OOS. One would think that Firaxis must've built in some way of automated testing for network issues; but perhaps not.
 
Back
Top Bottom