A Better AI.

aelf said:
No. I lamented the fact that it is the people who are not very aggressive who are most affected. .

This mod is new and we havn't know this fact such as clear as you say yet. If you are right, so choose a lower level, what is the problem?
 
aelf said:
Hmm... I'm starting to think that there's a flaw with such a logic.

I think voek hit the nail on the head when he said that the handicaps have previously been designed for an inferior AI so they're actually obsolete now. And, as he has also pointed out, since the AI is better at managing its economy but still has the same handicaps, using force to crush them becomes paramount. Those who do not want to subscribe to a very aggressive style of play are the ones who have to drop a few levels.

Well, if this situation is going to remain, why not rename the difficulty levels? Beginner -> Very Easy -> Easy -> Builder -> Aggressive -> More Aggressive -> Very Aggressive -> Extremely Aggressive -> Impossible.

I'm trying to sum up in my own mind exactly what I see as the problems with the AI handicaps, still can't put it precisely but here's an attempt.

Firstly let me congratulate Blake on his skill, and doing a job with the AI that seems to outstrip the combined capabilities of the Firaxis AI programmers. He's done an amazing job, and should continue with his upgrading. The AI now plays a MUCH better gameplan all round, this is to be approved of by all.

The problems at present lie in the fact that the game as a whole, wasn't really designed to be played with an AI this good.If an AI uses slavery, chopping, religion etc all in the most efficient ways possible, then given a lvl playing field, with no bonus to either the player or the AI, this then demands the player uses these traits optimally too.

At present, the lower skill player has lvs like settler, warlord and chieftan, where they get various bonuses over the AI, yet even at this lvl the AI has "unseen" bonuses one of the most important being its cheap troop upgrades.

My main concern though is the scewered techline which I believe is now evident with all lvls noble and above. I'll take Monarch as it what I'm used to. The single fact of placing a heavier weight bias towards researching alphabet in the patch has had a huge effect on the timeline. It's only logical, that if tech is traded earlier in the game, then techs beyond this will be researched fasteer too. And this has a cumulative effect of propelling the world's tech rate forward even faster, for example if education is researched earlier and shared earlier, with unis being built earlier, then the next techs will be researched earlier and so on. Its a progression that gets faster and faster.

Now Blake has stated that the "AIs really do research that fast", and don't rely on earlier and more tech trading as a crutch, Well fine, I believe him totally and have no problems with that statement, yet this faster individual research, combined with a much earlier "tech sharing" can and does produce research faster than the game is balanced for. I, for one have seen the industrial age reached in 1350AD on monarch.

A problem with this faster tech timeline, is illustrated through something which has annoyed many players for a while, but was always there for balance. That is, the way that in trading, demands and the like, there is one set of rules for the AI and one for the player. Some examples:- (if you play aggressive Ais) you start off with negative modifiers towards each civ, that they don't have with each other. In trades, the higher the lvl, the "better off" the deal must be for an AI to accept it. The AI will ask you for tech, or war help or to stop trading with another civ, and then get pissed off when you refuse. They will not do this with each other.

This all leads to the fact that given 12 total civs on a map, you will (even as a peacemonger) be lucky to be able to trade with 4 of them by midgame, whereas because the AI doesn't have all these modifiers with each other, its is quite possible for one peacemonger AI to be trading with 8 or 9. These AI nations can and do act as "tech hubs" for the whole world, they always have done. Except before, the AI needed this trading imbalance to stay competetive in the game now it really doesn't, it just propels a scewered timeline forward even faster.

Playing a generally peaceful game (not something I generally do myself), but as pointed out by Aelf and others should always remain an option, becomes increasingly difficult. If all nations have the same amount of land, and are working it with equal effectiveness, then how the game works at the moment, the player will gradually fall further and further behind in tech, partly due to the Ais greater trading possibilities and partly because of the bonuses the AI receives. Therefore, the player needs more land to remain competetive, which can only really be achieved by warmongering. The notion of using a more powerful AI civ as a "protector" is fine in principle, but they are unlikely to aid you in a war declared upon you, unless you have something to bribe them with, which is generally tech. Which playing peacefully, you are increasingly unlikely to have.

Anyways, this ramble has gone on far to long, I'd just like to say again that Blake is doing an excellent job with the AI and hopefully will continue to do so. Game rebalances are definetly needed, but that's not really his job to do, just making the Ai better is a massive task on its own.
 
DevilJin said:
This mod is new and we havn't know this fact such as clear as you say yet. If you are right, so choose a lower level, what is the problem?

There has been feedback to confirm it. I just read a comment somewhere, in which a poster said he didn't find the patch much more difficult because the AI still loses to an axe rush. You see where this is going?

What I'm opposed to is the principle that warmongering is absolutely essential for Civ. I think that isn't the original intention of the game.

Anyway, when I said that not everyone wants to play MP-like games, I meant not everyone wants to play Always War or Always Have to Kill Somebody at All Times. It occurred to me that this statement might be one that led people into thinking that I don't like more intelligence or unpredictability on the part of the AI.

But I think that's enough threadjacking from me. There are obviously different opinions here and there are signs that it's becoming personal. I leave it up to Firaxis to do anything they want with the game.
 
Honestly it takes all of 10 minutes to go in and tweak the Handicaps that the AI is getting. I've now made my own 'custom' difficulty level and it was extremely easy to remove some of the AI bonuses while retaining the improved 'intelligence' of Blake's mod.

I've got the AIs having to abide by the same Health/Happiness freebies as the human players and I've cut down on some of their other advantages. Anyone can season it to taste with minimal effort. This way you can take some of the urgency out of having to feel like a warmonger, but without having a lot of the 'free ride' bonuses of the lower difficulty settings.
 
aelf said:
No. I lamented the fact that it is the people who are not very aggressive who are most affected. The last I heard, Civ4 isn't supposed to be just about war.

No matter how intelligent you may seem, do not assume that people are idiotic. Especially not on the basis of how they like to play a game.

Just to make clear, my comments where in no way aimed at you, a reflection of what I think of you, or anyone else directly in this thread.

I think you also make some excellent points.



I agree that CIV is not supposed to be just about war, but from my experince with chess I understand how difficult it is to create a real AI that would be able to pose challenge to all people of varying degree of skills.

Chess took several centuries of teaking before it became the game that we know today. We think of it as being static, but it really has not been that way.


As for War in CIV, I think it is completely unrealistic to create a culture that could last 6,000 years without major conflict with other cultures. It hasn't happened in the real world, so the model for it is tough to find and program.

Peaceful construction in more akin to a Simcity style of gameplay (and there is nothing wrong with that). And even that game tries to introduce elements of conflict. Because that is what drives drama and keeps people interested.
 
drkodos said:
Just to make clear, my comments where in no way aimed at you, a reflection of what I think of you, or anyone else directly in this thread.

I think you also make some excellent points.



I agree that CIV is not supposed to be just about war, but from my experince with chess I understand how difficult it is to create a real AI that would be able to pose challenge to all people of varying degree of skills.

Chess took several centuries of teaking before it became the game that we know today. We think of it as being static, but it really has not been that way.


As for War in CIV, I think it is completely unrealistic to create a culture that could last 6,000 years without major conflict with other cultures. It hasn't happened in the real world, so the model for it is tough to find and program.

Peaceful construction in more akin to a Simcity style of gameplay (and there is nothing wrong with that). And even that game tries to introduce elements of conflict. Because that is what drives drama and keeps people interested.

Thanks for the clarification. I was rather taken aback by your earlier post.

Well, I also need to make it clear that I am fine with some need to war in Civ. It's just that when you need to constantly do it to win a game, it becomes much more one-dimensional. I think such a situation should be confined to Deity and maybe Immortal, as it was.
 
aelf said:
Thanks for the clarification. I was rather taken aback by your earlier post.

Yeah. After I re-read the post I realized it look bad. That's a problem I have when I adress more than one issue on a message board.

I am so used to speaking in front of people and the two way street of nuancing communication based upon visible feedback that I often forget to check and just keep digging deeper and deeper. :)

I apologize for being a condescending blow hard. :(
 
drkodos said:
Yeah. After I re-read the post I realized it look bad. That's a problem I have when I adress more than one issue on a message board.

I am so used to speaking in front of people and the two way street of nuancing communication based upon visible feedback that I often forget to check and just keep digging deeper and deeper.

I apologize for being a condescending blow hard.

No problem. Forgive and forget :)
 
Great work as always. I tested the AI in a game last night, looks good.

For the military AI, I would not work on the offensive part first, but rather the defensive. I cannot count how many times I have been able to take important cities with only two (weak) defenders in them. Making the AI place more and better units in the border cities would go a long way - the worse the relations the more defenders of course. Military defense could also be scaled to the military power of the the neigbour.
 
Roland Johansen said:
. . I think he would be more interested in reports of flaws in his AI or reports of possible improvements in other directions.

I would look for flaws and report them if I was sure I was actually using the newest version. Can someone please tell me where I should put this updated file. Where exactly in custom Asssests?
 
mice said:
I would look for flaws and report them if I was sure I was actually using the newest version. Can someone please tell me where I should put this updated file. Where exactly in custom Asssests?

Posted by Blake himself in post 17:

Blake said:
First thing: Usage.

The zip you need is the one not containing the word "Source", the source means source code - you don't need that as a user.

In the zip you'll find a folder called BetterAI and inside that folder you'll find CvGameCoreDLL.dll. You can either place the betterAI folder inside your Mods folder then load it as a mod in game (using Advanced Menu), or you can take the CvGameCoreDLL.dll file and place it directely inside your CustomAssets folder (not any of the sub folders), which if you go to My Documents should be:
My Games/Warlords/Custom Assets/

To return to normal play simply delete the CvGameCoreDLL.dll file.

Both methods work equally well, I reccomend using the mod method if you use other mods, and the Custom Assets method if you don't play with mods.
 
Commonly in any games featuring computer opponents those opponents are to some degree predictable, don't react flexibly to changes in the environment, and essentially can be outplayed by a human who has enough experience about the computer opponent to accuratelly predict the responses to various changes in the environment.

In games like Civ, there are difficulty levels. These are almost always achieved by using handicaps: easy levels give bonuses to human player, hard levels give bonuses to computer players. The actual "AI" is the same on all levels. Also, computer players treat human players differently from other computer players. In solo game, the human is always facing a number of computer opponents that to some degree play not only their own game, but together against the human.

Blake's work has brought CivIV AI up by a lot. It's been noted that the remaining weak point is warring, and therefore if the AI gets bonuses over the human player, that's the only way to reliably win the game - utilize the weak area of the AI. Also has been noted that strategic planning is still a big weakness for the AI, but it's a lot harder to effectivelly use this against the AI than the weakness in warring, as the latter is fairly straightforward business.

Of the victory conditions, space race is very easy to handle mechanically. Research specific techs, build specific items, and there you are.
Time is another mechanical condition: the items affecting score can be worked on easily. Specific balance between the components is probably easier for computer than human at that.

The above two are the simple, non-aggressive victories that the AI could easily go for.

Cultural victory is, in my opinion, somewhat broken. It should rather be based on a long term empire wide cultural effort, maybe the sum of culture over time thus taking into account the culture added to the world by wonders later captured by greedy human opponent.. As it is, I don't play for cultural victory nor do I believe it would really be that easy to get it against human players - whether in MP game or by AI in SP game.

Diplomatic victory is probably the hardest one out of the three. "diplomation" is related to domination, meaning being the dominant civilization population vice without having the landmass to get direct domination. I find diplomation perfectly valid variant of domination, but that should probably be discussed under domination title as a variant rather than under diplomatic title.
The "true" diplomatic victory happens in my opinion when you have not just the vote count to be elected, but also half the existing civs standing by your side. And yes, I'd count vassall (whether capitulated or freely vassallized) as a civ for that purpose: capitulating three civs (out of 7 opponents) and winning by your and your vassals' votes without others voting for you is, IMHO, valid diplomatic (as opposed to diplomation) victory.
How hard it would be for the AI to go for true diplomatic victory I don't know. I don't expect that to be easy.

Conquest is quite straigthforward: when no other civ exists, you win. Shouldn't be hard for the AI to go for this option, although priorizing the order of civs to take out should not penalize human (assume two warlike AI's go for conquest and both decide to take out the human civ first on the count of human player being penalized, not because of more balanced reasons).

Domination I find very tedious, and thus I easily end up going for diplomation instead... I find it easier to get the population above selection limit (by my own votes only, without requiring votes from any computer opponent) than filling the lands with my cities to bring the land up to domination level. Still, the victory condition itself isn't very hard to consider by pure logic and should be possible for AI as well.

Looking back at the victory conditions, it seems there are two basic methods the AI could utilize: builder (space, time) and warrior (domination/diplomation, conquest). Diplomatic is most likely achieved by hybrid of both ways even more than the others and I believe would be a lot harder to put down to logic and code than the other two. Builder method is likely to require some warring and diplomacy as well - going purely peacefully is not going to work very well if your neighbours don't agree to peace, and also to achieve the land and population advantage required for builder method (land is power), some of the land will almost invariably come from the other civs via war. And the way of the warrior will probably involve some scheming in the diplomatic circles as well, but the amount of infrastructure required is less than the space race builders'.

Overall, it would be very nice to have the AI leader personalities clearly differ from eachother, their chosen victory conditions be varied (and based not only directly on leader but also on the environment they find themselves in), and the AI be capable in all aspects of the game therefore requiring no specific bonuses over human player to provide a real challenge against even the best players. The difficulty levels would then differ not in the bonuses/penalties applied to computer/human but rather on the AI "level" chosen.

This is still just a dream though, and will take a lot of time to reach. Some day we'll get that, but the amount of research in the area will show not only in computer games but in all the machinery in our lives. Until that, we'll just have to be glad the game AI is improving and can handle more situations as well as the human can. I would say that the bonuses and penalties of difficulty levels should be tweaked to take into account the improvements in the AI or the AI code be broken down into components so that different level of AI can be used on different difficulty levels as well.

And yes, I would like to be able to win by means of teching, trading, and diplomacy, but without wars that's just not going to happen. Or... maybe. A true diplomatic victory without ever having gone to war outside one's own cultural borders (or those of your allies - essentially only defensive war protecting your and your allies' empires) is a tempting thought. How to handle situations where your allies don't abide by the defensive rules is a bit of a problem though. Some expansion by cultural domination might occur, but it would definitelly be against the spirit of the chosen path to use culture aggressivelly (eg. Epic 8 report by Sulla shows creative civ using aggressive city placement for forcing culture flips) - cultural aggression should not appear on the reasoning in city placement even if that may result from building a city near one's border.
Maybe I'll find some game thread where it's been done, or maybe someone (aelf? sisiutil?) will take that road in a future game?
 
Originally posted by: Blake
Nope. You'll have to do a diff (ie WinMerge) against the stock 2.08 SDK or maybe 2.00 if you're talking about merging into 1.61.

I tend to make changes all over the place so the labels would get really quite messy.

Thanks for the tips Blake. You're right about making changes all over the place, even with labels in your code WinMerge is still the better way.

Thus far I'm extremely impressed by your changes, I'm definitely going to have to adjust my style of play.

Keep up the good work. Thank you for releasing your source code changes, I would greatly appreciate if you continued to do so.
 
:) Blake :)

I just want to say THANK YOU and that your AI changes accomplished just what you had hoped for me!

You stated that you wanted to fix the problem whereby once you achieved a lead in ancient times you could sit on your laurels and win. The AI was previously very poor at managing an empire past the medievil age.

My GF and I play multiplayer coop, and we have always have gotten bored after we complete the medevil age. We both end up in the top four, and it becomes pretty clear that we are going to cruise into victory. I swear we have never even used tanks or gunships in any of our games!

With your improved AI, for the first time ever we both wanted to continue. I had been siting in on my laurels as number 1 but a couple AIs started to shoot past me just by empire building!!! She had been sitting on her laurels as she was sharing a continent with Brennus, but suddenly Brennus started outscoring her too even without acquiring more land! We both had to do something or continue to watch our victory slip away. The once in-a-bag-game got totally exciting again.

Good work!
 
To the others who say these changes are leading to a war only strategy. You may have a point, but I have a simple idea that will go a long way to making diplomacy more important.

Enable permanent alliances.

You can get all the benefits of "taking over" an AI without going to war through careful diplomacy. Behind in tech? Use what resources you have to foster relationships and crawl towards the Fashism tech. Get that and join up with one of the AIs. You will never get left in the cold with tech again.
 
Congratulations Blake, I must say that having your modifications included in an official patch is AWESOME, I think this alone tells how good your work is ;)

Now I see that you already touched something dealing with AI warfare -> (Fixed a problem where an AI stack will wait to heal in hostile territory with no medic, wasting upwards of a dozen turns.)

I think 'fixing' this aspect of the game could be even more usefull, rewarding and... difficult. However, I got the feeling that what you did sparked interest in the whole community, basically you demonstrated that it can be done.

Guess what? I downloaded this civ4 sdk, and fired it in visual C++ (even if I know jackhorsehocky about C++ itself, code is code, isn't it?). I have a question : where do you discuss the code itself? I had a quick look at your sourceforge page and didn't see any suitable subforum. I included in the spoiler below an exemple of what I mean about 'discussing the code'.

Have a nice day, and keep up the good work ;)

Spoiler :

Maybe you'd find hints at possible things to investigate for 'improvements' usefull?

A common complaint about the AI in war is it's inability to effectively defend it's cities.

Using the source labeled "CvGameCoreDLL_v161" the first obvious object to look at is for me cvCity (and it's derived type cvCityAI). in it AI_isDanger sounds promising. fixed value at 0 in cvCity, call to a function in cvCityAI, following this one ->

return GET_PLAYER(getOwnerINLINE()).AI_getPlotDanger(plot(), 2, false);

Checks for units able to attack the plot the city is on, in a range of 2, not considering the units in the city moving? (Possible flaw : using a generic plot danger evaluation, not one tailored for city defense.)

CvPlayerAI::AI_getPlotDanger ->
Only checks for units of a player at war (flaw : under such conditions the danger of an imminent invasion cannot be seen until war is declared?)
Checks for units able to fight and visible. correct.
Checks if the unit can attack on it's turn. (flaw : a stack of death of 50 axemen two tiles away are not counted as a danger yet???)
Returns the number of units actually able to attack the plot(city). (flaw : raw number of units around!)

It does not take into account the kind and strenght of the ennemy units, only their number, ie :

3 half dead warriors near -> CvCityAI::AI_isDanger() returns 3
3 modern armor with city raider 3 near -> CvCityAI::AI_isDanger() returns 3

I don't know yet how this CvCityAI::AI_isDanger() is used, but seeing at how inaccurate it is, I doubt it leads the AI to a good decision making process.

Hace a nice day.
 
Blake:

One of the biggest problem for AI is it does not utilize the unit promotion well, they know to mass upgrade their units well, but most of AI units you will fight will only have 1 or 0 promotions. It is so one sided favoring the human it is boring. We use the GGs and CIVICS well to product lvl3-lvl4 units right out of the box.

So simple idea to help the AI. If AI starts a war with a foe on par in scores, have it automatically switch to Vassalage/Theocrothy/Police state. Also instead of building the MA with the GGs, put the GGs as instructor in their most productive cities.

The logic is simple but it make the AIs 100% more effective in battle against human when combined with its production bonus. Also if they have more experienced troops, they can enter the human territory dispersed with impunity, let the human waste his units against the AI's 1 on 1. This could vastly reduce the collateral damage suffered by the AI SODs :goodjob:
I often send mutiple packs of 3 elite imortals/calvary to take AI cities, and attack with the weakest units first.

Thanks Blake for making this great game even greater :goodjob:
 
Blake:

One of the biggest problem for AI is it does not utilize the unit promotion well, they know to mass upgrade their units well, but most of AI units you will fight will only have 1 or 0 promotions. It is so one sided favoring the human it is boring. We use the GGs and CIVICS well to product lvl3-lvl4 units right out of the box.

So simple idea to help the AI. If AI starts a war with a foe on par in scores, have it automatically switch to Vassalage/Theocrothy/Police state for the duration of the war. Also instead of building the MA with the GGs, put the GGs as instructor in their most productive cities.

The logic is simple but it make the AIs 100% more effective in battle against human when combined with its production bonus. Also if they have more experienced troops, they can enter the human territory dispersed with impunity, let the human waste his units against the AI's 1 on 1. This could vastly reduce the collateral damage suffered by the AI SODs :goodjob:
I often send mutiple packs of 3 elite imortals/calvary to take AI cities, and attack with the weakest units first.

Thanks Blake for making this great game even greater :goodjob:
 
ABigCivFan said:
Blake:


So simple idea to help the AI. If AI starts a war with a foe on par in scores, have it automatically switch to Vassalage/Theocrothy/Police state for the duration of the war. Also instead of building the MA with the GGs, put the GGs as instructor in their most productive cities.

:

Automatically?, What if the AI, for example, won't be able to handle the high civic upkeep? and Vassalage/Theocracy are better when preparing for war and not in the war itself.
Nothing in civ sould be automatic, this is not this kind of game.
 
ABigCivFan said:
Blake:
automatically switch to Vassalage/Theocrothy/Police state for the duration of the war.

They already do that AFAIK. The point is, to wage a succesful war (or a succesful defense) you should've produced most of your units before the war.
 
Top Bottom