Smarter Orcs (a FfH II mod)

I played a game as Charadon of the Doviello on marathon. The AI has stacks of units in its city while its at war with me, while I'll only have 1 or 2 guys on the outside. I still am able to slowly whittle away the enemy.

I still greatly enjoy what you're trying to do though. A few other thoughts of mine.

1. The AI doesn't understand closed spaces very well. If you're on an island, it's better to spread your cities so that you can fit 2 on one rather than 1 with slightly more land area.

2. The AI should take your city if its unguarded especially if it's the only city that you have, even if they're your friend.
 
2. The AI should take your city if its unguarded especially if it's the only city that you have, even if they're your friend.
That's an interesting point, and perhaps a bit off-topc for your project, but here's the question--should the AI play the game as well as possible, eliminating every rival that it doesn't need, or should it try to give the player a more ... "realistic" experience, growing its empire as best as possible but only at the expense of enemies, unless we are talking about the particularly untrustworthy like Svartalfar or Doviello?

For the most part, each type of AI needs the same kind of improvements, so the point is moot except in deciding when the AI should go to war and give aid.
 
2. The AI should take your city if its unguarded especially if it's the only city that you have, even if they're your friend.

Personally in this case if it would be implemented it should take in account mostly flavour.
A friendly civ attacking your remaining empty city should be IMO:
-evil
-good civ attacking the empty city of an evil civ
-Elohim shouldn't make such a move
-Perpentach could sometimes attack , sometimes not in such situation
 
Nikis, we've had this conversation before, in the other thread, but it's a very central question to this project (and I guess in extension to the mod itself, but it's very probable that you guys will come up with a different answer to this question), so it's worth discussing this again.

Generally, it boils down to the question of flavor vs performance. Should an AI who has good relations with you attack you if they can only benefit from it? That is to say, what should motivate the AI's actions, the narrative of the game or the final goal, which is to win?

There are two extremes: one is the hypothetical LAN game with a bunch of mean-spirited guys who don't know each other and only want to win (because to be honest if I know there's a friend in the game, I'll be less (or sometimes MORE ;)) likely to attack him), the other is a kind of game that could be turned into a pulp fantasy novel, with all races behaving properly and good guys being good and bad guys being bad etc. Let's call the latter extreme "roleplaying" and the former "playing to win".

I don't think that any of those extremes can be what we want. If you look at Vanilla CIV (where the same applies, but to a much smaller extent), you can see that Firaxis has made a number of decisions tending toward the roleplaying end of the spectrum. For instance, the AI modifiers (you razed one of our cities etc) seem to recreate a human player (I for one do get pissed off at another player in a game and will want to get back to him for attacking me and so on, even though I realize this is often a stupid strategy, especially because it is predictable) or at least an intelligence at the head of that other state that keeps grudges etc.

In the interest of full disclosure I'll admit that I personally want the AI to perform as well as it can, which means I want the end result to be as close to "playing to win" as possible. I do realize however that there are people who would want the AI to be closer to roleplaying, and that this is doubly true in a fantasy mod, so I don't think we'll develop exclusively toward "playing to win". I see how the roleplaying version can be fun, and in the current version of my xml files, I'm flavoring strongly for roleplaying (mainly because the stuff you can do in the xml cannot really make the AI *much* stronger; to be a stronger player, you have to be aware of the situation in the game, and the xml always applies to same, no matter if, for instance, someone's approaching you with an army of mounted units or not).

My two main arguments against roleplaying are these:

1) it makes the game a lot easier

and

2) it makes the game more predictable.

These are closely related. The game becomes easier because you can much better predict what the AI will do. Also, I can imagine that there will be many exploitable behavioral patterns. For instance, assume dwarves like other dwarves and hate orcs. Now imagine that from left to right on a narrow continent there's an evil orc (AI), a good dwarf (AI), and you, playing dwarf as well. It is conceivable that in an AI environment that focuses on roleplaying it will be very easy to convince your dwarf friend to declare war on the orc even though the orc is much stronger than the dwarf. After your "friend" softened up the orc, you wipe out your friend and with the addition of his cities to your kingdom destroy the orc as well.

An optimal solution would be to have an adjustable roleplaying setting: turn it up high and the AIs will behave as you would expect these races and leaders to behave in a fantasy setting. Turn it all the way down and it's every civ for itself. I don't know how feasible this will turn out to be.

Also, if we want to keep the game competitive, there should be a mechanism in high roleplaying games to punish and reward the player for roleplaying his own civ. In the above example, the player should be punished for declaring war on another dwarf whom his people liked so much. This punishment could be unhappiness in the player's cities, for instance, or random military units abandoning the player etc. Reward could come in the form of additional happiness, more money, etc. We could take it as far as an evil civ's citizens becoming unhappy if their leader does not declare an easily winnable war.

Additionally, leaders could have a "reliability" stat; the higher that stat, the more likely it will be that they behave "realistically". You can all guess which leader would have a very low reliability stat... ;)

If the adjustable (think: slider ;)) roleplaying setting won't work, we can at least release two different sets of XML files: one with strong roleplaying flavors and one without.

Speaking of XML files, that's what I should go back to now.

[edit from deep within the XML jungle] Some of the flavors in vanilla ffh are really strange... why would archery be preferable to the science-minded? Why would Animal Mastery have a Growth flavor?
 
I played a game as Charadon of the Doviello on marathon. The AI has stacks of units in its city while its at war with me, while I'll only have 1 or 2 guys on the outside. I still am able to slowly whittle away the enemy.

I still greatly enjoy what you're trying to do though. A few other thoughts of mine.

1. The AI doesn't understand closed spaces very well. If you're on an island, it's better to spread your cities so that you can fit 2 on one rather than 1 with slightly more land area.

2. The AI should take your city if its unguarded especially if it's the only city that you have, even if they're your friend.

I agree with #1, although it isn't a high priority for me at the moment. I'll list that on the Wiki page for future thought.

Note that for #2, there is a significant difference between BetterAI-based code and standard AI code that you may be noting: Fog. Basically, the standard AI doesn't know how to handle fog; therefore, it doesn't exist (i.e. it cheats). In BetterAI, however, AI players are affected by fog exactly like human players. This means that they are less likely to know about your undefended cities, and that they make some moves to do nothing other than to remove the "fog of war".
 
In the interest of full disclosure I'll admit that I personally want the AI to perform as well as it can, which means I want the end result to be as close to "playing to win" as possible. I do realize however that there are people who would want the AI to be closer to roleplaying, and that this is doubly true in a fantasy mod, so I don't think we'll develop exclusively toward "playing to win". I see how the roleplaying version can be fun, and in the current version of my xml files, I'm flavoring strongly for roleplaying (mainly because the stuff you can do in the xml cannot really make the AI *much* stronger; to be a stronger player, you have to be aware of the situation in the game, and the xml always applies to same, no matter if, for instance, someone's approaching you with an army of mounted units or not).

My two main arguments against roleplaying are these:

1) it makes the game a lot easier

and

2) it makes the game more predictable.

These are closely related. The game becomes easier because you can much better predict what the AI will do. Also, I can imagine that there will be many exploitable behavioral patterns. For instance, assume dwarves like other dwarves and hate orcs. Now imagine that from left to right on a narrow continent there's an evil orc (AI), a good dwarf (AI), and you, playing dwarf as well. It is conceivable that in an AI environment that focuses on roleplaying it will be very easy to convince your dwarf friend to declare war on the orc even though the orc is much stronger than the dwarf. After your "friend" softened up the orc, you wipe out your friend and with the addition of his cities to your kingdom destroy the orc as well.

An optimal solution would be to have an adjustable roleplaying setting: turn it up high and the AIs will behave as you would expect these races and leaders to behave in a fantasy setting. Turn it all the way down and it's every civ for itself. I don't know how feasible this will turn out to be.

My basic thought is that any attempt at installing real "role-playing" (not just weighting things via XML) in the AI is a bit pie-in the sky for now, but if/when we get to the point where the AI is working well (i.e. after it understands all the new features and uses them moderately well - probably a long time from now), we may want to consider it. On a purely theoretical basis, we could actually try to work against predictability.

As an example, Daladinn wrote up two different strategies for the Grigori: Scholarly Grigori, and Cassiel the Merchant Prince. These were written a while ago, but for the purposes of this argument let's assume that they're both valid strategies, and let's add another: "Adventurer Rush" (i.e. Adventurers -> Warriors; rush down the Melee line, try to kill off opponents early) to the mix.

Now, with these three overarching strategies, the Cassiel AI could choose the one it favors very early on (perhaps on turn 1). If one of these strategies (ex: Adventurer Rush) fails early, they could switch to another strategy - perhaps Cassiel the Merchant Prince.

So the idea would be that there would be a list of strategies, with some weighting mechanism, and some mechanism of both choosing between them, and a way of moving between them. A simplified version of this idea may be useful for trying to obtain raw victory - if your culture generation is high enough, you should probably focus more on that, and less on taking out your opponents militarily.

I'll note again that this would be pretty pointless to try to implement until the basics are working well. Right now, almost all of the good strategies would fail, simply because the AI doesn't understand the basics.
 
Hmm, I was more thinking of the smaller decisions. I'm all for overall strategies (matter of fact, I believe it will not be possible to make the AI perform really well without those in FFH. The biggest difference, in my opinion, between FFH and Vanilla is that FFH basically FORCES you to specialize. Going for all branches of techs is a feasible strategy in Vanilla, but not in FFH. This is why I'm hoping that my current flavoring may not just increase the roleplaying feeling but also performance: Khazad preferring melee strongly may not always be clever, but at least it will get them down the melee tree and toward the stronger units much faster than if they decided to research recon and archery and horse techs as well), but I was thinking about things like diplomacy modifiers mattering a lot more and there being more of them, and also of there being different sets of modifiers for different alignments. Example: let there be two good civs, A and B, which have very good relations with each other. I attack and wipe out civ B--civ A should now really hate me. In contrast to this, if A and B were both evil civ, the amount of hate I should get from A should be a lot less, simply because evil civs should be more like, okay, so he was weak, he deserved to die.

Also, is there a mechanism in place where the AI compares its strength to your strength and decides to attack or not based on that? I think so, but I'm not sure. In case there is, it should be a LOT more important to evil civs than to good ones.

Do you think stuff like that would be too difficult for us even right now? I'd think that making the AI understand something like fireballs for instance would be harder than implementing a few new diplo modifiers and modifying a few functions to be different based on the AI's alignment, no?

Oh and xanaqui, in case you didn't get my PM, the sourceforge project is up and running. If you pm me with your sf account, I'll add you to the project.
 
Note that for #2, there is a significant difference between BetterAI-based code and standard AI code that you may be noting: Fog. Basically, the standard AI doesn't know how to handle fog; therefore, it doesn't exist (i.e. it cheats). In BetterAI, however, AI players are affected by fog exactly like human players. This means that they are less likely to know about your undefended cities, and that they make some moves to do nothing other than to remove the "fog of war".
I think most people prefer this, that is, an AI that cheats as little as possible while still giving challenge. So this is a step in the right direction, assuming the AI scouts around and stuff, which is considerably easier in FfH with rangers with visibility on mountians being wonderful at checking out enemies.

Nikis, we've had this conversation before, in the other thread, but it's a very central question to this project
A couple responses to your post w/o quoting it all, if that's okay--
It's your project, make the choices you think are best and Kael will surely take all the bits (that aren't redundant with whatever BtS does) that he agrees with (which isn't necessarily related to what I agree with ;)) I'm sure either way it'll be an improvement.
But keep in mind that if all AI's ruthlessly turn on you inspite of your relations if they think that they could take you out, what exactly is the point of having a diplomatic layer? Now personally if an AI demands something from me, I usually tell them to bug off, I don't take orders from a *computer*!, but for better players, this should be a valid strategic decision. Making deals with your rivals should be an investment. If a player goes to the trouble of getting good relations, they should be rewarded with a dependable ally (unless it is the ONlY other player in the game). It may be making the game easier, but the pay-off is not just "role-playing" but more strategy.
Of course, the AI should keep in "mind" thing such as how often the player declares war on rivals with decent relationships and how many troops you have near the border, etc., and not be duped if possible. I wouldn't want Cardith or Ethene to let you walk all over them for the sake of role-palying if you are showing signs of agression. Just be less likely to attack a friendly player.
 
Do you think stuff like that would be too difficult for us even right now? I'd think that making the AI understand something like fireballs for instance would be harder than implementing a few new diplo modifiers and modifying a few functions to be different based on the AI's alignment, no?

Adding/changing diplomacy modifiers isn't difficult. Atleast not the example you gave. There's already an XML value refering to how much each leader dislike you for declaring war on their friend, MEMORY_DECLARED_WAR_ON_FRIEND. This value is multiplied with the number of times you've declared war on a friend (pleased or friendly) of theirs and then divided by 100. (SDK function CvPlayerAI::AI_getMemoryAttitude). You could change or add just a single line to make alignment matter (such as adding a multiplier in CvTeam::declareWar where the memory is set).
 
Hmm, I was more thinking of the smaller decisions. I'm all for overall strategies (matter of fact, I believe it will not be possible to make the AI perform really well without those in FFH. The biggest difference, in my opinion, between FFH and Vanilla is that FFH basically FORCES you to specialize. Going for all branches of techs is a feasible strategy in Vanilla, but not in FFH. This is why I'm hoping that my current flavoring may not just increase the roleplaying feeling but also performance: Khazad preferring melee strongly may not always be clever, but at least it will get them down the melee tree and toward the stronger units much faster than if they decided to research recon and archery and horse techs as well), but I was thinking about things like diplomacy modifiers mattering a lot more and there being more of them, and also of there being different sets of modifiers for different alignments. Example: let there be two good civs, A and B, which have very good relations with each other. I attack and wipe out civ B--civ A should now really hate me. In contrast to this, if A and B were both evil civ, the amount of hate I should get from A should be a lot less, simply because evil civs should be more like, okay, so he was weak, he deserved to die.

Also, is there a mechanism in place where the AI compares its strength to your strength and decides to attack or not based on that? I think so, but I'm not sure. In case there is, it should be a LOT more important to evil civs than to good ones.

Do you think stuff like that would be too difficult for us even right now? I'd think that making the AI understand something like fireballs for instance would be harder than implementing a few new diplo modifiers and modifying a few functions to be different based on the AI's alignment, no?

I think that if we want to do this on a leader by leader basis, it can be done via XML with no code changes. On the other hand, if we want it to be alignment-dependent (which appears to be what you're suggesting), that would take a small amount of C++ work; I'd suggest adding it to the wiki page, unless you think that this is imperative immediately. If you think that it's imperative right now, describe further what you want (i.e. try to describe the values, etc.), and I'll try to get it into the next build.
 

What do you intend to do about the AI making way more units than it intends to use? I'd say either have them use the units instead of just let them sit around, or maybe just not make as many units. As things stand, the AI is paying ridiculous amounts of unit upkeep.
 
Capped XP-Gain from Barbarian Units seem to be broken.
Units still gain XP after 100 from those.
And you suffer crashes even in windowed mode,
if your window is not maximized.

I just ran a pretty stable (read as zero crashes) 200 turn game of vanilla FfH
and now enjoy this .dll together with Blazes MaxMod (400+ turns and rising).
I do expect problems with Sevo's Total Victory,
but aside from that it runs very smooth for an alpha release.
 
Oh no, this is nothing that I would say must be done RIGHT NOW. First I think we should each finish our current chunk of work (you're ironing out some kinks, aren't you? And I'm working on the plain old normal flavors). But I will also add this to the wiki and we can take it from there.
 
Capped XP-Gain from Barbarian Units seem to be broken.
Units still gain XP after 100 from those.
And you suffer crashes even in windowed mode,
if your window is not maximized.
Is this intended for this AI thread?

As for the XP gain, are you playing a leader with the raider trait, or using the Valor spell?

- Niilo
 

What do you intend to do about the AI making way more units than it intends to use? I'd say either have them use the units instead of just let them sit around, or maybe just not make as many units. As things stand, the AI is paying ridiculous amounts of unit upkeep.

but do they care about the upkeep? =P
I mean.. once most of the territory is occupied they start "building up for war" (using a Hearts of Iron expression :P) Varn (the most hated one) always fills his city with warriors, I know it's just a matter of time until he declares war on someone....

I would really like to have my neighbours with few units :lol: but I don't really see it as an issue...
 
but do they care about the upkeep? =P
I mean.. once most of the territory is occupied they start "building up for war" (using a Hearts of Iron expression :P) Varn (the most hated one) always fills his city with warriors, I know it's just a matter of time until he declares war on someone....

I would really like to have my neighbours with few units :lol: but I don't really see it as an issue...

Faeryl is currently at war with a person she shares her southern border with. If she sent most of those units down into the fight, she could crush them, but she doesn't.
 
hi guys, i just wondering how the xml part is going - i'm just about to start my first game with the new ai but it seems to me that the two will be quite complementary.
 
Mervvyn, I'll have a first version of the xml out tonight--it'll probably be only technology, but that's a good chunk of AI performance right there.
 
awesome - i played half a game this afternoon (small highlands, 4 ai, me as khazad) and the ai's tech selection was poor, combined with poor development of their economies (far too few cottages), so i look forward to seeing it.
is it likely to increase the chances of an ai springing hyborem? i've wanted to give basium another go but without much success due to lack of hyb - i could summon hyb myself, but that defeats the purpose in my mind.
anyway, great job with the ai, it is appreciated.
 
Is this intended for this AI thread?

As for the XP gain, are you playing a leader with the raider trait, or using the Valor spell?

- Niilo

Sorry for that, it was just stupid me getting a certain elven leader
in a random game and not paying attention -.-

Still was not able to finish the game.
Repeatable crash on AI-Turn (turn 421).
No python error, no warning,
just a Civ IV.exe has caused a problem in module CvGameCore.dll...
'ello desktop.

Will give it another try this weekend without any modification
and see if it happens again and get some saves.
 
Back
Top Bottom