Coding an AI player

There are definitely those who would consider 'an AI opponent capable of playing the game' to be a 'must have.' That's sort of my point here. That having these games on the shelf that do not have that particular 'must have' included in them may be creating a market for such a thing.

By "must have" I mean aspects of the software that need to be finished for it to perform its expected functionality. So in the game of Civ it basically means the bare minimum you need for someone to be able to play a full game. So obviously you need a programmed computer opponent to play against for that, but it doesn't have to be amazing
 
By "must have" I mean aspects of the software that need to be finished for it to perform its expected functionality. So in the game of Civ it basically means the bare minimum you need for someone to be able to play a full game. So obviously you need a programmed computer opponent to play against for that, but it doesn't have to be amazing

I'm a little jaded right now because I just came off a SMAX bender. The SMAX AI is totally incapable of using, or defending against, air units...which basically means a human player that doesn't get eliminated before they are able to produce air units will pretty much break the game. I'd call that a failure to provide expected functionality.
 
Sure, but the game works, doesn't crash, and so on. They probably left air units strategy until the end and ran out of time

Why do I remember that game being so good btw? And isn't it SMAC?

SMAC is the original. Add the Alien Crossfire expansion and it becomes SMAX. And yes, it is a great game. If you consider "it isn't meant to be a war game" and self impose some sort of limitations that will prevent you from waging war on the AI (since they are totally incapable of playing a war game) it's possible to see what a great game it is.
 
Is this unability to deal with air units specific to SMAX ? I never played it (only SMAC) and I don't remember anything especially broken, but it's been a long time ago and the specifics are pretty blurry.
 
Is this unability to deal with air units specific to SMAX ? I never played it (only SMAC) and I don't remember anything especially broken, but it's been a long time ago and the specifics are pretty blurry.

No, they are just as incompetent in SMAC. It's possible that you just never opted to use air power yourself, for whatever reason. If you don't use air power yourself the breakdown is less noticeable, but it's actually still there. It's like the AI knows that air units are ultimate power, so it will invest in producing them in huge numbers and cripple its economy in the process...but it doesn't actually know how to use them so the entire investment just pours down a well.

Meanwhile a human player with a handful of needlejets can cut any AI to pieces, even if they have otherwise superior weapons and a gigantic production advantage.
 
In many Civ games that is something I noticed as well, although maybe not to the same degree (although like I said I can't remember SMAC AI being bad at air units, but it was a long time ago)

Computer AI will produce lots of units but then they will suck at using them well. I really wish sea invasions were improved in Civ, the AI never knows how to do that properly. So if you're on an island it's a lot easier to defend
 
AI invasions in CivIII (and CivII,CivI was even worse) consisted of stacks marching, while they had very inconspicuously built-up in your border for some time... Ie the human player would be seeing those coming, particularly when (as was mostly the case) the up to then neutral AI was on the other side of the continent and just sent 40 units to your border bypassing various other AIs and declared war as they reached :lol:

That said, in civII the AI only did small skirmishes, iirc, and in civI the AI was so broken that your ally would send his units to surround your city, which meant you could not move anything out and in the end had to declare war so as to move :D

At least in CivIII there was real chance of you being overwhelmed by the massive enemy stacks. Although the AI didn't know how to choose a reasonable point of attack, so would die while roaming the fields, and never sent navies to create a second front either*. In fact this complete and utter inability of civIII AI to have a two-front war was very underwhelming.

*AI would land some units by ships, but apparently ONLY if it was attacking islands. Never as a tactic to open a second front.
 
Last edited:
This all very interesting from a theoretical standpoint, but as someone else said earlier, people don't really enjoy playing vs AI that behaves like a human and makes the "right" moves. I believe for most players civ is a solo experience. Remember in civ5 how they got rid of diplo modifiers and made the AI more human like in that they would appear to randomly declare war on you? People hated it and it was patched, and even though they didn't bring back +1 modifiers, they started to show reasons why the AI did or didn't like you. But they got rid of the parts like hey you have a weak city let me just go take it, like a player might vs an AI. Cus that's not fun, you want to AI to stay in their little box for the most part.

In civ4 too you have a huge issue with balance if you make a truly good AI. I guess you'd need to play at warlord or prince level every time? It would make typical emperor+ games impossible if you couldn't exploit diplomacy modifiers, tech trades and combat to your advantage because the AI has such a huge production advantage at those levels.
 
In civ4 too you have a huge issue with balance if you make a truly good AI. I guess you'd need to play at warlord or prince level every time? It would make typical emperor+ games impossible if you couldn't exploit diplomacy modifiers, tech trades and combat to your advantage because the AI has such a huge production advantage at those levels.
The entire point of difficulty levels is to compensate for lacking AI, so no it wouldn't be "a problem", it would be FIXING the problem.
Also, if the AI would be competent enough to make today's Emperor+ game impossible to win... the Emperor difficulty level would simply be tailored with lower bonus, and today's bonuses would be simply considered ridiculous and not needed ? I mean, it's not like you see people complaining that it's impossible to win against a non-existent difficulty level giving 5000 % bonus to AI because in another dimension Civ4 AI was so bad that Deity difficulty level would requires it ?
 
Yes but we're discussing an external AI so you can't lower their bonuses or change civ4.

All I'm saying is civ series in general is designed around not having great AI or at least having AI the player can exploit in some way. If you change that it's a ripple effect that changes the game a lot, maybe in undesired ways.
 
I 100% disagree that Civ is designed around "not having a great AI". I think you are trying to say here that Civ is designed so that the human player learns the exploits so that he/she can use them to his/her advantage, become better at defeating computer players, and then next time playing at a higher level of difficulty. That is not a design choice, that is just a sideeffect of the AI being coded this way.

I also 100% disagree that most Civ players do not want to play against AI that plays more like a human. That would be amazing! While some people might approach the game from a "Ok let's figure out the AI and strategy exploits so I can quickly move up to the next level", that isn't the only way to play. Most players would probably welcome more unpredictable (yet logical) behaviour from the computer players. Sure, in some cases it doesn't work, but that doesn't mean that we don't want more realistic opponents. I think most of us do. I enjoy a game a lot more if there is a bigger illusion of the computer opponent being sentient, as opposed to a machine-like automaton. And I think a lot of gamers would agree with me.
 
Yes but we're discussing an external AI so you can't lower their bonuses or change civ4.
Most people pointed that "external" AI was simply not manageable. It's at best about altering the AI (which, actually, can be done in Civ4 IIRC).
Anyway, it's still exactly the same thing : if the AI is good enough to make the highest difficulty levels impossible, well what's the problem ? It means the lower difficulty levels are enough and more interesting (because it's much better to fight on even ground than to have to use exploits to compensate for bonuses). How would aking some difficulty levels obsolete because the game is improved be a problem in any way ?
All I'm saying is civ series in general is designed around not having great AI or at least having AI the player can exploit in some way. If you change that it's a ripple effect that changes the game a lot, maybe in undesired ways.
No, it's not - or MP would be completely broken. The game has rules, the AI has limitation, and the difficulty levels are a way to compensate (which is pretty inefficient and inelegant, but the only one available).

A better AI is never, ever, ever, ever a problem.
Ever.
 
AI playing like weak humans isn't much fun to code, and a lot of people don't play MP because they expect to win the majority (or all) of their games rather than a number inversely proportional to the number of players in the game.

Civ5/6 in large part got good reviews because of all the free stuff the game gives you on the way to an easy win.
 
Surely if we ever get Civ AI that's so good that it's impossible to beat it at certain levels, they'd re-balance the difficulty levels so that the impossible ones aren't even an option.
That was exactly my initial point ^^
 
Surely if we ever get Civ AI that's so good that it's impossible to beat it at certain levels, they'd re-balance the difficulty levels so that the impossible ones aren't even an option.

Not sure if there is even any decent AI in civ games, though? Eg going from the games i know, in civIII any harder difficulty than monarch (deity etc) is the same AI but with cheating bonuses given (eg it costs less for it to build the same unit, or its terrain tiles produce more stuff etc).
 
I think it's really important to keep in mind that not everyone thinks of the same thing when they say they want the AI to be better or be "more like a real person". For different people, it could mean:
- they want the AI to just play better competitively
- they want the AI to behave more like a real person, including everything else you would get in multiplayer (like irrational animosity or friendship, blunders etc.)
- they want the AI to more realistically inhabit the role the game assigns them ("role play")

There is more tension between these points than you would think. Even absent any limitations in AI capabilities, I have heard interviews with four lead designers from the Civ series that acknowledged the problems that people expect their AI opponents both to make them feel like they are playing a game about history, but also to provide opposition and try to attempt to win the game. Usually the AI would more strongly lean on the first in the early game and transition to the other for the late game.

Even then, some AI behaviour had to be explicitly prevented. For example, the AI would usually dogpile on the human player if they were set to win the game otherwise (which is rational). This had to be explicitly prevented because players found it frustrating, especially coming from long term allies.
 
AI playing like weak humans isn't much fun to code, and a lot of people don't play MP because they expect to win the majority (or all) of their games rather than a number inversely proportional to the number of players in the game.

Civ5/6 in large part got good reviews because of all the free stuff the game gives you on the way to an easy win.

Yes that's exactly my point. Majority of civ players want to win every time, don't want an opponent that can attack them any time they see a vulnerability etc. They want a predictable single player experience. Maybe most in this thread don't, but I contend the majority of the player base does.
 
Back
Top Bottom