Ultimate AI

Arathorn

Catan player
Joined
Jan 10, 2002
Messages
3,778
Location
Illinois
Instead of spending hundreds of hours working on building a single great AI, why not spend hundreds of hours working on building a customizable AI? That way, different players can create their own AI algorithms/mods to change the play.

Requirements for a configurable AI:
1. Distributed -- that is, a different AI for city governors, one for workers, one for military, one for trades/diplomacy, and one for "overall" goals. The last is probably the most important. I would expect the last to control the earlier ones -- setting parameters and such.

2. Some long-term memory is required -- the overall plan, the situation, etc. A few hundred bytes for the overall AI to use to store what it wants to.

3. Default configurations for the default AI. This would be the standard that most people would play. It should perform similarly, overall, in quality and speed to Civ3's AI.

4. Moddable -- everything is externalized.

5. Triggers, scripts, etc. to allow for truly unique AIs.

6. Each AI civ is allowed a different AI configuration (this is like aggression level but goes WAY beyond that).



This is my "holy grail" or "white whale" or "Hilbert problem" for 4X games. If built from the ground up, it should be possible. And it would add immensely to the experience for all players -- from chieftain-level to sid-level.

Arathorn
 
What about a user option for a learning AI? One that would improve based upon the user's style of play.

Benefits - gives the user a more challenging, and thus presumably more enjoyable game
Drawbacks - could necessitate the implementation of a rather messy account/login/logout mechanism.
 
I specifically rejected the idea of a learning AI for a few reasons...

- As I understand it, it's MUCH harder to program something that learns than something that accepts scripts/algorithms/etc.
- Having AIs depend on the person makes for very difficult comparisons (tournaments) or game-sharing options (Succession Games and multi-player)
- Would not really allow for independent/unpredictable AI behavior.

I *think* my proposal is at least somewhat reasonable for a game. I don't think a learning AI really is. :(

Arathorn
 
well the AI could already know(in base to the resources and terrain) what type of civ it will become.

Anyways, this could be a perfect for multiplayer mode
 
I agree that something should be done to the AI. It seems like a good start there, Arathorn.

A learning AI is indeed something that is VERY hard to do, or probably impossible would be a better definition. You can make the AI learn your movements in FPS, but hardly understand the complex tactics in Civ. It would probably get screwed up real bad, as the AI would try to counter some nonexistent tactics while being totally oblivious to the real ones. It would probably be too predictable also. For example if I attacked via ships to the northernmost wasteland of AI for three times, would it then strenghten its defences there so I could just march straight in through the front door?

A learning AI is something that is more like sci-fi today. All learning systems follow some sort of scripts - it would actually be impossible to make a true learning system in PC. It would by my knowledge need systems based on semantic nets or some other system that is far beyond any binary-based systems. So let's put the learning AI aside, shall we?

The AI can of course be taught some ways to "learn" from human players' tactics. For example, if it notices that I have very little air-defence, it could build more bombers prior to any attack. It could also take advantage on some people's tactics of leaving the core cities almost undefended (as I often do in republic and democracy). It could for example build a lot of paratroopers or something like that. This I think should be done. Human players exploit the weaknesses of others, so should the AI. It shouldn't be too complicated to program the AI to check how many, say, oil-resources you have. If it notices that you have only a few AND they are in the perimeters of your nation (or, even better, in islands), it would launch its assault there. I do that, as then with one swift strike I can deprive my enemy of crucial resources.

As it is now, it seems that the AI has been taught something like this. It attacks where it thinks you are most vulnerable and it does not attack a fortified musketman in mountains with a swordsman. It also goes after your workers.

I have complained about the AI in the thread concerning the calculations the computer makes (in this same topic). Here I would like to make similar remarks. The AI should be able to calculate how long it will take your troops to get somewhere (if it knows their placement, if it doesn't, it can be programmed to make an educated guess), which should have a huge impact on its decisions. Let me shed some light on this with an example.

The AI notices that a city that is seven tiles away from its borders is left completely undefended. With the current AI it would start its march there. I suggest that the AI scans the area around the city. If there are a lot of troops there, it could easily calculate how many turns it would take them to get there compared to its own progress (it wouldn't differ from the current calculations of "go-to"-order). It notices that I have a well-defended city four tiles away with a road between those cities and quickly understands that it does not pay off to march there, as I would have defences there waiting for them (and probably could kill off some units when they were making the trip). As all my cities are defended (even though some may not have defenders IN them!) the AI turns on a different scan. It calculates a value to your cities. The value could be made up of its distance (a huge factor, most wars start on the border - the AI should need a real good reason to do otherwise), its size, its military strength and the military strength of nearby cities (if the AI has a spy, i.e.) and so on. I would endeavour to first take out the middle-sized cities. When the AI was in full strength, I would probably just kill off my units in assaulting 13+ cities. But I wouldn't also bother too much on conquering all the 1-3-sized tundra cities. This of course depends on the tech-difference between me and my enemy. attacking a 13+ riflemen-defended city with cavalry would be suicide. I would perhaps try to destroy the AI's stacks of doom and then bring some artillery into the fray.

All in all, the AI should be able to calculate these things in a blink of an eye. The scripts would be human-made, but the AI would try to exploit your weaknesses by scanning your civ and then deciding which of the scripts it would use. The problem with scripts is that the AI will do EXACTLY what it is told to do. It is indeed often best not to attack an army with a single unit, but with the AI this script results in my armies running completely freely capturing workers and pillaging resources.

Some sort of intelligent system could be simulated with point-system. Some things give positive points and some negative and the points would vary in relation to each other. The system would be somewhat complex (as it would have to be), but totally moddable and customizable. Let's say that the AI rates it 15 points that you have only one oil (other resources could be of less consequence and could change according to current tech level), and decreases 3 points for every turn it would need to travel across your territory to get there. So my only oil in three turns would be valued 6. Some scriptures could reduce the number if your allies have excess oil and if the oil is heavily defended. Then it should be easy to change the values if the AI would never invade your oil or would do it too often. The oil-patch's distance from your other troops would be a big factor - thus the AI would almost certainly invade your oil-island if it didn't see many defending units there - exactly as I would do.

Your suggestion of multiple AI's would be appropriate. If would be easy to lessen that value of AI's military advisor if it was too bloodlusty or something like that. And then you could change the values inside the military advisor. The memory would also be good. It would value somethings that happened in the past way into future, but the impact would lessen. Much like the AI attitude now.

The exact formulation of this is of course still foggy. But it's not our business to create the AI (I'm no programmer, mind you!), but give ideas. This is my idea. I think it would result in full moddability, implement some "learning" (as the memory) and would take a better use of computer's calculating powers.

What do you guys think?
 
Would this be playable 'out the box' for people who don't want to/don't have time to programme a custom AI?
 
Of course the AI should be fully programmed in the first place. The moddability would only be for those who would like to mod it. There would be no point in forcing people to mod their own AIs!

EDIT: I only meant that if the AI system would be done up this way by the game-designers, it would also allow modders the possibility of relatively easy access to AI-configuration. This is comparable the what we have in graphics now: the possibility to mod your own graphics has nothing to with the game having its own graphics. You could of course then download modded AI's from those who have had the skill and the energy to mod them.
A good and important question, though!
 
Exactly like Shyrramar said. Modding the AI functionality would be an option available like modding the graphics, the tech table, or anything else.

It would add a whole new way to flavor the game. I think the idea is very good. I just don't know enough about AI programming to know its feasability.

Civ3 has the very base beginnings of this with "build often" type orders and AI aggression levels and government preferences, but that's not enough. Much more ability to customize could be a defining characteristic.

Arathorn
 
Only a small fraction of the people who buy Civ 3 ever mod it in any way. Only a certain percentage (~20%) ever even patch it. Once.

As much as I would love a customizable AI, because of that reason it's not practical to have that system over a "single" more robust AI.
 
@Trip: the AI would be better. This is the idea. Moddability is just bonus, not the whole idea. Making AI use points in its decisions would make the AI whole lot better than just scripting. Just because the AI distastes spying, it shouldn't declare war for the sake of principle if it would surely lose.

Making the AI fare better with allowing it benefits humans can't get while penalizing humans is not the way to go.

I do agree moddability is just a flavor, but I think it has a very profound impact on the lifespan of any game.
 
Whether we like it or not, the Civ series is a mainstream genre of games. Being in that category means that there are certain critera that each new game has to meet.

Any time spent on coding a script engine instead of straight code is time that could be spent making the AI better as a whole. Just because you start with the concept doesn't mean it doesn't take time. If you spend the time, sure, you end up with a customizable AI, but you also end up with an AI that doesn't know how to manage its citizens properly, or how to launch an invasion successfully, or how to the number of other things you can't really "customize" in a scripting language... the AI is either good at it or it isn't.

The more options available for customization the fewer other things it will know.
 
@Trip: I understand your worries. I am simply making a case that is NOT supporting customizable AI, but suggesting a way AI could indeed make better invasions. The Point here is that scripts can NEVER understand the situation in the game. AI is scripted to attack a city that is undefended. Fine. That should be intelligent - if the city was nearby and actually didn't have defenders. If I have railroads, the city should be invaded in one turn - otherwise the attack on the undefended city is simply stupid. Same goes for the scripted AI principle that it never leaves its cities undefended. It should. If attacking with your last unit does in effect give better chances of winning that defending gives, the last unit should attack - if there were no units that could invade the city in one turn. Distance should be a factor to AI, which it is not now. It happily travels 50 turns across other civs' terrain to settle ONE city somewhere in the middle of another civ's territory that happens to be noncultured. That's just plain stupid. With scripts it is hard to implement the idea of distance.

True AI is nowadays mostly made by artificial nets that give different amount of (what's the word) emphasization to different threads. This way the AI in question will act on the idea that has most support. This way an undefended city is a big plus, but distance affects negative - so that if it is far away the plus is disregarded and some other action is taken.

Wartime would give a boost to "military advisor" whereas being left behind in science would give a boost to "scientific advisor" and so on. This should also result in transports that have lost their escorts to actually run away instead of acting like sitting ducks - just because the AI has been scripted not to move its transports without escort.

The problem with AI is that it does EXACTLY as commanded. If I say to a human "you should not walk into a wall", he may agree. He would still jump aside to a wall if he so avoided a collision with a car. AI would simply repeat "thou shalt not bump into a wall" and be run over. If the car was given a huge emphasis, the order of avoiding walls would be lost under the immediate threat of a car. THIS is my point.

By giving commands like "if...then" you would either make a dumbass AI with few tricks (that can be learned and bypassed by humans) or make a terribly complex AI. By giving the AI emphasized points depending on the situation you would make the AI more surprising and more intelligent. If it would then seem that the AI became a warmongering fanatic, simply decrease the emphasis put on warmongering.

It is not easy to do, of course, but it is the way artificial intelligence is going today. It can not be made to learn, as semantic nets can be, but it can be made more humanlike. More like a human that never learns, but plays like a human knowing simple things.

I emphasize: This system is NOT because of customization, it is because intelligent AI's are made this way. The customization would be a welcome BYPRODUCT of it .
 
Originally posted by Trip
Only a small fraction of the people who buy Civ 3 ever mod it in any way. Only a certain percentage (~20%) ever even patch it. Once.

As much as I would love a customizable AI, because of that reason it's not practical to have that system over a "single" more robust AI.

ha you underestimate this place: it's called civ FANATICS for a reason, if out of the box it came with a medium ai and the ability to customise it the fanatics would build something better than anything that would have been released if they just buily one "robust AI"
it would be a whole other game, you could have AI tournaments, where you pit your Creations against eachother, have fraxis build a AI ladder, and be constantly running AI's against eachother, and from there include in a patch or expansion real dificulty levels where the AI's are smarter and smarter, insted fo just get more and more free stuff.
and if you made it modular it would be easy to create new AI using genetic algorythms...
and don't forget to mix in plenty of neural network!
 
and don't forget to mix in plenty of neural network!

Yeah! We want neural networks! Then we would finally have a good reason to upgrade our computers into biological learning systems for even better cIV-experience! Then we could create a whole intelligent Super-Civ-AI that would span the whole internet! It would feast upon the knowledge stored into World Wide Web and become a real transcendent juggernaught of pure intelligence! This would also allow for us to have a CIV-Chip (tm) implanted into our temples so we could interact with the Super-Civ-AI all the time. It would learn from our behaviour and soon we could actually unite the whole world under this great and omniscient intelligence, and it could govern our world without us by using all the tricks it has learned from playing endless games of CIV! It would be great! We should also create an Alpha Centauri and Master of Orion Super-AI's so that we could finally take on the universe under the command of our Godly AI! Praise the neural networks! :worship:
 
A modable AI? Sounds itntersting
How about a memory buffer - ever tried playing Chess aginst a CPU? Ever win? Pobobly not. Ony person I know of who can do that is Kasporov. We need an AI that can think either 1, 2 or even 5 turns ahead and wargame every possible move you could make. - think Joshouwa from Wargames.
 
So far I've always beaten the CPU at chess. ;)

But for Civ, a memory buffer, alfa-beta algorithms, pattern recognition etc. are not helpful because (a) the number of moves is much larger, (b) there is also a random element involved and (c) evaluation knowledge will begin at infancy.

The number of rule-of-thumb strategies, however, is limited.

A moddable AI is therefore possible and would be great fun, it was actually one of my wishes for Civ3 some years ago. :)

But don't be mistaken: to create this takes way more effort than to build a single, hard-coded AI.
 
I agree, Ribannah, it should not be taken lightly. I tried to argue that it CAN be done, it is no Sci-Fi. And also I would like to say that it SHOULD be done, even though it would take time and effort. It is a very important aspect of the game.

About AI: I want the AI to go to war only for a reason. It should either want your cities (hasn't enough room to spread) or your resources. It shouldn't go to war just for fun. Although, come to think of it, they have done that it the course of history quite a lot. Still I think the AI should have some reasons for war, so we humans could somehow predict it. Now it seems random (in real map India declares war to me, when I am in Southern America). It would be nice if my big and lushy cities or my resource-filled terrain would be the reason for going to war, not some random number generator!
 
I don't se it as being that dificult it's just a matter of, like with most programming, subdividing the task, and all the sub tasks and linking them together, wether those modules are scripts or little neural networks makes no difference.

"guys i just reworked the scout ai, and the city/public-works planner, in the competition I ran the scout explored 30% faster and stayed alive 3 times as long, the planner had it's cities producing on average 15% more, try linking your overming module to them insted of the older version, you'll notice a difference"

I could see it happening.
 
Suki said:
ha you underestimate this place: it's called civ FANATICS for a reason, if out of the box it came with a medium ai and the ability to customise it the fanatics would build something better than anything that would have been released if they just buily one "robust AI"
it would be a whole other game, you could have AI tournaments, where you pit your Creations against eachother, have fraxis build a AI ladder, and be constantly running AI's against eachother, and from there include in a patch or expansion real dificulty levels where the AI's are smarter and smarter, insted fo just get more and more free stuff.
and if you made it modular it would be easy to create new AI using genetic algorythms...
and don't forget to mix in plenty of neural network!
I love this idea! This makes the entire suggestion worth while! :goodjob:
 
Back
Top Bottom