K-Mod: Far Beyond the Sword

If I have missed some major fact/strategy/excitement filled aspect here please tell me, I dont see the path to winning without at least a little war, and if they/you declare war after 200 turns of peace they WILL have an age worth of better troops- like trebs vs cannons type stuff.

Final summation: Boring and nearly impossible to win at higher difficulties (without war). Boom, nailed it.

In high-level games you usually want to kill a neighbour in the very beginning (at least this is the case for rather cramped maps on which I usually play); with additional land you will be able to stay on par with AI until at least reneissance (at which point - more wars). And if you don't have a neighbour to kill, it means that you have enough expansion land to outplay AI straight up. If you can't do it, than you should just lower your difficulty.
In K-Mod early rushes are much more difficult to pull off than in better AI mod, for example. For me it was the primary reason, why I lowered my own standard difficulty from immortal to emperor: on immortal I usually just can't survive the early game.
Btw, this is also the reason, why I would like to ask to add increasing difficulty component to the mod: after I survived early game, or even rushed someone, emperor starts to seem too easy.
 
karadoc, do you think you could make the city governor place more emphasis on working improved tiles? I'm not sure what changes you've already done in this area, but it seems like I have to micromanage the city screen much more using this mod. The AI always wants to work unimproved forest tiles when it should be working cottages and mines.
 
For the dll code, you started with the last Better AI version you found on sourceforge, is that correct?
I was thinking about porting your AI changes back to Better BUG AI (bug fixes, AI and UI improvements without game rule changes) but I think I clearly underestimated the work you put into this. Not sure if I can actually pull it off.. I've only yet looked at CvCity and CvCityAI, and I'm already convinced this will be a nightmare to merge -_-;

Anyway, congratulations on actually making the AI fare better against humans, please keep up the good work. And don't forget that there are people who would be very grateful for verbose comments in the code whereever you changed/will change something.
 
karadoc, do you think you could make the city governor place more emphasis on working improved tiles? I'm not sure what changes you've already done in this area, but it seems like I have to micromanage the city screen much more using this mod. The AI always wants to work unimproved forest tiles when it should be working cottages and mines.

You don't by chance, from the main BtS Options screen, have the "Workers Leave Old Improvements alone" checked do you?

JosEPh
 
You don't by chance, from the main BtS Options screen, have the "Workers Leave Old Improvements alone" checked do you?

JosEPh

I do, but I'm not sure why that should matter. I'm not talking about the worker AI; I'm talking about the AI that chooses what tiles a city will work.
 
Kara, I'm merging your source with my source code for one of my conglomerate mods that contains super spies. I see you moved Espionage AI to CvUnitAI.cpp. Super Spies has some AI that goes in CvPlayerAI.cpp, but the code no longer fits in your CvUnitAI.cpp.

Am I correct in thinking that
Code:
// One espionage mission loop to rule them all.

means that the Super Spies AI is no longer needed?
 
Maybe someone can help me. I've almost finished merging KMOD with my mod, but can't seem to get rid of this nasty 103 count error in CvGameTextMgr.cpp. It is my last error. I fixed it once, but can't remember how.


Edit: FIxed the problem. However, when I played me newly merged IIW Mod, it took 3 minutes per turn instead of less than 10s. It is unfortunate, given the AI improvements. I do have tons of UU.
 
Hi there, I've been following the thread for a couple of weeks, this mod is intriguing and being a little disillusioned with Civ 5 I am delighted to see that Civ 4 mods are still getting some attention.
Tech ais annoy me to no end, but thats my own perference clearly.
Please forgive me for jumping straight in on this, but I recognise that this concept causes disagreement in many 4x games. It seems that there is a lot of variation in peoples' expectations as to how the AI should behave.

To me that there is a scale: at one end of the scale the AI will "roleplay" its flavour ruthlessly, even if it should lead to stagnation and terminate their chances of success. This is perhaps leads to a more believable world simulation but can lead to the "Peace Island" scenario that Charles555nc mentioned.

At the other end of the scale the AI could perhaps behave just like in a competitive multiplayer game, purely looking for the best oppotunity to expand and succeed, and while using racial bonuses where possible could happily overlook their racial flavour where it constrains their chances. If you are on an island of 4 players and all are Buddhist, if stagnation is imminent you might look for the option to expand aggressively even if you spiritual, pacifistic or whatever.

As I said, from what I've seen people's expectations often lie in different places on this scale. Rigidly roleplaying AI at its worst leads to predictable and exploitable opponents and ruthless opponents at their worst lead to a lack of opponent flavour and variety - the difficulty is finding that perfect balance. In Distant Worlds they have a game option for the overall aggression level in the galaxy which roughly corresponds which gives the opportunity to tune to a preference. I would presume that in Civ between the skill levels and the Aggressive AI flag there is similar means to articulate a player preference.

At the risk of discussing suggestions of extra work for karadoc (who from all I've read has already woven a great deal of industry and magic into the mod) how could such things be put in game? Could the stagnation be detected as a lack of candidates for settler sites, conquest targets and exploration? Could the border tension diplomatic modifier be increased in times of stagnation? When faced with a block of Civs in peace and where it is not viable for a single civ to break from the group, shouldn't the stronger civs be considering and suggesting the possibility of a joint backstab of a neighbour if for example Aggressive AI is set?

Sorry again for suddenly throwing this out there! I think it's a few years since I posted in the Civ 4 subforum, it's like relaxing back in a trusty old armchair. :)
 
The major change in AI victory pursuit I noticed in Kmod was AI's seem to pursue conquest victories much more actively. I thought about that a long time ago and thought how it seemed very "gamey" that civs would become friendly with each other simply due to sharing a religion or having a good trade history. I remember thinking a long time ago that the game would be more interesting if there were more concrete methods of forcing costs on a civ for choosing to war against an ally. There is already the "we will not fight with our brothers and sisters of the faith" penalty and I was thinking of something more along the lines of that. If you have been friendly with a civ for a long time, your people should get angry at the thought of you going to war. Long terms of open borders and trading could cause a happiness penalty for going to war with that civ, on top of the normal war weariness. Two civs with the same state religion could also suffer an additional penalty. Then the AI could be modified to try to avoid these penalties. Another interesting aspect would be to make the penalty modified by government type. "Free" societies like free speech and representation or universal suffrage could suffer the full effects of these penalties, while police state or theocratic societies could suffer less. It would add some strategic depth to diplomacy. Perhaps it could be balanced by slightly lowering war weariness or something like that.
 
Hi Karadoc,

always a great mod! And always thanks for your work!

I noticed in version 133 that the flank attack of mounted units against siege units is broken. I attacked with an horse archer a stack with also 4 catapultes and even if my horse archer won, no damage inflicted to enemy siege units.

Also enemy cavalry attacked a stack of my army with trebuchet: she won but inflicted no damage to my siege units.
 
@axios
well karadoc has updated to 1.34 so maybe check again? i tried it there and flanking seems to be working fine. flanking doesnt apply in cities or forts btw, in case thats something you didnt kno.

@karadoc
i havnt been around for awhile but to address some points:
i can no longer reproduce those assert failures i had a couple weeks ago since i upgraded to VS2008 (or maybe you fixed summat in v1.34). really sorry to have sent you on any wild goose chases if it was on my end.

you asked some pages back if anyone was going ahead about the subforum, dunno if you noticed or if you still ambivalent about it, but The_J specified "only the mod owner" back here

could you elaborate on the first entry in the changelog: "The anti-double-move rule in simultaneous turns mode now only applies after meeting another human"?

(edit) minor suggestion: the text that appears after flanking deaths, eg: "your trebuchet been killed from a barbarian cavalry flank attack", possibly throw in a "has"? there's probably a bunch more syntax errors like that i seem to remember, if you give enough of a damn to look at them /minor quibble:)
 
@axios
well karadoc has updated to 1.34 so maybe check again? i tried it there and flanking seems to be working fine. flanking doesnt apply in cities or forts btw, in case thats something you didnt kno.

-CUT-

Thanks for the reply: I remember wrong, or in vanilla bts, flank attack was allowed also in cities?

So, no bug at all. Good.
 
units in cities -and forts i think - don't get damaged by flank attack. units outside can be injured by units attacking from a city. this is unchanged from vanilla bts....i think:)
 
karadoc, do you think you could make the city governor place more emphasis on working improved tiles? I'm not sure what changes you've already done in this area, but it seems like I have to micromanage the city screen much more using this mod. The AI always wants to work unimproved forest tiles when it should be working cottages and mines.
Well, currently there is no emphasis on improved tiles whatsoever. The governor chooses which tiles to work based solely on what working the tile would give the city. (ie. the yield). The reason they sometimes try to work forests instead of mines is that they wants to grow the city more. I think that probably does happen a little bit too often though; and I may look into it again in the future*. In the mean time, here's a tip which might help you:
if you use 'emphasize production', or 'emphasize commerce' (or both), then the governor will put less emphasis on growth, and so will be more likely to work the mines (with emphasize production) or cottages.

(*That reminds me; I forgot to change that thing Charles555nc was talking about awhile back. Maybe next version.)

For the dll code, you started with the last Better AI version you found on sourceforge, is that correct?
I was thinking about porting your AI changes back to Better BUG AI (bug fixes, AI and UI improvements without game rule changes) but I think I clearly underestimated the work you put into this. Not sure if I can actually pull it off.. I've only yet looked at CvCity and CvCityAI, and I'm already convinced this will be a nightmare to merge -_-;

Anyway, congratulations on actually making the AI fare better against humans, please keep up the good work. And don't forget that there are people who would be very grateful for verbose comments in the code whereever you changed/will change something.
Yes, I'm pretty sure that's the code I started with. (But maybe not. It was a long time ago and I don't really remember. I just used whatever I thought was the latest version at the time - so that's most likely the sf.net code.)

There are indeed a huge amount of changes. I'm sorry again about the lack of marker-comment around changes. I was doing that for awhile, but it's just such a drag. It ends up taking a significant amount of time; and I still maintain that it's easier to what's change and why by looking at the version control system. (ie. either online with github, or with git itself.)
What tends to happen is that I'll change one line, and put a comment on it, and then change a different line, and put a comment on it, and then change something in-between the two lines; and then remove the two commends and replace them with a marker at the start and at the end, saying, 'changed a few lines to fix blah'; and then later I might add a new parameter to the function which affects a couple of things; and change the comment to say 'changed a few lines in fix blah; and replaced bDumbParameter with iMoreDynamicParameterThatMakesSense' -- and then I'll realize that bDumbParameter wasn't so dumb after all, and change back, and so change the comment back.. and then I might decide that the stuff I've just written would be better if it was in its own function, so I cut it out of there, and put it in a new function, and write comments saying 'this code use to be in such-and-such-function, but it was different; I've changed blah'; and another comment where I took it saying 'I've moved some code to another function; and also, it's different now because I fixed blah'....

and so it goes on. It's like every change gets doubled, because it requires a comment as well - and in the end I just don't think it's worth it because all of that change information goes into the commit log anyway.

Kara, I'm merging your source with my source code for one of my conglomerate mods that contains super spies. I see you moved Espionage AI to CvUnitAI.cpp. Super Spies has some AI that goes in CvPlayerAI.cpp, but the code no longer fits in your CvUnitAI.cpp.

Am I correct in thinking that
Code:
// One espionage mission loop to rule them all.
means that the Super Spies AI is no longer needed?
Well, I don't know what the AI for Super Spies looks like; but if all it does it teach the AI to use some new espionage missions, then it probably won't be required. If the new missions have been created simply by editing the espionage xml, then I expect the K-Mod AI will understand the new missions and be able to use them. However, if there are completely types of missions, with new xml fields; then the AI will need to be told how to evaluate the new effect. That should be done in CvPlayerAI::AI_espionageVal. I don't think the 'one espionage mission loop to rule them all' will need to be changed in any case.

However, when I played me newly merged IIW Mod, it took 3 minutes per turn instead of less than 10s. It is unfortunate, given the AI improvements. I do have tons of UU.
Yes. That's unfortunate. Actually, 3 minutes sounds a bit extreme. It sounds like it's probably due to some bugs rather than just due to inefficiency...
In any case, I suggest you compile a 'profile' version of the dll; then use it to load a save game which you know will have a slow turn; press end turn; then quit and look at the profile log to see what part of the game was taking so long. -- Also, Ungomma was talking about speed issues in merged mods a couple of pages back. Maybe you should look at what was said there.

To me that there is a scale: at one end of the scale the AI will "roleplay" its flavour ruthlessly, even if it should lead to stagnation and terminate their chances of success. This is perhaps leads to a more believable world simulation but can lead to the "Peace Island" scenario that Charles555nc mentioned.

At the other end of the scale the AI could perhaps behave just like in a competitive multiplayer game, purely looking for the best oppotunity to expand and succeed, and while using racial bonuses where possible could happily overlook their racial flavour where it constrains their chances. If you are on an island of 4 players and all are Buddhist, if stagnation is imminent you might look for the option to expand aggressively even if you spiritual, pacifistic or whatever.

As I said, from what I've seen people's expectations often lie in different places on this scale. Rigidly roleplaying AI at its worst leads to predictable and exploitable opponents and ruthless opponents at their worst lead to a lack of opponent flavour and variety - the difficulty is finding that perfect balance. In Distant Worlds they have a game option for the overall aggression level in the galaxy which roughly corresponds which gives the opportunity to tune to a preference. I would presume that in Civ between the skill levels and the Aggressive AI flag there is similar means to articulate a player preference.

At the risk of discussing suggestions of extra work for karadoc (who from all I've read has already woven a great deal of industry and magic into the mod) how could such things be put in game? Could the stagnation be detected as a lack of candidates for settler sites, conquest targets and exploration? Could the border tension diplomatic modifier be increased in times of stagnation? When faced with a block of Civs in peace and where it is not viable for a single civ to break from the group, shouldn't the stronger civs be considering and suggesting the possibility of a joint backstab of a neighbour if for example Aggressive AI is set?
I think you're right about there being a scale like that, and about different people having different expectations. For the 'peace island' case though, it's not necessarily about that though. I can imagine situations where even the most ruthless players might find themselves in a kind of peaceful deadlock, where it's to no ones advantage to declare war - because they know that whoever goes to war will end up behind in tech; and so on.

In that kind of situation, a cooperative 'joint backstab' could probably break the deadlock - but the AI currently isn't capable of doing that. ie. they don't consult with one other for any reason. Each AI acts independently; and so they simply don't know how to agree in advance to attack a particular player. (Maybe they'll be taught something like that in the future; but currently there are no mechanisms in place to allow them to communicate with each other like that.) -- I think it's probably a sensible suggestion that the "aggressive AI" option be used to twist the AI rules in such a way that peaceful games don't happen. I myself never actually use the "aggressive AI" option, so I don't really know how well it works currently. But I do know that all it currently does is increase the weight of military-stuff in the AI. They are more likely to declare war; more likely to use war-like strategies in general; more likely to build units regardless of whether they are are war; and so on. -- but it doesn't affect their attitude rating towards other civs; and it doesn't (currently) affect the absolute effects that those attitude ratings have - and so you could still end up with a peaceful island with "aggressive AI" turned on...

It's not really clear to me if / how this should be changed. As I said, I don't currently intend to change it for the default options. I think it's working pretty well... but maybe there's an easy way change it for "aggressive AI". -- Having cooperative backstabs would probably be good, but don't want to tackle the AI for that at the moment. I'd prefer to just do something really simple (especially since I don't intend to use this option myself). Charles555nc suggested that maybe the religion attitude bonus could be reduced if all civs on the island had the same religion - but I think this might be a bit tricky. ie. It's not clear to me how much it should be reduced? If it's a lot, then it removes a lot of the personality & strategy from religion-based civs. (There often is one main religion for each island; and so if the effect of the religion was reduced a lot - it would have a large effect on most games.) -- If the effect is smaller, then it might not be enough to break the peace anyway... and making the effect time-based is a bit tricky, because not all the relevant info have turn-counters; and there would still be a question of magnitude and so on.

There is one very simple change that comes to mind, and maybe it's suitable... The change it to simply subtract 5% from the "no war probability" of all civs for all attitudes - so that all civs are allowed to declare war with their friends all through the game (but only with quite small probability -- and only with the "aggressive AI" option turned on).


could you elaborate on the first entry in the changelog: "The anti-double-move rule in simultaneous turns mode now only applies after meeting another human"?
In simultaneous turns mode (for multiplayer games), there's a rule that prevents players from moving a unit right at the end of one turn, then immediately again at the start of the next turn. The rule is basically just that units which were recently moved in the previous turn are temporarily frozen at the start of the next turn; so that players at least have a few seconds to react before the unit is moveable again. -- The change in the latest version of K-Mod simply disables that rule for anyone who hasn't yet met a human player. The anti-double-moves rule only exists to give human players a chance to react to surprise attacks from other human players; and so I figure that if the players haven't even seen each other, then the rule has no purpose. The point of disabling the rule is so that the early-game can go a bit smoother; so that players don't have to wait for ages just to move their one and only unit one step each turn.

(edit) minor suggestion: the text that appears after flanking deaths, eg: "your trebuchet been killed from a barbarian cavalry flank attack", possibly throw in a "has"? there's probably a bunch more syntax errors like that i seem to remember, if you give enough of a damn to look at them /minor quibble:)
I'll fix that. Thanks.
Regarding flanking attacks with mounted units vs siege units - I haven't changed how that works. At least, I haven't changed it deliberately! So if it has changed, then it's a bug! (By the sounds of things, everything is actually working fine anyway.)

--

Straight after I uploaded v1.34 I found a small bug. :( I don't think it's important enough to justify a whole new version though, so the fix will have to wait.
The bug is that whenever a human player captures a city, the city-captured sound effect plays for all human players, regardless of whether they have the city on their map. (The bug is a side effect of a change I made in the previous version - the change to disassociate the sound from the pop-up box, so that it didn't repeat the sound when you choose to examine the city before choosing to keep it. Apparently the new place for the sound affects all players, not just the target player.)
 
Hello Karadoc. I found a bug in the K-mod inherited of BUG mod. In the tab "clock" inside bug options yellow and white colors do not work to techtree (yellow turns green, and white turns gray). I know it's no big deal, but if you can fix...

Congratulations for one more great version!
 
Personally I havent played aggressive ai, ever since Karadoc stated he doesnt ever play that way.

I only picked it before because it was the only way to beef up the normal ai (for more of a challenge) and my brain never thought to consider the difference in the old game vs the k mod.

My main problem with aggressive ai, is that it would send 95% of its military in distant wars and be very easy to back stab, since it had no defense. Even without aggressive ai, there are times where one nation will declare war on another, and both nations will lose a city because their main stacks just passed each other.

So I dont pick aggressive ai anymore because Karadoc told me the ai is less likely to leave itself as open and will use city defense upgrades more (and wont be as easy to back stab). Although in a 1v1 situation, (with no potential back stabbers) the "dagger" strategy I think Karadoc called it- where the ai sends everything on offense, would be actually a highly intelligent decision, especially if it could recognize and attack stacks before they crossed over into their lands.

On another note, I do like the idea of ais agreeing to attack someone in the "peace island" scenario (love that name btw) but I would see that as a global enhancement of the ai, not just for "peace island"- you know, ais could always conspire to invade regardless of religion-and ofc my preference is that 2 weaker nations would conspire against the most powerful, overall, nation.

Going further, my preference would be that 2 ais conspire against a 3rd nation but then could possiblely turn on each other if it might be worth it (only one nation can win amirite?). I think these actions could work, especially if the ai periodically recognizes who is relatively the closest to winning (points leader, tech leader, within 50 turns of a culture victory etc etc) and what area of the game they themselves plan on winning in (conquest, diplo, culture, space race).

My view is that tech ai, war ai, culture ai etc etc are not "role playing" and more just different ways of winning, which I think is cool, and I wouldnt mind them pursuing more aggressively, as long as it doesnt make them an easy target. Some of the stuff the ai does which isnt geared around getting advantages and winning seems less optimal to me. But stuff is debateable, like distant wars: often times they lead to very little land gained but both sides gain alot of great generals...so although not a directly game winning tactic...it is a tactic that may gain both sides advantages. Anyone who has faced Zulu units spammed out with 3 or 4 upgrades per unit can say it worked to some degree.

That being said, NEW PATCH! woooooo! :D
 
What about the ruthless ai that afforess incorporated into his mod wouldnt that be the kinda thing we're looking for (ai's working together by well bribing others to joint in their wars?)
 
Hi Karadoc

Just noticed that opening WB in game leaves some AI unit flags visible. Building city or ending turn makes most flags disappear but not all. I tried couple times and could reproduce this, tried also normal BTS and it seems that this happen only with k-mod.

Using v. 1.34. Thank you for great work with AI:)
 
i get same graphical bug as rtt4a:)

general comments:

i hate when the ai goes nutso on a long-distance war, mainly cause i can take advantage (back-stab) if im nearby. biggest ai flaw left i think. any chance of getting the ai to understand relative distances better/ dislike near-neighbours more? (non-trivial i realize) i play on large maps and find it problematic for the ai.

the new unit changes from 1.33 are pretty good (didnt play much lately) SotL are monsters in naval combat, i like i think. along with the buff to grenadiers makes Mil Sci much more worthy of consideration.

ai city placement is bloody good these days. rather human-like.

@karadoc specifically
thanks for the explanation above on the anti-double-move rule.

any chance you'd consider adding a choice screen when humans cede colonies? i know you can manually edit the DerivativeCiv in the civinfos but thats rather restrictive. i always thought it would be cooler to actually pick the civ/leader yourself when granting independence in-game.

also, any chance you could make voluntary vassals more likely to strike off on their own? I think ais are too prone to inertia once they vassal voluntarily for protection.
 
how often does this "peace island" situation happen for you people? I would say more than 90% of my Kmod games are full of war - and not necessarily wars that I've started. The AI seems to go on a rampage most of the time in Kmod. Heck, I've had many Kmod games where I was at war for nearly every turn of the game, not by my choosing either. So if 5-10% of games the world is peaceful for most of the game, I wouldn't consider that a problem. Every game is supposed to be different. So perhaps 1 in 10 or 1 in 15 games you get a mostly peaceful situation. It's certainly not common.
 
Top Bottom