K-Mod: Far Beyond the Sword

It seems that the K-mod is becoming the "spiritual heir" of BUG / Better AI / PIG Mod. What is your view on this, Karodoc?

What I'd like is for K-Mod to become the 'spiritual heir' to Beyond the Sword itself.

I'm essentially trying to make K-Mod better than the unmodded game in every way I can; faster game performance, smarter AI, more stable in multiplayer, more balanced, more intuitive and consistent UI, and so on. I want there to be no reason to stick with BtS other than inertia.

With that goal in mind, I still think there is room for PIG, BUG, and even Better AI if someone wants to write an alternative kind of AI.

There are a bunch of features in PIG which I have no intention of adding to K-Mod, for example, 'influence driven war' (IDW). I won't add IDW, because I don't think it's a good system, and I don't think it complements the rest of the game, and I don't want to add clutter -- but I'm sure a lot of people actually like that option, and so I think it's a good example of the kind of thing a gameplay enhancement mod like PIG to have to build on K-Mod. There are a bunch of other things like that as well, for example "super spies", and perhaps even "culturally linked starts". (I say 'perhaps' for that because there is some chance I might get around to implementing that... but it isn't currently on the addenda.)

So ultimately I think something like PIG could work well alongside K-Mod.

As for BUG, it's a bit tricky... BUG (with BULL) already includes a few features not included in K-Mod, and the K-Mod "BUG" options already include some UI features that are not included in BUG proper. (eg. rapid unit cycling and simple [shift] selection.) -- and if I keep working on K-Mod UI feature and the BUG people keep working on BUG stuff, I guess it's likely that the features will diverge even further. But last time I looked there didn't appear to be much action on the BUG front anyway.


[edit]

By the way, version 1.35 was uploaded a couple of minutes ago. (and I've already made a bunch of changes for the next version which I didn't include in v1.35 because I don't want to have to delay the update to test them all.)

v1.35 has a few updates to the way vassal agreements are made and canceled, so hopefully that's a small step in the right direction towards fixing some of the issues people were talking about earlier. As it turns out, it was mostly my fault that vassal deals were being canceled much in previous versions. In the original code there was an inconsistency in the way deal canceling was handled between AI-AI deals and AI-human deals. I removed that inconsistency many version ago; but I didn't know at the time that in the original code the AI basically never canceled vassal deals to humans. It only canceled them with AI masters. And so by fixing the trade inconsistency I apparently removed the AI's main avenue for canceling vassal deals... Anyway, that problem is corrected now and I've made a bunch of minor tweaks to the AI's calculations which determine whether or not a vassal deal should be made in the first place.
 
you rock! i think. i loaded up a game on 1.35 at a point just prior to where some civs usually vassalled annoyingly easily under 1.34 and noone vassalled this time. so on the basis of that rather large sample size im gonna build a shrine in your honour in my house:)
 
Thanks for new version, weekend plans are made now:)

Satrapper, perhps you could update your 34civ dll for the weekend..?:D
 
There are a bunch of features in PIG which I have no intention of adding to K-Mod, for example, 'influence driven war' (IDW). I won't add IDW, because I don't think it's a good system, and I don't think it complements the rest of the game, and I don't want to add clutter -- but I'm sure a lot of people actually like that option, and so I think it's a good example of the kind of thing a gameplay enhancement mod like PIG to have to build on K-Mod. There are a bunch of other things like that as well, for example "super spies", and perhaps even "culturally linked starts". (I say 'perhaps' for that because there is some chance I might get around to implementing that... but it isn't currently on the addenda.)

So ultimately I think something like PIG could work well alongside K-Mod.

As for BUG, it's a bit tricky... BUG (with BULL) already includes a few features not included in K-Mod, and the K-Mod "BUG" options already include some UI features that are not included in BUG proper. (eg. rapid unit cycling and simple [shift] selection.) -- and if I keep working on K-Mod UI feature and the BUG people keep working on BUG stuff, I guess it's likely that the features will diverge even further. But last time I looked there didn't appear to be much action on the BUG front anyway.
I really only see the BUG active to answer questions without a new version, and I think you managed very well to capture the essential parts of the BUG/I don't miss the other options - Believe me: I've done a very detailed analysis of. But in BULL I missing Show Hidden Atitude Mod. Do you intend to add your system of the Show Hidden Attitude mod?

About the PIG, Can you tell me if some fixes are incorporated into the K-mod?

1) LakeSizeMod (CvArea.cpp)
Makes the definition of a lake scale with map size. With an XML Globals value of 4 which is what I use, lakes will become inland seas when greater than 4 tiles in size on Duel, up through greater than 16 tiles in size on Huge.

2)12monkeys TeleportingIntoLakeFix (CvUnit.cpp, CvCity.cpp, CvCity.h, CvPlot.cpp, CvPlot.h - Not sure if it has been implemented) If a naval unit is forced to teleport to the nearest valid tile, it doesn't wind up in a lake where it will usually be stuck.

3) EventTileDowngradeMod (CvPlot.cpp, CvPlayer.cpp, CvCity.cpp)
Tile improvements that are hit by destruction events (like a Tornado) now behave as if they were pillaged instead; most are still destroyed, but Towns downgrade to Villages instead of being wiped out entirely, for example.

By the way, version 1.35 was uploaded a couple of minutes ago. (and I've already made a bunch of changes for the next version which I didn't include in v1.35 because I don't want to have to delay the update to test them all.)
What are the changes?
Slightly tightened the conditions on when an AI team will offer itself as a vassal.
Adjusted many of the conditions on when the AI will choose to accept a vassal.
Can you detail what are these conditions?
 
Has K-Mod or Better AI improved the AI's placement of forts? i.e. to place them at strategic choke or canal points? I'm asking to save the time of looking at the code myself.

If it has then I would like to merge those changes into my mod. If not then does anyone know of a mod that has?
 
Little bugs in K-Mod:

*The tech tree color yellow and white don't work
*The Era Window is misaligned to left
*If you enter in Civilopedia BEFORE start the game, in game it will don't work showing not SEVOPEDIA but standart civilopedia
*Regenerate map Freeze/Crash game
 
Has K-Mod or Better AI improved the AI's placement of forts? i.e. to place them at strategic choke or canal points? I'm asking to save the time of looking at the code myself.

If it has then I would like to merge those changes into my mod. If not then does anyone know of a mod that has?
No. :( The AI has not been taught to properly understand choke points in this mod, or any other mod that I know of. So it doesn't know to use forts like that.

Little bugs in K-Mod:

*The tech tree color yellow and white don't work
*The Era Window is misaligned to left
*If you enter in Civilopedia BEFORE start the game, in game it will don't work showing not SEVOPEDIA but standart civilopedia
*Regenerate map Freeze/Crash game
  1. I don't know what you mean. What color settings are you talking about?
  2. That's true. Apparently 'centerX' doesn't do what I assumed it would do. Does anyone happen to know what centerX actually does do? For now, I'll fix it using getXResolutoin + some calculations, but that's not how it is done in other screens. Ultimately I'd like to know the 'proper' way to do. (It may well be that using getXResolution is the only way to get it right. I suspect 'centerX' actually assumes that the window will have a width of 1024... which would be a pretty stupid thing to assume...)
  3. ...
  4. I just tested this a bunch of times, and worked correctly. It takes several seconds, and the game is unresponsive while it is running, but in my tests it always worked and never crashed. What exactly did you do to make it crash? And when you say 'freeze/crash', what exactly do you mean? Does Windows give a popup box saying that BtS has crashed? Does it vary? --- Is anyone else able to reproduce this crash?
 
Just throwing it out there..and maybe it already exists and I don't know about it.. but maybe we should somehow get some sort forum together to play k-mod multi player vs other ppl that use this thread. I know I'd LOVE to play multi-player...I just don't have anyone that would play vs me... Anyone down? :scan: I'd definitely be thrilled to set up some games vs other people here. The AI is strong enough with KMod to have a full map of teams and have no concerns over simply over-running the AI like in unmodded BtS


Also:
I just tested this a bunch of times, and worked correctly. It takes several seconds, and the game is unresponsive while it is running, but in my tests it always worked and never crashed. What exactly did you do to make it crash? And when you say 'freeze/crash', what exactly do you mean? Does Windows give a popup box saying that BtS has crashed? Does it vary? --- Is anyone else able to reproduce this crash

I use this feature alllllll the time and it works perfectly 100% of the time for me (consider I have not yet used 1.35)

Taught the AI to free itself when it no longer wants to be a vassal.
-If this works...I will be extraordinarily happy. I've grown tired of watching AIs voluntarily vassal early...and be PLENTY strong enough to compete on their own...only to remain vassaled to a team that almost grows weaker than the vassal as the game progresses.
 
I don't know what you mean. What color settings are you talking about?
I'm talking about inside de techtree, the layer below the box of technology...

I just tested this a bunch of times, and worked correctly. It takes several seconds, and the game is unresponsive while it is running, but in my tests it always worked and never crashed. What exactly did you do to make it crash? And when you say 'freeze/crash', what exactly do you mean? Does Windows give a popup box saying that BtS has crashed? Does it vary? --- Is anyone else able to reproduce this crash?
Sorry, a wrong report, is that delayed then I assumed that was frozen forever.

As for the hidden attitude I wonder the category is: never be added or maybe one day
 
The tech tree color yellow and white don't work.
...
I'm talking about inside de techtree, the layer below the box of technology...
What do you mean by "doesn't work"? The colours are on the list, and they can be selected, it doesn't cause the game to crash or anything like. And when they are selected, they look more or less as I'd expect them to.
I'd appreciate it if you were very specific when reporting bugs, so that I don't have to spend ages trying to work out what you think is actually wrong.

rjmDI.jpg

(a quick screenshot taken with the default colours. As you can see, 'red' is a dark red and 'yellow' is dark as well... as you might expect, 'white' (which is not shown here) actually looks a bit grey. 'white' is the default colour for the future techs.)

There are a few points to note. Firstly, all of the era shadow colours are quite dark, because they are in shadow... but yellow does look yellow, and white looks – well, light-grey. Secondly, the era colours in the tech tree only update if exit the game. Finally, I think it's pretty weird that the 'clock' colour settings are used in the tech screen anyway. That's just an oddity of BUG design which I haven't bothered to change.

As for the hidden attitude I wonder the category is: never be added or maybe one day
Probably will not be added.
 
Btw. @satrapper I finally got around to testing that python thing on a second computer -- and it behaves the same as my main computer. ie. Python is uninitialized and then reinitialized when I start the second (multiplayer) game.

So, since no one else has reported any tests (or if they have, I missed them) it looks like your computer is the odd one out, and the cause of the discrepancy is still a mystery. Maybe it's related to some obscure ini settings or something.
 
Change log

[*]Slightly tightened the conditions on when an AI team will offer itself as a vassal.

Good change!

I got to the point where I turned off vassals after I had about 5 Civs offer themselves as vassals to me in one turn. Not to mention the one game where I was at war with a single small civ who became a vassal a larger civ... on the same turn it obtained 4 other civs as vassals! In the end I was at war with a major alliance in a single turn because the vassal spammage, many of them smaller civs who ended up getting slaughtered in the war.

So when I get home tonight I'll surely give it a go with vassals back on to see if it's improved.
 
In my last game I found myself in a war at tech parity vs. an Emperor AI, around the time of War Elephants. Overall I was very impressed at how the AI handled things. It did a couple of sneak attacks on my cities to capture them. It used forts in its own territory to attack from to whittle down my attacking stacks. (I couldn't kill red-lined attackers in the forts because of other defenders there who didn't attack.)

The best tactic was when it used a spy to revolt a city (on the front line with walls) just before capturing it with a stack. The AI had no siege in its attacking stack, and wouldn't have captured the city without the revolt.

For my current game I updated to 1.35 early on, and I've noticed some interesting plot selection choices from my governors. In Gondar, while I build a worker the governor likes the 1/2/0 grassland hill forest, while the 3/0/1 grassland river farm is better.

In Aksum, also building a worker, the governor prefers a (0/2/0) engineer over a 1/2/1 tile. I like the AI's choice here, although it is debatable. The worker completes in the same number of turns with the engineer, and the GPP stacks with the two wonders' GPP. A Great Engineer would probably be more useful than Great Prophet at this stage. Does the governor take the other GPP into account in its decision to run the specialist?

BTW, I tried to revert to 1.34 to see what the governors would do there, but the game attached would not load in that version.

Thanks again for your work this mod! Your AI improvements in particular are a major reason this game still holds its appeal for me, after all this time.
 

Attachments

hey karadoc,

i was just looking at pickle in a mod merge and noticed that in k-mod, while BugData.py uses cpickle, CvCustomizableDomesticAdvisor.py doesn't. any use to you or pointless info?:)
 
@karadoc:
The vanilla python callbacks have not been changed to follow the same structure than those added by you. Is there any reason for that?

Not all those functions are used by the exe (in COL for ex, all callbacks below Finish_Text were being called by the exe at some point but not the others), so you could safely change them to be inline, etc.
 
Kudos on the design philosophy Karadoc, id hope to see a generation of civ 4 mods utilising your own 'mod' as a foundation basis. Already we're seeing a lot of the very best mods incorporation your own into their systems so... rock on man!
 
For my current game I updated to 1.35 early on, and I've noticed some interesting plot selection choices from my governors. In Gondar, while I build a worker the governor likes the 1/2/0 grassland hill forest, while the 3/0/1 grassland river farm is better.
I agree that the grassland river farm is unambiguously a better plot to work in this case; and so the governor is wrong. But unfortunately, this particular case is difficult to fix (in fact, I don't intend to try to fix it). The problem is that the hills plot actually provides more hammers... it provides 3.5:hammers: (with food converted into hammers) whereas the farm provides only 3:hammers:; so in that sense, the hill plot is actually better - but that 0.5:hammers: doesn't actually end up helping in the end because it get rounded away to nothing. The reason it's so difficult to fix is that when the governor is choosing between those two plots, it doesn't really know if there will be some other plot changes as well - and so it doesn't know if that 0.5:hammers: is going to get rounded away or not. :sad:

There are a lot of little shortcuts that the governor uses to assign jobs as quickly as possible (ie. minimize CPU time), and so it's not really uncommon to see some poor choices from time to time. Sometimes if you remove all the jobs and then reautomate the city the governor will choose better jobs -- and I guess that's a sign that some of the shortcuts are failing...

In Aksum, also building a worker, the governor prefers a (0/2/0) engineer over a 1/2/1 tile. I like the AI's choice here, although it is debatable. The worker completes in the same number of turns with the engineer, and the GPP stacks with the two wonders' GPP. A Great Engineer would probably be more useful than Great Prophet at this stage. Does the governor take the other GPP into account in its decision to run the specialist?

BTW, I tried to revert to 1.34 to see what the governors would do there, but the game attached would not load in that version.
When evaluating GPP points from specialists, it does indeed take into account the cities total GPP rate relative to your other cities; and so it will be less likely to pick specialists if there's essentially no chance of that city ever getting a great person. But when I load your save in my current version of K-Mod, it actually chooses the 1/2/1 plot anyway. (The engineer is being used when I load the save, but if I reautomate the citizens, or change production to something else and then back to the worker, the engineer is removed.) So.. maybe it's just some temporary quirk that caused the engineer to stack there, or maybe I've changed something between 1.35 and my current version which makes it prefer the plot again.

In general, the saves are not backwards compatible; because from time to time I add new data to them and so on. New versions of K-Mod can load saves from old versions, but not the other way around.

hey karadoc,

i was just looking at pickle in a mod merge and noticed that in k-mod, while BugData.py uses cpickle, CvCustomizableDomesticAdvisor.py doesn't. any use to you or pointless info?:)
The pickle stuff basically determines how the data is saved, right? So I suppose the effect of that inconsistency would be that the customizable domestic advisor saves stuff slightly differently to the other bug data. I don't expect it would matter much - as long as it uses the same routines to load as it does to save.

@karadoc:
The vanilla python callbacks have not been changed to follow the same structure than those added by you. Is there any reason for that?

Not all those functions are used by the exe (in COL for ex, all callbacks below Finish_Text were being called by the exe at some point but not the others), so you could safely change them to be inline, etc.
I suppose you're talking about the functions to block the python callbacks rather than the callbacks themselves, right? (eg. getUSE_DO_COMBAT_CALLBACK is used to decide whether or not the combat callback should be used.)
I think you're right that most of the old functions could be inlined; and it might make them slightly faster, and maybe a bit easier to read as well. -- I don't really have any good reasons for not doing it. It takes a little bit of time to do, and then I'd probably have to write some comments explaining what I've changed and so on... and I don't think it really makes much difference anyway. Making the function inline might save a couple of CPU cycles each time; but that's typically less than 1 nano-second; and so unless the game is calling those functions many thousands of times per second then it doesn't really make any difference. Maybe the compiler is smart enough to do that optimization itself anyway! (but I wouldn't count on it. it's a pretty old compiler.)


--


Yesterday I found a rare crash bug in K-Mod. It happens if the AI decides to start planning an overseas war before either team is able to build any boats. So it's only at the start of the game; and it's very rare, because there are a bunch of good reasons why the AI already knows not to plan such wars... but it can still happen in some very unusual cases. I'm not going to rush out the next version to fix it, but I'm just going to mention it in case someone notices a crash near the start of the game.
 
K - We're using kmod in a new SG. I noticed what appears to be a quirk with a riverside desert tile that you can see here:

Spoiler :
3VnQJ.jpg


Look for the sign "odd tile" in the upper left

If I'm not mistaken this is a glitch in pre 3.19 BTS map generation. Not sure the mechanics behind it, but we it often use it as an identifier of someone not being on the current patch. Not sure why it appears in Kmod, but might be something to look into. I believe this tile should generate as a flood plain, instead of just an unworkable desert tile with 1C.

Also, if you notice the BUG scoreboard, the AI city counter does not appear to work, although it does for the human player. This was a nice feature.

edit: Someone informed me later that the reason I'm seeing the "odd tile" is that a city is settled right on it. However, the city counter still remains an issue
 
Back
Top Bottom