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.)