K-Mod: Far Beyond the Sword

I've just uploaded a new version. The changes are pretty minor this time. The main thing is that I've implemented the unit multi-production thing. If it turns out to be annoying, or just not-good-enough, I might change it to be the same as the Multiple Production mod. The main reasons I've done it this way first are that it's simpler (in terms of game mechanics, and programming), and it doesn't require the player to queue things to get the benefits. .. I think of it as being a bit like a factory in real life.. the factory might be able to make many different things, but it is easier to just keep making the same thing. It takes time and effort to switch to a different product. So... in this mod, the excess overflow just goes onto the same unit. -- or maybe I'm just making up lame excuses...

Anyway, I guess putting iron-works and heroic epic in the same city isn't a horrible mistake anymore. (but I still wouldn't do it).

Good to see the Mod at version 1.00b

JosEPh :)
Sorry it was short lived. ;)


[edit]
I was just playing the latest version... and disappointingly, I suspect the AI is teching slower than in some previous version. I think I might have told them to build too many units or something. Let me know if you think the AI's tech is particular strong or weak. Maybe the AI just got unlucky in this particular game I'm playing (poor trades or something).
 
I pointed Koshling from the C2C team to take a look at some of your AI fixes. You have good stuff here. :)

Also just d/l'd new version.

JosEPh

Edit: Does your Mod have a Splash page at the start up? I've forgotten if you had one or not, as when I started your mod I only got the BtS Classical start page.
What would give me a hint I'm playing it if you don't have a Splash page?
 
Koshling did contact me, and we've talked a bit via private messages.

This mod does not have a splash page, but it will say "K-Mod" in the top right corner of the main menu (that's just a standard Civ feature - it says the name of the currently loaded mod). Otherwise, another way to check would be to look in-game for something obvious that you know K-Mod has changed. For example, the little suitcase button at the top left which brings up the BUG options; or look at the financial adviser screen to see if it has a environmental adviser tab; or check the civilopedia to see if Creative Construction is enabled by Steel (K-Mod) or Combustion (standard BtS). -- But there is no splash screen. I just the vanilla menu screen, the one with the globe and "baba yetu".

(that reminds me... I should probably add a loading-hint-message about the environmental adviser.)
 
Interesting. I'll give your MOD a try. Global warming is a fact... the North Pole is melting...

I won't turn off (Global Warming) like I do usually.

Let's see how it goes...

:scan:
 
Cool, Kara! I'll get the latest version and see if I can play a test game or three sometime in the next few days. If my S.O. and I play, we should be able to get a feel for how well the AI's teching also -- their tech rate seemed pretty strong in the earlier versions so it should be easy enough to tell if it's faltered.
 
Bug of the week:

Code:
// original BtS code inside AI_workerMove()
if (pCity != NULL)
{
  if ((pCity->AI_getWorkersNeeded() > 0) && (plot()->isCity() || (pCity->AI_getWorkersNeeded() < ((1 + pCity->AI_getWorkersHave() * 2) / 3))))
  {
    if (AI_improveCity(pCity))
    {
      return;
    }
  }
}
So... is it just me, or did they get that backwards? It seems to say "if we need less workers than we have, then you should work here too."
 
I'm not good enough with the coding aspect of it to know for sure whether the code is causing it to behave in the way you described, but if that's truly the way the AI is programmed to behave, then that's ... really really silly. xD

p.s.: The game I have been playing is showing no signs of the AI being bad at teching. In my current solo game I'm only playing on Prince and Isabella ended up going all runaway-techer on me for a while. Though that was mostly because she was getting good tech trade options with her buddy-buddy nextdoor neighbors while I was busy fighting off (and eventually killing) a neighbor who declared early war on me. The worst part is that once she got a tech lead, she promptly turned off her research slider and started gunning for a Cultural victory. So I'm going to have to raze something of hers here in a couple of turns. :3

Anyway, I'll continue to keep an eye out.
 
@karadoc,

Maybe you could share that with Koshling? :D

JosEPh
 
Koshling has given me write access to the C2C svn. So I half intend to just check the code to see if its the same, and then just change it if it is. But... yesterday, I started downloading the entire svn repository (so that I could make a git version of it, because I prefer git)... and it still hasn't finished downloading. It's truly huge... and it makes me think that maybe there's something wrong with it - ie. something wrong with the repository. There seem to be a few commits in there which apparently delete most of the files and then re-add them. :( Anyway, the bottom line is that I haven't looked at the code to see if it's the same.


In other news, I think I'm just about ready to upload a new version of K-Mod. This next version will be mostly about technical improvements. It will fix a couple of important bugs - in particular, it will fix a BtS pathfinding bug which Koshling pointed out to me; and there will be some significant speed improvements. I'll even go out on a limb and say there will be fewer OOS errors. Aside from the technical stuff, there's the usual grab-bag of AI changes, and a just a couple of minor balance adjustments.

I'm just trying to iron out a couple of AI problems before I upload it. I've taught the AI to understand that some techs will make some buildings obsolete - but there have been some unexpected side effects that I've had to tidy up. My goal was to make the AI tell likely to go for Scientific Method if it had lots of monasteries or whatever; but in doing so, I inadvertently made them hate Rifling, because they love Walls... then after fixing the Walls problem, I still found that the poor old Celts still hated Rifling because they loved their Duns... then when I fixed the Duns, I broke the Viking's Trading Post. Anyway. I'm just sorting some stuff out.
 
In SVN, moving files is a delete-and-add operation. And tagging/branching are tree copies. You'll want to grab just /trunk assuming he set it up like a standard SVN repo which is just a convention. There are tools that will do the conversion (two way as well) that you could probably point directly at the repository. I have used both separately but never together, but I am involved with projects where someone set up a two-way sync of a subtree of the SVN repo in git.
 
There's a bit of a setback for the new version. I've discovered that one of the main changes I've made to improve the speed actually causes the automatic citizen assignment thing to sometimes stick with obviously inferior plots rather than good plots. :(
For those who are interested...
Spoiler :
In original BtS, all citizen jobs are cleared whenever the automatic citizen assignment thing is used. All jobs are cleared, and then reassigned one by one, and then after resigning they are "juggled" - which means that the game tries to find a better combination of jobs based on what it already has (ie. worked plots and specialists). My change was to simply not clear the jobs at the start of the function, and rely completely on the juggling at the end. Koshling did the something in C2C. But I've noticed that although it is much faster than before, it doesn't work as well; and I'm not satisfied. Maybe the C2C guys don't mind about the slightly poorer citizen assignment, or maybe just no one has noticed yet... but I'm a bit obsessive about not making things worse. Anyway, to solve the problem, I've decided not to re-enable the slow thing at the start, but rather to completely rewrite the citizen juggling and citizen evaluation code so that it works better. It won't necessarily find the optimal combination of citizens, because that's quite computationally expensive, but I at least want to make sure that it doesn't miss any really obvious improvements.

The rewrite is going well. It's still faster than the original code, and it works to my satisfaction in most cases. But I'm still testing and fine-tuning it. And so the next version that I said would be 'soon' is still 'soon' rather than 'now'.


p.s.: The game I have been playing is showing no signs of the AI being bad at teching. In my current solo game I'm only playing on Prince and Isabella ended up going all runaway-techer on me for a while. Though that was mostly because she was getting good tech trade options with her buddy-buddy nextdoor neighbors while I was busy fighting off (and eventually killing) a neighbor who declared early war on me. The worst part is that once she got a tech lead, she promptly turned off her research slider and started gunning for a Cultural victory. So I'm going to have to raze something of hers here in a couple of turns. :3

Anyway, I'll continue to keep an eye out.
That sounds good. Thanks for the info. :) I like it when they do that cultural thing - but they don't always get it right. I've messed with the rules for that strategy quite a lot to try to improve it. Originally, the only thing they used to decide when to crank it up to 100% was their current research - I've tried to teach them to actually consider how long it would take them to win... So I'm still curious about your game. Did you manage to stop Isabella from winning? And if so, did she get close?
In a recent game of mine, Wang Kon tried for a cultural win but he had no chance of getting it before other civs would get a space race. ... I guess he didn't really have much choice though, because he was too far behind to win the space race race himself.

In SVN, moving files is a delete-and-add operation. And tagging/branching are tree copies. You'll want to grab just /trunk assuming he set it up like a standard SVN repo which is just a convention. There are tools that will do the conversion (two way as well) that you could probably point directly at the repository. I have used both separately but never together, but I am involved with projects where someone set up a two-way sync of a subtree of the SVN repo in git.
At a glance, I think the trunk is the only branch there is. The move = delete-and-add thing explains what I saw about readding files though. I think the main issue is that it's just a huge mod. An ordinary svn checkout gives me 4.2GB of stuff. My partial download of the full repository is currently up to 10GB, and it's only about half way through the total number of revisions. (I was downloading with a command something like "git svn clone --no-metadata <address>") :( I might finish downloading it one day, but I'm starting to think maybe I should just use the svn version like everyone else...
 
I did stop her: by parking a massive navy outside of her territory, declaring war on her abruptly, and amphibiously invading and razing one of her nigh-legendary cities, over a two-turn period of time (would have been one turn, but I forgot that Artillery can't make amphibious attacks).

Basically, the AI still is not that great at responding to really sudden warfare (and I wouldn't expect it to be that great at it, though inevitably their "peacetime sense of defensive tactics," or the relative lack thereof, is something you're probably going to want to improve more as you go along with this -- I wonder if there's a way to get the AI to realize that the stack of doom sitting on their border during peacetime just might be intending to cross it and attack that border city? ;-) ). Though, I do notice in this mod that they will protect their workers with escort units during peacetime -- does the default BTS AI do that at all or was I just not observant enough back when I played the unmodded game? :o

As for the specifics of how the war with Isabella played out ... she had a relatively decent defense force and put up a reasonable fight, considering that she was still running Infantry + Cavalry while I was fielding Artillery + Marines + Infantry + Fighters (aboard Carriers). She had turned off her tech completely a little while ago. (And I had noticed this rather glaringly because I had a huge Espionage lead on everyone and could see their research: when an AI keeps showing 300+ turns to complete a tech they're either a late-game crippled vassal or a backdoor Cultural person trying to drum up a quiet victory. :3)

I ended up using my army to conquer my neighbor Wang Kon completely and reduce Isabella to one city, vassalize her, and then hunkering down to win a Space Race.

I'm a fan of speed enhancements, so I'm eager to see the next update. :) Finding a way to make the City Governor AI smarter (or at least no dumber) without making it slower would be awesome.

p.s.: I again had to Raze a legendary city, this time one of Gandhi's, in my most recent game. He was my nextdoor neighbor and I had to Great Artist culture bomb one of my cities four times to keep my borders intact against his culture-spamming waves. x.x He nearly won the Cultural victory before I mustered enough army to feel sure I could crush the city and then have plenty of troops leftover to guard against any counterattacks. But I got it taken care of. Once again, the thing that tipped me off was slow research times that I could see thanks to espionage. I really should check the Victory Conditions screen more often!

p.p.s.: Yes, Isabella was close to her cultural victory in the game I stopped her in (one Legendary City and two others at 45k+ by the time I razed one). Though, she would have needed to grind culture for probably 30-60 turns when she first started the process in order to win. I was fortunate enough to already have built up something of an army and navy (which I had intended to use on my nextdoor neighbor) and re-tooled it to invade Izzy instead. Gandhi was even closer in the latter game (had two legendary cities) but that was because I had to make an army from scratch for him.
 
I've uploaded version 1.02.

The new version is faster, smarter, and generally better. (although it's not as much faster as I expected. The difference probably isn't even noticeable.) I think the new citizen allocation method works pretty well. I think it's actually better than the old version, as well as being slightly faster.

Let me know if there are any problems.

Basically, the AI still is not that great at responding to really sudden warfare (and I wouldn't expect it to be that great at it, though inevitably their "peacetime sense of defensive tactics," or the relative lack thereof, is something you're probably going to want to improve more as you go along with this -- I wonder if there's a way to get the AI to realize that the stack of doom sitting on their border during peacetime just might be intending to cross it and attack that border city? ;-) ). Though, I do notice in this mod that they will protect their workers with escort units during peacetime -- does the default BTS AI do that at all or was I just not observant enough back when I played the unmodded game?
I agree that the AI responds poorly to sudden warfare. In fact, I think the AI's late-game warfare is pretty poor in general, because it all happens so fast. Too many long-range attacks with bombers and tanks etc - while the AI is slowly slowly marshaling forces in some border city, you can just come in tear their whole empire to shreds in a few turns. I don't have any big ideas for fixing that weakness yet. I've only made relatively minor changes to the combat part of the AI.

The guarding of workers is not something I implemented; but I'm not sure if its from BBAI or from original BtS. As I understand it, they only escort the workers if they have spare units, and if they are kind of scared of you.
 
Version 1.02c is now up.

v1.02b was a bugfix, and v1.02c is a speed boost. As I mentioned earlier, I was a bit disappointed that my changes to the citizen assignment code didn't make the game much faster; so I've just spent a little bit of time changing some other stuff for speed improvements.

So.. version v1.02c is now uploaded, and the only thing different about it is that it's faster.

But there is one more thing.. I forgot to mention an important change in the 1.02 change-list. (I've added it to the change-list now.)
  • Tech trades in which the receiving player is more than 2/3 of the way through researching the tech or when the tech is behind the 'game era' no longer count towards tech trade memory. ie. They don't contribute to causing "we fear you are becoming too advanced".
The main reason for this change is to prevent the player from exploiting the AI's trading behaviour... With the original BtS rules, you can completely prevent the AI from trading with one another by simply selling little pieces of technology to them. Every time an AI is 1 turn off finishing a tech, sell it to them (or just give it to them for free).. and that would quickly cause the AI to all refuse to trade with one another because of "we fear you are becoming too advanced"... when in actual fact, none of them are very advanced at all - and you will be the only one any of them will trade with. --- So... to prevent that exploit, I've made it so that trades don't count if the receiving player is almost finished researching the tech. As for the thing about the eras... I'm less confident about that being a good change. The point of it is to allow players who are way behind in tech to be able to catch up without the AI fearing that they are becoming too advanced. -- ..

Let me know what you think.
 
The changes you made here look good. Trimming the fat and making it faster will mean a lot to me in the late game, especially on any map size bigger than standard. :o I also approve of trying to fix the WFYABTA exploit. Bear in mind that this also makes it more lucrative for players to partial-trade for techs they've almost finished researching themselves (which could lead to some interesting research micromanaging strats where a player pre-researches most of multiple techs before trading for all of them at once and not getting any WFYABTA penalty for it. Though, to be honest, I mostly dislike WFYABTA as a concept in the first place, though I understand there are legitimate decent reasons for it being there.)

I've found a Governor bug from 1.02 that has persisted even after downloading the 1.02c update, so I'll post it here.

Look at Coventry in the attached save and watch what happens (or rather, doesn't happen) if you turn Citizen Automation back on (it had been off for a number of turns).

Clearly the governor should be preferring the Cottaged Flood Plain over an unimproved Flood Plain, but he doesn't seem to be checking for it.

If I click "Emphasize Food" I can get him to "check" and realize it's there. Notably, if I choose "Emphasize Production" or even "Emphasize Commerce" instead, the Governor still does not seem to see the cottaged tile.

If it helps any for investigating the bug, that cottaged flood plain tile that's not currently being worked was previously in London's city radius. I manually flipped it back over to Coventry's possession. I think I did that this same turn (if so, I did it right before I saved).

Is there any way this sort of thing can be prevented without causing the governor to slooooow dooooown to abysmal levels like it did before?

P.s.: I was also thinking, perhaps this bug could end up being more like a "feature," effectively letting players continue to have some degree of manual control over specific tiles (e.g., telling the game to make sure it always works the Tundra Hills Silver Mine while still letting the governor make the rest of the decisions about the other tiles--not unlike what already happens with Forced Specialists). This is mostly just me thinking out loud, as I don't know whether that's even plausible from a development perspective (and, if it is, if it could be done without an exhaustive amount of work in deeper parts of the game's code than the python). But if I knew that was intended on the modder's part I think I could actually turn that to my advantage as a player. Food for thought.
 

Attachments

  • Leno BC-0200 BugReport.CivBeyondSwordSave
    123 KB · Views: 163
Thanks for the save game. I've looked at it, and it did reveal a couple of yield evaluation problems; and I'll try have it working a bit better in the next version.

But it is a bit of a balancing act. I can easily fix it for the particular example in your save game, but the fix that I have in mind makes it run slower for heaps of other cases (still accurate, but about twice as much time doing citizen juggling, for some cities.) And the thing is, that it will never be perfect. There will always be some fringe cases where it misses a better tile - which is unfortunate... The good news is that it usually corrects itself. As you noticed in your example, changing the emphasis and then changing it back again sometimes fixes the non-optimal assignment; also, just removing one of the citizens and then automating it again usually fixes it; and if the city grows or shrinks... that usually fixes it.

Ideally, it would just get it right all the time; and I'll try to improve it for the next version without making it slower.. and your save did reveal a couple of bugs which I've fixed now. (In that save that you posted, if you give Coventry the village tile and the town tile - it actually prefers to work the village and not the town - and that doesn't even get corrected by moving stuff around. it just really likes that village... and it's my fault - that bug is rare side effect of some other changes that I made ages ago. It will be fixed in the next version.)
 
Glad I could be of help.

The way I look at it, if it's going to correct itself upon city growth then that's not too bad anyway. Since I micromanage my cities a lot anyway these days, I'm mostly concerned about it for the AI's sake.

As I said before, I heartily support the goal of making the governor faster without making it stupider. That is an _amazing_ goal imo.
 
I've just uploaded the next version. (v1.03).

Hopefully the automatic citizen assignment will work a bit better now. -- But there are some more serious changes...

Firstly, a small one: Culture flipping is now blocked for the most recent previous owner of a city instead of for all previous owners. So for example, if the barbarians capture one of your cities and then some other player captures that city from the barbarians - in the original system you would not be able to culture flip that city back into your empire, because you have already owned it before. But in the new system, you can flip it back because you weren't the most recent owner. (the barbarians were).

Secondly... some religion changes. I've taken a few more steps along the same path as my previous religion changes. The natural spread of religion (ie. religion spread without missionaries) is now affected by the same 'grip' factors that affect the missionary spread. Again, the main goal of this change is to reduce the dominance of the early religions. Maybe now there will be at least some games in which the later religions are the dominant ones...

Those are the only mechanics changes; but once again there's a bunch of AI changes to make the AI smarter and more challenging etc... and there are a few more minor speed improvements.

--
... I should mention though... I haven't actually played this version. All I've done is watch the AI play a few games on its own. So I can't say for sure how well the new religion system works, or how well the new AI works. It looked ok when it played without me, but... well we'll see.
 
You did improve the AI, well done. Gandhi peacevassaled to Boudica in my game at 800 BC at Prince difficulty (I did follow your advice and put the difficulty level one down). I thought '800 BC feudalism at Prince? Impossible, surely karadoc has changed the requirements for vassaling.' A few turns later, when I got alphabet, I found out Boudica did have Feudalism and CG2 Guerilla 1 longbows...
It seems Gandhi immediately went for culture. That's an improvement, too. The AI still can't outpace me in REXing, though :p
EDIT: It was also nice to see how every (and litteraly every) AI dogpiled Willem van Oranje. A bit less nice is the fact that is my favourite leader. Oh well.
I beelined to Nationalism to draft Janissaries. Did you already implement such a feature to the AI, beelining to mass-draft?
 
Top Bottom