A humanist's view of good AI for CIV4

Bibor

Doomsday Machine
Joined
Jun 6, 2004
Messages
3,143
Location
Zagreb, Croatia
Hello 2 all members.

I have a suggestion, or rather a point of view, that I think could help the developers of CIV4 to build a better AI. I will not write mathematical formulae or such things, I will to write it down in a very readable way :)

First, the merits of AI over human players.
1. AI can crunch many more data than a human can in given time.
2. AI can be lose with no emotions. It has no Ego to indulge.
3. There can be many AI players at a single computer.
4. AI knows the game rules perfectly.
5. AI is not making any mistakes.

Second, the merits of human players over AI.
1. Only one. The human player *do* err. They make mistakes.

If a human player makes a mistake, the AI views it as a different aproach to the problem that it has to counter. AI is simply *unable to undestand* that humans make mistakes. By reacting to human wrong move, the AI starts to make a mistake(reaction) after mistake(reaction), finally to be beaten. That is, the AI does not know that the human pressed the 7 key and moved his scout NW by mistake. It will react to it and divert its troops from the original city attack plan it had.

++

Another problem with CIV3 AI is "hardcoded" to defeat the *human strategic genius* by simply limiting the human player's options. Examples: counter human early archer rush by giving more defensive units to AI. Counter ICS and "settler factories" by giving more settlers to AI. Be sure that transport arrives on designated place by giving it an ernormous and expensive escort.

The main problem with *green* AI programmers is that they think that a human will come up with something miraculous that will beat the AI to death.
Wrong.
Human players tend to be very predictable. How much lines of code does it take to code so that the AI understands the following:
* human player has access to iron and iron working
* human player has very limited space for expansion
* human player has a low culture score so it must be building units
* human player has one luxury grayed out in diplomacy screen.
* human player has no other civs around him
* I, the AI, have 3 luxuries and no iron or horses
____
* The human is going to attack me in 1-10 turns.

Solution: rather than build an AI from scratch, use the forums and learn what people do to defeat the *game mechanics* not the AI. What are the human players priorities, what are their EGO weaknesses, what are they going to research first? Which way they expand? What's the ICS and when do they use it? What's an early archer rush? What's a Ring City Placement and how does it help? Why are they amassing 40+ artillery and then stomp city after city? Why they connect all cities with RR first and then let loose the workers? Why they use workers to go with army so they can build RRs immediately after the inital attack? etc.
This way, the AI gets a "knowledge base". By a larger knowledge base, the AI has more variants to play off. And this leads to...

+++

The real AI.

The real AI is actually the "king of copycats". Like the perfect illusionist or disguiser, it can be a multiple persona, whichever persona fits its needs.
The trick here is to give AI priorities, short term goals and long term goals.
Example: at reasonably early game, the AI sees that it has access to 4 luxury resources, iron and horses. It has a decent territory with marshes, deserts and several tundra tiles. It concludes it is more or less "self sufficient". It is going for a SPACE RACE victory. This is its "long term" plan. For now.

Now, lets take the example from above with predictable greedy human player. The AI undestands the threat and decides it will take the initiative: first he sends a diplomatic message stating that "I, mighty Hammurabi of the Babylonians will create roads to your mighty kingdom and I am pleased to inform you that I want to trade my luxuries to you. You can also expand four tiles east from your last settlement. That much I will tolerate. Since we are first neighbours, the prices for luxuries will be reasonable." Human player agrees. AI adds -1 to this particular human agression level. But, from the example above, the human player is not true to his words. Contingecy plan: attacking two of human's bordering cities. It estimates the human's army strenght by culture points, city numbers and sizes (of scouted territory of course, no "no FoW cheating") and resources that are available to the human (visible on the diplomacy screen, iron 0, horses 1 = it has 1 iron and 2 horses, hmmm).
The AI makes three strike teams, two for cities and one for chasing a counterattack/diversion/off-city units. It is not expecting town walls at this point so it is going 2 to 1 tactic. It is 4 to 1 for 1st city, and maybe 2 to 1 if first city is taken. Its a warning, not an invasion.
It sends another clear diplomatic message to human player: Stop building warriors and/or so many settlers, my friend, or I will not trade with you. I will send an emisarry to check your work.
AI sends a worker to roam the human's lands. It cannot be kicked out since its a non-combat unit.

This the AI short plan. And it *will* stick to it. No matter what.

The human builds army. He thinks the AI is dumb. AI adds +2 to human agression level. +1 for neglecting the first deal, +1 as cumulative penalty.

...

After this inital attack the human is obviously confused? What??? The AI dares to destroy one of my cities and almost take the other one? I will crush him. I'll build and army of 20 swordsmen and strip him of his lands.

AI continues to build his by his long term priorities. Culture, science, a military unit here-and-there (if applicable), chops trees for important improvements (since it knows the granary + 5 food per city per turn strategy), la la la la la, and after 5 turns builds an embassy at the human player. And he sends a scout (or worker if non expansionis) to human lands again. If it sees swordsmen in towns and in country side, it gets the point. If the scout/woker gets killed/captured... the human's intentions are obvious. retaliation and war. AI adds +4 point to Human agressivness table. The human is geting notorious the AI's eyes.

Etc.

I hope that you understand what I wanted to say, since my English is not perfect :P

EDIT: The above examples of "how AI knows that human is building units" are just examples, not real CIV3. Especially not the culture points and city sizes since humans whip citizens (can be mistaken for building much settlers) and build workers. But, actually, getting spies only in the mid-industrial is not realistic. Spies exist from the very beginning of man vs. man conflicts. Maybe the ancient spy info would delay a few turns (you have to wait for results), be with errors (not exact army number) or such, but they should definitely exist. Also, unit movements outside opponent civ's borders should be an automatic information for free. "An army is leaving England to the west".
 
First of all, I hope the AI will be scriptable, so I'm looking forward to play against your AI...
I think, it's hard to make the AI see what you plan, but does it really have to?
I think the biggest mistake of the Civ3 AI is, that it's too predictable. Surely it can be improved in some tactics and some defenses, but it would be a lot harder for the really good players if the AI was unpredictable and you never really know where it attacks!
 
According to Soren Johnson's slides, the AI will be scriptable through Python programming language. As for Civ3 examples above, currently the AI has full and complete knowledge of all units on the board (thus the problems that occur with submarines and privateers). I agree that the AI 'could' have this omniscience taken away, however, it would allow a human player to hide lots of stuff where the AI would never 'think' to look for it.

I agree, never-the-less, that the AI will have to be improved. I trust that given the availability of its easy mutability, people in this forum and Apolyton will likely be scripting AI to the point where they will have AI competitions, etc. and the AI will eventually be able to challenge all but the very best players.
 
The key issue is the AI actually being able to choose a plan based on certain criteria. That is the determining feature and the one I hope most of all is included in Civ 4's AI.

With that enabled, the criteria could be modified through scripting, and the AI's response could be modified through scripting - it's simply the link between them that has to be provided by the game's structure. If it is, then anything is possible...
 
AI is a lie because all it does is counter its cheap u do this so it does this u do this it does this is the whole reason why AI cant compete with humans even if we make mistakes we still can comprhend what we did and devolpe a new strategy based on current movements and units places all the AI does is counter so why waste ur time on it unless u figure out how to make it so it can comprend what i did and learn from it
 
Colonel: why waste time on it?

Because it's either play against the computer or play MP, there's not much in between. ;) I'd reckon that 95% of all players play consistantly with SP games, so having no AI would be cutting off most of the market. ;)
 
im not saying dont play single player im saying why waste ur time tryin to fix AI if u cant make it smart all u can do is make it better at counter reacting
 
Ma biggest gripe with the current AI at a macro level (there are a bunch of little enhancements that would make it play more effectively at the micro level) is that it isn't trying to win the game. The AI just follows its path, without a goal of winning in mind. It doesn't appear to say to itself "Hmmm...I think I should go for a cultural victory this game" and then do the actions that would cause this to happen.
 
warpstorm said:
Ma biggest gripe with the current AI at a macro level (there are a bunch of little enhancements that would make it play more effectively at the micro level) is that it isn't trying to win the game. The AI just follows its path, without a goal of winning in mind. It doesn't appear to say to itself "Hmmm...I think I should go for a cultural victory this game" and then do the actions that would cause this to happen.

That's exactly what I'm trying to say. Just as we, human players choose long-term and short term plans, I cannot comprehend why the AI cannot do it. Maybe my programming is bugged :P
 
It could. It just wasn't programmed to try to win, but rather to play like a nation (without the knowledge that there is even a victory condition). Oddly enough, this was due to outcry from Civ2 players that felt the previous system was too gamey.
 
Yup, that's right.

Which is why allowing the AI to link triggers in the world to its own actions (which can be macro or micro in nature) is so important for the success of AI modding in Civ 4.
 
I had a longer post on this subject ages ago, but the short version is that it's impossible to provide that kind of AI given the developer resources available compared to the player tactics that will develop. Essentially, the fanbase will always devote more "resources" (time, thought, etc.) to beating the AI than the developers can possibly afford. And a "learning" AI would be even harder to develop.

What could be put in place, however, is an AI system a bit more robust than simply scripting the AI. (For all I know, some variation on this may be in Civ4, since the programming demands are very modest.)

The AI should have multiple, semi-random AI routines to pick from, based on some basic situation (itself governed by a script that modders can change). The fan sites and/or Firaxis should host a place to submit, organize, and rank such scripts, making it easy for even the casual user to get updates. (This could be as involved as the online roleplaying updates, checked when you "sign in" or as simple as including the top 20 or 50 or 100 scripts in each patch.)

For example, say the basic game comes with 3 AI routines for planning a tactical attack on a city (dumb, average, and smart). This routine doesn't care about grand strategy at all. The higher level AI routine simply says, "Take Nottingham, using these 3 swordsmen, 1 horseman, 1 catapult, and 1 spearman." The routine does the best it can under those circumstance (perhaps even responding back, "No way, Jose!". :)

Now the fan base writes a bunch of alternate "take a city" routines. Some of them are better than the basic ones. Some of them are simply unorthodox (and thus interesting). Some are even deliberately substandard, for occasionally handicapping a run away AI. You might even see some that include outside circumstances appropriate for certain mods (e.g. a chance for the force to defect if the odds are suicidal.

The higher level strategic AI can be affected by some of these simply by how it picks. (Maybe every tactical AI routine has ratings for competence and predictability.) So if I download the new tactical routines, even if I don't change the strategic AI, when it decides to go for "smart" or "unorthodox", I'll get different game play.

Now, that's fine as far as improving the AI. But we still have the "race." The race is between the AI modders in the community and the fanbase, so we have more parity. But anyone that stays on top of what the modders provide will still feel unchallenged by the AI. That's were the multiple AIs comes in. With multiple grand strategy and short-term strategy routines, coupled with many tactical options, that change by both opponent and over time in the same game, it gets much harder. A quality player might recognize that an "Arathorn 3 prong attack" is happening, but not until it starts. And each prong might be carried out differently.

And of course, that's only discussing military so far. Certainly, workers using the best player written routines would be formidable--so much so that we'd probably like for at least a few of the AI's to use a substandard routine. :)
 
Frankly id be happy to play the original Civ1 if they just had a decent AI and a more useful diplomacy interaface to interact with the AI. Even in civ3 the game is just not fun anymore after you've played it awhile. The only thing increasing the difficulty levels does is simply give the AI more of everything, it doesnt seem to make them smarter any. To this day if one of my cities is about to get taken over i just surround it with workers. The computer is so fixated on taking those that it gives capturing them priority over taking my city. Dumb things like this. Im not an computer programmer so i dont know exactly what is involved with making a good AI, but with 2 Ghz computers now the norm, id think they could do something to make use of all that computing power to put in a good AI. I mean the computer cant even attack right. You dont send tanks single file to attack someones capital. First you move your infantry in on a hill 2 squares away, gather the tanks there, pound the city with some artillery first and then have the tanks attack. I dont believe with the computers we have today they cant make an AI who is at least able to figure this out. City placement is another example of the AI at its worst. When theres plenty of land to go around theres no need to have every city overlapping 4 or 5 tiles.. I never understood why the AI does this.

So you see my point. A smarter AI with more advanced diplomacy would be nice a start for civ4. Simply things like a diplomacy option to say "Hey im reseaching this,, why dont you research that and then we'll trade." Or even other things like "Hey id like to put a settler and town in the area of square number ####, (some unoccupied land, but maybe his settler is already there) ill give you 300 gold for permission to build there." You get my point. I understand that the hardest part of the programming would simply be making a smart AI that can determine if what your proposing is worth it or not,, but at least they could give it a try.... Anyone elses thoughts on this?
 
Back
Top Bottom