Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site forums as they ran on Ultimate Bulletin Board, 1998–2001. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 2005 site & forums

  Apolyton Civilization Site Forums
  Civ3-General/Suggestions
  Arguments why its nearly impossible to program an "almost human" AI. (Page 2)

Post New Topic  Post A ReplyPost A Reply In A New Window

This topic is 2 pages long:   1  2  profile | register | preferences | faq | search next newest topic | next oldest topic bottom of page
Author
Topic:   Arguments why its nearly impossible to program an "almost human" AI. Format for Better Printing
pchang
King
San (tres cher) Francisco
Aug 1999
posted January 10, 2001 17:44   Click Here to See the Profile for pchangClick Here to Email pchang  send a private message to pchang
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
However, there are ways to supplement real AI programming that w/ scripts which can yield more effective game play from the computer. Certain parameters can trigger the execution of scripts (It appears clear that CTP and CTP2 utilize this to some extent). These scripts are preset procedures for accomplishing specific tasks which take precendence over other AI activities. Such scripts could be used to load up and land full invasion forces, or settle and expand in new territory (one way to program the computer to use ICS). However, the scripts need to be created by experienced, high level players. The problem with most game programmers is that they are to busy programming to be really good players.
Ralf
Prince
Sweden
Mar 2000
posted January 10, 2001 18:08   Click Here to See the Profile for Ralf   send a private message to Ralf
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
I basically agree with what you saying in your post, Pchang.

However, heres an idea that could help Firaxis get around the whole AI-settler path-finding problem. Im not 100% sure if its doable in practice, but It would be absolutely great if it was.

Never mind the title - this post quickly turns into something else further down: ../../Forum6/HTML/002067.html

Any comments?
[This message has been edited by Ralf (edited January 10, 2001).]

pchang
King
San (tres cher) Francisco
Aug 1999
posted January 11, 2001 17:23   Click Here to See the Profile for pchangClick Here to Email pchang  send a private message to pchang
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
My idea for optimal city placement is the following:

Default method:
Each terrain square has a point value based on its resources.
Squares already in a city radius have a value of 0.
The city placement value comes from the sum of all the squares in a potential city radius.
Computer places city on square with the maximum value.

Script method:
Some trigger activates a specific script. Examples -
survival mode - activates ICS-like settler creation and city creation
bottleneck mode - activates city creation on geographical bottleneck for defense
etc.

RGE
Settler

Jul 1999
posted April 18, 2001 07:54   Click Here to See the Profile for RGEClick Here to Email RGE  send a private message to RGE
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
If Civ 3 is going to use the same type of units as Civ 1&2 and SMAC, I think one necessary improvement would be to code the AI to use those units to accomplish goals rather than just having them follow their own algorithms.

For instance, when trying to conquer a city, the AI should first run a check to see which units are availible for attacking that city. Then the AI should see which one attacker will have the highest power compared to the best defender (after taking movement into account). Then compare the second highest powered unit to the next defender, and so on, until the city is empty and ripe for conquest by the last military unit within reach (preferably a wounded or defensive unit). If the AI units loose too many battles for the AI to be able to conquer the city, it's time to retreat.

If the AI doesn't have enough units, or if the present units are too weak to stand a chance, those units should move to a tile with a better defense bonus while waiting for reinforcements. In order to keep units from dancing back and forth (half of the army is heading for the hills to wait for reinforcements while the reinforcements are in the hills), it might be necessary for the AI to take two turns of its own movement into account when determining which units to move to which tile.

One pretty smart thing that the AI is already capable of is to have a weak unit taking cover behind a strong unit, such as the barbarian leaders who always hide behind their troops. This is how strong offense/weak defense-units should behave; catapults and cannons should hide behind phalanxs and musketeers. The AI should only allow a unit to move within strike distance of an enemy unit if the enemy won't have enough power to win reliably should it attack. The only exception to this rule would be if the AI had so many units that it can afford to take such losses during an assault on a city, but then the AI should count those units as dead before calculating the final chances of a successful conquest.

If the AI isn't building or sending reinforcements, the army should either pillage until destroyed, or retreat if there's a city close enough to make it worth the trip, comparing the loss of upkeep to the value the number of shields the units would give when being recycled.

If the army doesn't stand a chance due to city walls or other defense improvements, the AI should send diplomats or spies to sabotage those improvements. In fact, if the AI knows that it has to conquer a city with walls, it should always include enough diplomat units to make it likely that those walls will fall before the army attacks. Because I do that, and usually it's the only way to take a city.

The same idea should be used when the AI tries to create a beachhead for an invading army; there's only a point in doing this if the AI can muster enough units to take a city in one turn. Preferably the AI should search for easy targets once the fleet is getting close to the enemy coast, and if none can be found; land the units on terrain with good defense bonus and have them wait for reinforcements. Not to mention that the invasion army should contain enough defensive units to defend a city once it's been taken.

Huge armies should also bring settlers/engineers that can build fortresses where the army can defend itself. The AI would be able to tell how long it will take for reinforcements to arrive, and how long it'll take to build a fortress; if there is enough time to build it, it's worth the effort. The AI should never build fortresses in its own territory though, unless it's needed for AI units who are fortified to defend from invaders. In such cases fortresses should be torn down by that unit as it leaves for more important duties. Or, as an alternative, have it automatically torn down a set number of turns after its last defender has left.

RGE - if only I found programming to be fun

Simpson II
Prince
varies
Jul 2000
posted April 19, 2001 06:17   Click Here to See the Profile for Simpson II   send a private message to Simpson IISend a Message to UIN: 92982763
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Ralf,

Eh, I don't think the problem with settlers is the pathfinding. Pathfinding is actually pretty good in Smac, probably a basic A* algorithm. The problem with settling in Civ is that it's done basically at random. The problem with settling Smac is that it isn't. The AI sends pods 30 or 40 tiles to build on a landmark, which is kinda dumb, even with it's native-life combat bonus. And it's entirely the fault of dumb programming, not fundamental AI limitations.

Mostly, what needs to be done in CivIII is to fix bone-headed decisions like the above, which are made simply because the programmers are not terribly great strategy gamers.

Ralf
Prince
Sweden
Mar 2000
posted April 19, 2001 13:55   Click Here to See the Profile for Ralf   send a private message to Ralf
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

Originally posted by Simpson II on 04-19-2001 06:17 AM
Mostly, what needs to be done in CivIII is to fix bone-headed decisions like the above, which are made simply because the programmers are not terribly great strategy gamers.

I think you have a totally different playingstyle, then I have. This is why we have such different viewpoints on the importance of a better AI-city placement strategy & pathfinding, then in Civ-2/SMAC.

Consider this:

On two identical big-sized twin-islands far away from each other, with a good perfectionist/expansionist style human civ-player on one island, and one AI-civ on the other island; the human player near the end-game, is most likely to...

- have 95%+ of all available good fertile tiles under some city-area influence.
- have some deliberate city-area overlapping in order to maximize number of cities on a given island-area.
- have as many coastal cities as possible in order to maximize the number of potential inland tiles left to be exploited by inland cities.
- always avoid or have as few unproductive/less productive tiles, as much as possible.

The alone AI-civ one the other identical island however, is likely to have...

- only 50-70% of all available good fertile tiles under some city-area influence.
- either too much overlapping, or AI-cities too far appart with too many wasted tiles between city-areas.
- rather few coastal cities, with less potential inland cities left as a consequence.
- less efficient distinction between productive and unproductive terrain-tiles.

Now, since the ICS-problem is going to be combated in Civ-3 by some rather expansion-restrictive methods compared to Civ-2 (empires above 50+ cities perhaps not practically possible - read my last reply in Poll 20: Settler vs Public works), its pretty important that Firaxis do some radical AI pathfinding/ city-placement improvement in Civ-3, compared with the weak one in Civ-2 and SMAC.

By the way, have you actually read this thread in its whole, and perhaps Should the map-generator be scrapped? link before you answered? Its not that you must, of course. I was just wondering.

[This message has been edited by Ralf (edited April 21, 2001).]

SerapisIV
Prince
Ann Arbor, MI, USA
Feb 2001
posted April 19, 2001 14:50   Click Here to See the Profile for SerapisIV   send a private message to SerapisIV
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

Originally posted by Simpson II on 04-19-2001 06:17 AM
Mostly, what needs to be done in CivIII is to fix bone-headed decisions like the above, which are made simply because the programmers are not terribly great strategy gamers.

Thats a pretty harsh statement, one that I totally disagree with. If you spend years of your life programming civ-style games, you're gonna be pretty good at playing them as well. And while you ***** about the programming, lets keep in mind that the Civ series has had the best balanced and AI of any similar game, I don't see many people lauding the CTP programmers. Programming isn't gonna be perfect, buy the very existence of deadlines, it would be impossible to be perfect. If you think that programmers aren't good strategy players and that you are, go ahead and program your own AI. If you can do better then you can talk $hit, but until we see some of you AI programming, I wouldn't start the OT name-calling crap in here. Especally with people we're relying to get out a good product for our benefit.

ChrisShaffer
Warlord
Chicago, IL, USA
Aug 1999
posted April 19, 2001 23:36   Click Here to See the Profile for ChrisShafferClick Here to Email ChrisShaffer  send a private message to ChrisShaffer Visit ChrisShaffer's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

If you think that programmers aren't good strategy players and that you are, go ahead and program your own AI. If you can do better then you can talk $hit, but until we see some of you AI programming, I wouldn't start the OT name-calling crap in here.

While I agree that name-calling is in poor taste, it's an unfortunate fact that all previous Civ (and variant) games have not allowed players to design an AI. I, for one, would be thrilled to see Firaxis make the AI code open source, or at least let us have more access to the fundamental building blocks of AI thinking. Until Firaxis gives us this capability, suggestions like "go ahead and program your own AI" are pretty meaningless.

Simpson II
Prince
varies
Jul 2000
posted April 20, 2001 08:52   Click Here to See the Profile for Simpson II   send a private message to Simpson IISend a Message to UIN: 92982763
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Well, sorry all, I didn't realize that The Sacred Ones were to be held in The Highest Reverence on pain of eternal flaming. I'm not totally sure how calling someone 'not a terribly great strategy gamer' became name-calling, either, though if anyone was offended by it then I'll certainly apologize to them.

On the other hand, I don't believe that I said anything basically incorrect. Unlike me, the Civ/Smac programmers have the tremendous strategy gaming disadvantage of being people with lives. My fairly extensive observation of the Smac AI (from creating factions, and watching how they perform) has shown problems with the AI which no good Civ-player would ever have induced; behaviour which actually must have taken trouble to program, but which is plain wrong. That's aside from things which could have ben programmed easily in a couple of days, but which would have made the AI far stronger.

I have programmed AI, to a limited extent; I have an ongoing project on a chess AI, and I've done a strategic AI for Age of Kings that is not too bad given the limitations of the tactical AI (it whumps the standard AI hard, as well as the tournament-winning custom AIs which I've tested it against. ) If I ever get my hands on the code for civ or smac (probably vain hope) I'll definitely have a bash at creating a decent AI. I may even do some work on FreeeCiv when I get Linux installed again, though more likely it'll be whenever the C++ version is done. The FreeCiv AI is supposedly quite good at the moment, though, since they taught it to ICS effectively, do proper marine assaults etc.

Ralf,

Yeah, I had read pretty much all of both threads. I totally agree with what you say about what the AI does, and what a decent human player will do in civ. In fact I'd say you're pretty generous towards the AI. We just disagree - in a small part - about why it happens, whether pathfinding is at fault.
In civ the pathfinding was, frankly, terrible; somehow I doubt they looked at any texts on the problem, it must be some sort of homebrew algorithm. However, in Smac pathfinding is actually very good The AI finds it's way around quite effectively (a bit too effectively, but giving it the map does make things a lot easier for the AI programmers, so what the hell.) The issue is the choices it makes in city placement. There are two problems which I can see;

1) Locations are selected (semi-at random?) according to how attractive they are, but not enough attention is payed to their distance from the place they're produced. In reality it's virtually always better to place cities close to the place the settler was produced.
2) City placement appears to be decided on a unit-by-unit level. For a laugh, play a game where all city governors are on and all units are automated as they are produced. What happens is virtually indistinguishable from the AI's behaviour! I strongly suspect that, in large part, that is the AI.

So, overall, pathfinding for settlers is a small to non-existant part of the issue for Civ3.

Your ideas would certainly fix the problems above. An overall city-placement routine which directs settlers to an appropriate spot should fix it, too, IMO. It wouldn't be too complex. Placing cities in a grid or holey grid is close enough to optimal to compete with almost all players. In fact, in Smac it pretty much was optimal! It would, in principle, still allow pre-made maps with AI city-locations mapped out, while still functioning on random maps.

Edit: for an ultra-simple expansion strategy which beats the CivII AI's, go here. If you haven't heard the news then you definitely need to!
[This message has been edited by Simpson II (edited April 20, 2001).]

ChrisShaffer
Warlord
Chicago, IL, USA
Aug 1999
posted April 20, 2001 15:59   Click Here to See the Profile for ChrisShafferClick Here to Email ChrisShaffer  send a private message to ChrisShaffer Visit ChrisShaffer's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

I'm not totally sure how calling someone 'not a terribly great strategy gamer' became name-calling

I think people were reacting to the use of the term 'bone-headed', actually.

Ralf
Prince
Sweden
Mar 2000
posted April 21, 2001 05:24   Click Here to See the Profile for Ralf   send a private message to Ralf
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

Originally posted by Simpson II on 04-20-2001 08:52 AM
Your ideas would certainly fix the problems above.

Thanks! Finally I get at least some recognition for my ideas. With few exceptions, I mostly been fighting an uphill struggle when it comes to getting people to understand the need for premade user-tweakable AI-build lists, and also the need for a revamped AI-city placement methods, with all potential AI-city placements already invisibly layed out (like yet unlit red diodes that punctures a electric standalone touristmap - you know; the kind that you can find on most big city railwaystations), in conjunction with the map-generation.

On which potential/invisible AI-city location (or unlit red diode) each AI-civ chooses to build its first capitol city, may very well be totally random as long as the starting-locations are reasonably far away from each other. Also, in which direction each AI-civ chooses to expand may also be random, or then they start to get contact with each other; according to varying non-foreseeable in-game factors.
It is however, then Civ-3 scenario-creators starts to make use of potential AI-city placements on their own maps, that this idea really showes off its advantages. Suddenly the Civ-playing scenario-creator gets a whole new time-dimension under his fingertips. Not only can he now exactly pin-point ideal potential AI-city locations (and distances between them): But he can also determing how each AI-Civ should expand into map-sections thats not yet uncovered in the beginning of the scenario - if they want to have that control, of course.

Imagine the scenario-creating possibilities that this idea can create.

quote:

An overall city-placement routine which directs settlers to an appropriate spot should fix it, too, IMO. It wouldn't be too complex. Placing cities in a grid or holey grid is close enough to optimal to compete with almost all players. In fact, in Smac it pretty much was optimal! It would, in principle, still allow pre-made maps with AI city-locations mapped out, while still functioning on random maps.

Well, it all comes down how much work the AI-programmers at Firaxis are willing to put into it, of course. As long as it good enough to compete with most players. But, I still think they should do something drastic about those disadvantageous figures in my previous post.
And Civ-3 is pretty AI-demanding as it is, so the more map-analysing and AI-city placements calculation that they can squeeze in in conjunction with each map-generation, instead of between turns - the better it is.

[This message has been edited by Ralf (edited April 21, 2001).]

Radagast
Settler

Apr 2001
posted April 22, 2001 23:30   Click Here to See the Profile for RadagastClick Here to Email Radagast  send a private message to Radagast
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
If this has already been mentioned in the thread, let me know and I'll go back and read the relevant sections....i skimmed it but haven't read every post or word.

A lot of the time when people talk about better AI, they seem to mean "smarter AI" (e.g. "Napolean-like tactical brilliance"). However, I do not see that this is necessarily an improvement. My problem with AI in strategy games is not that it makes BAD moves, but that it makes PREDICTABLE moves (of course, some of the bad moves are a result of a formula that doesn't fit well with an odd situation). But what I relish about playing human opponents is not only their technical and tactical ability, but their quirkiness and occasional howlers. There is nothing so satisfying as waiting for your opponent (especially a good one) to make a mistake, and then dissecting him/her along that fault line. Of course, the same happens to you too . Someone early on said in this thread that what makes humans different from AI is that we have a bird's-eye method of sorting options in which we exclude (possibly not even consider) hundreds of untenable or bad options. Of course, the flip side is that each person has a slightly different birds-eye view, and LOOKS for slightly different salient features/information upon which decisions will be made.
The problem with AI is that often it seems that (especially when one is winning) the game devolves into a sort of war of attrition, where the human player figures out what area to ever-so-slightly outpace the AI in, then (programmitcally) build that strength up and slowly wear the AI down. But wouldn't it be fun if the computer switched strategies, made a stupid mistake, or just did ANYTHING a little odd now and again? Of course, oddness cannot be programmed by its very nature, but maybe mimicked? A few suggestions/questions:

1. Is it possible to set up an AI that will (a) weight certain factors over others, maybe not the BEST factors, but just certain ones, and that (b) from time to time changes its selection of important factors (quite possibly based upon earlier successes/failures). I am NOT suggesting a "learning AI", but rather one with several (10? 50?) "personalities" that will weight different things differently. Failure or success (relative to the AI's opponent(s)) can be checked, and then, if the AI player is doing poorly, a different strategy can be chosen. E.g. if the AI player is falling behind, and is ESPECIALLy far behind in research, a new "personality" could be chosen that weights research and tech possibilities/opportunities, and pays less attention to production. Of course, there is nothing like success to make us complacent, and a successul personality would more likely remain at the helm (of course, this would mean that the burgeoning empire, which got ahead in, say, research, would keep getting further ahead; a good thing, but as human players find the weak spots ignored in the quest for technology, the once mighty empire could (maybe) be cut down by its Achilles' heel). Maybe instead of relative strength, switches or modifications to personality could be tied to relative growth (a weak, but rapidly growing AI player, should continue with the same personality, b/c if growing more rapidly than humans, it should be able to catch up soon). This would go some way toward a more malleable opponent, one that changes in unpredictable ways as the game goes on. Even an occasional personality-switch by a large opponent (a low-prob event) would be interesting---even if random. Consider: you're being mercilessly attacked by a superior player, and they are getting close. All of the sudden, the attack stops, they ask for peace. Granted, the AI may have done this randomly, and without real reason, but it could mimic the human player (ever chatted after a game with a human and said, "you could have destroyed me if you'd have just gone a step further," and they slap themselves, saying something like, "i thought you had a MUCH bigger force stored up at your base...." "nope, I had ONE unit.." "DOHHHHH!!"

Radagast
Settler

Apr 2001
posted April 22, 2001 23:42   Click Here to See the Profile for RadagastClick Here to Email Radagast  send a private message to Radagast
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
oops, hit send by accident. so i'll take it as a sign and finish up:

My main point: while the AI in the above example did not THINK you had a bigger force, or have any reason for stopping the attack, it LOOKED like it thought it did. Of course, this is still deficient (if it happened to me against a real human, i might be able to figure out his/her mistake and milk the deception for all it was worth).

Another way of saying this: there is no way to program the AI for a BEST strategy, since there are no best strategies. Many people THINK they have the "best," and act like it (and are often taught otherwise), but if there was one best strategy algorithmically speaking, then in any argument, one could make a demonstrative argument for it. Then the game wouldn't be much fun anymore, since eveyone would just follow it.

Of course, I know snot about AI, so something like the above is probably either impossible or has already been done.

One last bit: how about a modular central AI program, that would allow small patches at later dates? The idea being that as players discover good strategies (either in SP or MP games) that were not anticipated in the design stage, the designers could update the AI to include these:

Player on forum: "Hey! lookie what I discovered I can do with this lowly engineer!! Who'd have thunk it?"

Sid and friends: "Hmmmmm, maybe we should have the AI do that too...."

Dominant strategies in strategy games often evolve (read back through BBS!), so why not let the AI reflect it?

Of course, a great idea IMHO, but the main problem is that there is little incentive for producing such new AI modules (unless the central program was designed so that the modules could be relatively small, and then maybe sold over the net for low-cost ($5? $9.99?).

Urban Ranger
Emperor
The City State of Noosphere
May 99
posted April 26, 2001 12:54   Click Here to See the Profile for Urban RangerClick Here to Email Urban Ranger  send a private message to Urban Ranger
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Sure, it's entirely possible to do that, but the programming must be done in a completely different way.

Right now, the AI are hardwired into the game. Programmers play the game a bit, find out how to do things, and code the AI accordingly. This is a very dumb way of approaching it.

First, the AI should be heuristic, i.e., it learns from past mistakes. That way, it becomes stronger as more and more games are played.

Second, there is no need to hardwire the AI. Once the programming is done, just play against the AI many many times so it starts learning.

Third, playing style and difficulty level can be adjusted by modifying parameters.

Forth, conditions can be added to trigger scripts. This is done to a) further differentiate playing styles b) allow for user tweaking c) allow for easy AI updates.

Apolyton Civilization Site Forums
> > > Civ3-General/Suggestions Forum

This topic is 2 pages long:   1  2 
next newest topic | next oldest topictop of page

All times are EDT

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A ReplyPost A Reply In A New Window
Hop to:

Contact Us
Apolyton Civilization Site

Powered by: Ultimate Bulletin Board, Version 5.44a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.

AltaVista Type or paste text or Web address (beginning with http://) here:
Powered
by Systran
Translate from: 

Front Page | Civilization III | Dinosaurs | Civilization II | Call to Power | Call to Power II | Alpha Centauri | Alternative Civs | Misc | Links | About ACS | GameStats
GameLeague | Scenario League | HAC | Civilization Scenario Collection | Spanish CivII Site | Clash of Civs | CtP Maps | Art of War | WesW's Ctp1/2 Site