K-Mod: Far Beyond the Sword

yeah, good question :thumbsup:
Also culture issue hot fix will be interessing for the next K-Mod version LINK
I have apply this to my K-Mod Mod and it is working fine.
 
I'm not an expert by any means, but does this new approach not severely limit the long term planning capabilities of the AI in terms of tech research? Even if only for player perception, it is kind of nice to observe the AI "target" a particular tech and then beeline it, especially paired with flavours and LH personalities that contributed to the character of the AI and could lead to interesting tech races. Your new approach seems to kind of limit this phenomenon.

Maybe a compromise to try might be to have the AI still look ahead "three techs deep" but take only the cost but not the effects of all prereqs into account (I assume also including their benefits is a bad performance decision, although on the other hand maybe caching could come in here)?
 
@Akbarthegreat : Check out the Advanced Civ modmod, I posted the link in my previous post in this thread. The AI seems to be more "utilitarian" and less cut-throat (However, Monty will always be monty :cry:)

Thanks, "a balance between K-Mod aggressiveness and BtS passiveness." is exactly what I was looking for :D

Monty will, of course :lol: but I got pissed in my last game when Frederick (relatively passive) attacked me for pretty much no reason when he had plenty of area he could have just settled.
 
Sounds like you want the AI to be less smart. Grabbing some nice, but poorly defended cities from a weak civ is usually a much better play than settling new land from scratch. K-Mod allows for rather peaceful play. You just have to build a strong military even when you don't want to use it offensively. A Warrior per city in the Rifling age is something you can pull off in base BtS, but K-Mod's AI punishes weakness. Not knowing that, the AI may appear more aggressive to you than it actually is.
 
If I may suggest, if the idea is for the AI to consider techs up to 3 levels deep (which is generally a good idea; the more into the future the AI looks, the more intelligently it can play), then why not have the AI ALWAYS pick the next 3 techs it intends to research? You can have multiple heuristics running in parallel to see which brings the best results and even add more later; for instance:

1 - Assign a "desirability" value to all techs up to 3 levels deep, taking into consideration the AI's current circumstances and biases.

Begin Heuristic A:

A1 - From immediately researchable techs, pick the one with the best value
A2 - Pick the best tech available after the tech from A1 has been researched
A3 - Pick the best tech available after both techs from A1 and A2 have been researched
A4 - Add their values together and store

Begin heuristic B:

B1 - Pick the best tech available up to 3 levels deep
B2 - Pick the prereq techs for the tech in B1. If there are multiple paths available, pick the one with the best value
B3 - If you still haven't picked 3 techs, pick the one with the best value available after the techs in B1 and B2 have been researched.
B4 - Add their values and store

Add other optional heuristics here

Compare the results returned by all heuristics and pick the best one.

Ideally, even though the AI is picking the next 3 techs, it should rerun this every time it acquires a new tech, be it through research or any other means.
 
Compare the results returned by all heuristics and pick the best one. Ideally, even though the AI is picking the next 3 techs, it should rerun this every time it acquires a new tech, be it through research or any other means.

I think the 2 methods you described here are similar to the ways a human would approach this: impulsive leaders (e.g. a Zulu leader) would take option A, going for tech1 -> tech2 -> tech3, similar to a short term approach, while long term thinking leaders (e.g. a Chinese leader) would take option B, going "backwards" from the tech they want to get to down to the closest available tech: tech3 -> tech2 -> tech1. In programming terms, it's about assigning values to techs, but if the idea is to make the AI more "human-like", it should be noted that we people almost always approach this in terms of tangible goals / results instead of assigning or comparing values (i.e. I want tanks - aka a tangible result - what techs do I need to research to have that?).

In other words, a human-like approach is a pragmatic one (and a more intuitive one), based on the effects (buildings, units) a tech gives access to, rather than purely assigning mathematical values to techs. The question of computing / comparing those values only comes after the desired effect has been determined, usually in order to choose the shortest / most desirable path to that effect / result. At least that's how I see it.

P.S. The number of techs at which the heuristics should be re-run shouldn't be a fixed number, but a variable one, according to the circumstances (e.g. dangers, opportunities, etc).

By the way, Happy New Year for K-Mod and Civ IV fans, same for the developers of this mod! ;)
 
Last edited:
Just a quick message:
I haven't made any significant changes for a few months; but I have been sitting on some stuff which is not yet uploaded. One of the things I've done is to change the way the AI chooses tech...
In the previous system, the AI would usually consider techs up to 3 levels deep; and just pick whatever it thought was the best value per research cost. It did not take into account the research cost, or the benefits, of any prereqs. It just sometimes chose techs that had prereqs, and beelined towards it.

I thought this was a bit silly; and sometimes led to poor decisions such as obsoleting important wonders with scientific method... So I rewrote it to instead only choose techs that it can immediately research, but with added value based on what the tech leads to.

That all sounds pretty good, and I'm sure it's a 'smarter' system overall, but so far with my limited testing I've not been impressed with the outcomes. The other system might have been illogical, but I'm not certain that the new logic of the new system is actually helping. I believe the path forward is to refine the new system; but at the moment I'm not sure if it is actually better...


If you feel like it, you can try for yourself. It's attached.

Let me know what you think. A few other things have been tweaked too; but the tech AI has had the most work (and possibly the least benefit)!

I feel like if you had the AI pick a tech 5 levels deep, it would be about what the human could do. I wonder though if you could have (if.getplayer owns GreatLibrary, remove 120 AI weight points from Scientific Method tech) .... and ideally the AI would somehow then be less likely to either A) pick the tech which has Sci Meth as a prereq, or B) it would encourage the AI to delay the beeline until some filler techs are gotten, or C) you could add in some small hardcodes based upon wonders ... ie, AI may not beeline Physics, Radio, Electricity if it owns Great Library, AI may not beeline Astronomy if owns Collossus (unless that is still obsoleted at Flight), AI may not beeline Corporation if owning the Great Lighthouse, etc.

In that way, you at least reduce the chances that they will auto-wonder obsolete, because you first pass the wonder test to then block them from picking the obsoleting tech as a beeline "GOAL" (or even its next of kin), but then later on down the road, let's say it picks something that is 5th removed from the offending tech rather than 1 or 2 removed ... it may eventually get the obsoleting tech, but it won't originally head down that path.

Looking 5 techs deep might be too much idk ... but I think it would make the AI a lot "smarter" even with the wonder system ... especially since, if u think about it, Wonders minimally impact an AI's game, even if a player may think their strat revolves around it ;) (AI are far less likely to be able to exploit wonders, especially with any strategic goal in mind)
 
Just a clarification, the idea is not for an AI to use one or the other heuristic; it's for it to use them all every time, compare the results and implement the course of action with the highest value. Each heuristic is supposed to return a course of action that is "good enough", but not necessarily optimal. By using multiple heuristics, and picking the best result returned, you increase the quality of this decision making even further.

By having a fixed number of techs every heuristic must pick, their results become easily comparable with each other. The AI is asking itself if it's gonna get more bang for the buck by going for the deep tech, or just picking the best shallow techs available.
 
I need a little help. I notice that Bull is bundled together with K-Mod, however the SHAM (Show Hidden Attitude Mod) component seems to be disabled. I'd like to enable it. Any idea how I'd go about doing that?
 
It's not only disabled; it's not included. The easiest way of doing it would be to download the SHAM mod component, merge it into the K-Mod source and recompile the DLL.
 
@Tasunke, regarding the stuff like devaluing Scientific Method if the player has the Great Library and stuff like that; that kind of evaluation is already there. In fact, it's a bit smarter than that because it doesn't just check for those particular wonders, but instead it tries to evaluate everything that the tech grants or obsoletes. That means that if you made a mod which obsoletes different great wonders, the AI should handle that gracefully in its tech evaluations already.

In any case, the quality of the evaluations for individual techs is far more important that the depth of the search. So although I'm still tinkering with the way the AI looks ahead, I think the biggest improvements would be in how certain things are evaluated...

For example, currently techs which enable buildings are evaluated based on how much the benefits the buildings would give the player's cities... but it doesn't take into account having a "building backlog". I know as a player I'm far more likely to benefit from unlocking a building if I don't already have other stuff to build. But the AI doesn't take that into account. Similarly with units, evaluates units based on what they can do... but doesn't take into account how many of them they are likely to build before they are obsolete. If that kind of stuff could be evaluated properly, it would probably help the AI. (But I'm unlikely to get around to that at this stage. My work on K-Mod has slowed to near zero.)
 
@karadoc: You've probably noticed by now, but it can't hurt to report it anyway:
I think it should be 'j' instead of 'i' here. With 'j', at least the canResearch(eBestTech,...) assertion no longer fails. Also, I got "Failed to create any tech paths" when Stealth, Genetics and Future Tech were the only undiscovered techs, and changing this inequation to '<=' seems to have helped. With these two issues fixed (and the endless loop too), the latest changes have been working fine for me. Since I've never paid much attention to AI tech choices, I couldn't say if there's a great improvement. Conceptually, the final approach that evaluates sets of three techs seems very sensible to me (optimal really).
 
Could someone please be kind enough to add the option to play 34 civilizations to the latest version of K-mod?

K-mod is awesome makes the AI civilization game way better, but I enjoy to play mostly big earth maps and they are nicer with more than 18 civilizations.

Thank you very much.
 
Back
Top Bottom