Cruelsader Cruelsader

Easy to make an AI that can beat a typical player?

Easy to make an AI that can beat a typical player?

In the ToA info guide (https://forums.galciv2.com/310173) Draginol writes:
It’s easy to make computer AI that can beat the typical player. What is harder is making a computer AI that plays the game like another person would, and makes it enjoyable for the human.
End of quote


I have heard similar claims from other makers of strategy games, i.e. that it would be quite easy to create an AI that would beat a typical player but this would not be that enjoyable. This makes me wonder: what kind of advantage would the AI have and why it would not be enjoyable? Just curious. What do you think?
33,721 views 32 replies
Reply #26 Top
Thanks for all the replays! This has been very interesting read!

500%+ bonus to everything, or purely free stuff.
End of quote


Repeating a point made earlier: I do not think that Draginol meant straightforward bonuses to AI. Consider for instance a very simplistic program that gives computer 1000 0000 bonus to everything so that every single space square in the quadrant is filled with ships that have 10 000 attack, defense and hp. Would you call such program an AI?

And what is more, nothing is ever wasted.
End of quote


That is very good point that was also made by johnphillips. The AI can micromanage much better. I can imagine a game that involves so much micromanagement that AI could beat an average player. This would be certainly very frustrating game too.

In playing GalCiv2 (ToA) there is a lot of information that I, as a player, can glean from the board. /../ The computer AI can do all of that, every single turn! And the computer AI can probably calculate much more accurately than I /../ Any change in strategy on my part, the computer can assess the impact of, and calculate the logical response too, Every Turn. As soon as my ships start showing lasers, they can start researching (or trading for) shields. As soon as I produce one transport the computer can know to research (or trade for) soldiering upgrades. And the list goes on. /../ So even without any “Cheat” advantages, creating an AI program that could utterly crush the “Average” player 99 times out of 100, would be child’s play for the good folks at Stardock. The real trick, as was expressed, was making an AI that doesn’t crush every player, every time. Creating one that plays and is challenging to the average player but isn’t too stupid on the one hand, or too hard on the other is a lot tougher
End of quote


I very much doubt it. I do not think it is easy to create an AI that could make "intelligent" choices on the basis of all this data. I personally would very much like if the GalCiv AIs were better at evaluating data. For instance, I think everyone has experienced a situation where AI thinks that it has an upper hand but does not understand that all its powerful fleets are worth nothing if human player can take all its core planets before the fleets arrive.

If the GalCiv2 AI knew exactly where you were, where every resource and anomaly in the game sat, could watch which direction you were teching and what sort of ships you had, and then used all of that? Humans are meat for the grinder. Are you going quick invasion? Fine, the AI goes heavy in the ships, slaps down your invasion fleet and then blockades you into your handful of planets. Human is settling down for the long game? Invade NOW with whatever you've got! And so on and so forth.
End of quote


Without any other bonuses? I very much doubt it. In the latter stages of the game the AI has most (if not all) of this information, yet it makes poor choices compared to an average human. I do not think that the AI is programmed to hold back, except in early game where it does not use the bonus knowledge very aggressively, e.g. the knowledge of nearest resource.



Reply #27 Top
Without any other bonuses? I very much doubt it. In the latter stages of the game the AI has most (if not all) of this information, yet it makes poor choices compared to an average human. I do not think that the AI is programmed to hold back, except in early game where it does not use the bonus knowledge very aggressively, e.g. the knowledge of nearest resource.
End of quote


Yes. The AI is far, far more timid than it needs to be. For now I play on Tough setting as I push through the campaign on my somewhat limited free time. If the AI looked at the derivatives for military power, population, economic power and so on, it could easily project who would be the biggest threat 10-100 turns from now. It could also look around for 'cheap shots', attacks of opportunity that far outweigh the resources expended. Based on that, it'd know who to attack and how to start wearing them down.

Looking at my last savegame, I have planets right next to a major Korath settlement. They have been there for over a year ingame. They have yet to be invaded, and only one has been Spored.

Compare that to my own reactions after realizing the Korath had just grabbed a pair of class something-teen worlds near my own frontier: I built a pair of 500 soldier cargo ships and dropped on his head less than 20 turns after he arrived. With no defenses in sight both were easy pickings.

The AI with all functions enabled should have a nice little library of dirty tricks to pound me with. It should not be allowing me to settle in, build up and culture them out without building a single ship on that planet. Mind you, Tough is probably not the difficulty level for that. "All nasty surprises enabled" needs to be close to Suicidal level.

An undefended world that can be reached before any known human-controlled ships should be nothing more than a big fat target. A starbase without adequate defenses might as well have a "Shoot me!" sign hanging off it. That's how a human would handle things, but the AI doesn't.
Reply #28 Top
Yes, unfortunately this is the way AI handles the information. However, I doubt that it is "timid" by design. I think most would agree that the game would be more challenging (in a good way) if AIs were better at evaluating data. Certainly it would be more interesting than giving AIs large bonuses on higher difficulty levels. The very fact that AI is not better at evaluating data at higher difficulty levels implies that it is not easy to write such code.

Reply #29 Top
I very much doubt it. I do not think it is easy to create an AI that could make "intelligent" choices on the basis of all this data. I personally would very much like if the GalCiv AIs were better at evaluating data. For instance, I think everyone has experienced a situation where AI thinks that it has an upper hand but does not understand that all its powerful fleets are worth nothing if human player can take all its core planets before the fleets arrive.
End of quote


You are not understanding. It wouldn't need to make "Intelligent" choices. That is the thing. The shear volume of information at it's finger tips, if used at all, would overwhelm the "average" player.

Reply #30 Top
It must be really hard to write good AI for a complex game such as GC2. Indeed when I read about how the AI has been improved etc I wonder if that is really so. Or else why would there be need to give all civs ridiculous bonus at the higher levels? Especially ship/weapon ones. I would imagine that a good test of AI would be to stand the model on its head. If Yor can have 128 beam attack on a frigate plus some ridiculous speed engines etc can a human playing Yor also build the same ship? And if so can the AI beat a human? In other words without giving AIs benefitrs that humans cannot at any cost can AI beat a human player? As it stands today the answer is no.

AIs at higher levels in GC2 can do things that cannot be replicated by a player. That is not really good AI. It merely means that the odds are stacked heavily against a player. In GC2 it goes even further. The bonuses given are not explicitly stated anywhere to further disadvantage the player. Extending this logic, it would be easy to program AIs with so many bonuses that a human can never match it. Sounds close to cheating? Yup.

Sure there is some better AI (more aggressive or number of look aheads etc)at the higher levels. But instead of calling some AI as 'genius' etc etc and giving it all an illusion of better AI it may be better to clearly state that the odds are being stacked against the player. Its like starting with a handicap in golf. The rules are not different - just the odds are.

It also seems to me that it may be better to outline what the odds are clearly. And it should never be that AIs can do things that a human player cannot. The odds could be stacked against a human in terms of more resources to start with - more ships, more population, more firepower, more miniaturisation, more speed etc but all subject to the same cap that humans will face. In other words a human player can get to the same level as an AI eventually.

Incidentally has anyone won a TA given under suicidal as yet?
Reply #31 Top
Hi!
In playing GalCiv2 (ToA) there is a lot of information that I, as a player, can glean from the board...
Now the computer AI can do all of that, every single turn!
End of quote

True. But what can AI do with that info? Remember that AI has to be told (with program code) what to do in just about every situation, analyze every possibility, check every possible response.

Computers can crunch numbers. That's what they are made for. But without proper code they are just ultra-fast idiots. And even if they have proper code, in games such as GalCiv they don't have the right information. Lots of stuff here is hidden, and players have to guesstimate, play on heuristics, or simply assume stuff until better info is obtained. And that, my friend is where we humans excell, and computers fail, because we have been "programed" for that for several millions years of evolution. Each od us has "common sense" and several years of experience under his belt. What an AI has? Some algorythms and lots of fuzzy data, too complex to be crunched by brute computational force.

Your reply #25 remembers me on the comp science community in seventies, when first programs that worked shomewhat intelligently were written. Quite some scientist at that time have predicted intelligent robots, sapient AI and us superfluous in 20 years. More than 40 years have passed since, and I don't see around much of anything they predicted.

Obviously makig real AI is simply not so simple. ;)

BR, Iztok
Reply #32 Top
Obviously makig real AI is simply not so simple. BR, Iztok
End of quote


It's not, but it is possible to make one that's truly vicious without allowing it to cheat.

I play on Tough difficulty level because of two things:

1) I'm a beginner. Never touched the game since a brief foray when it first game out. Forgot everything I learned since then, and had to start over from "So how does combat work again?" and move up.

2) I like to match myself against the AI. If I get really bored, maybe I'll bump it up 3 or 4 notches. But until then, I want to face the AI on an equal footing and use my monkey intuition to overcome the computer.

So what's my intuition telling me is important?

1. Fleets in the right place at the right time are valuable. Fleets halfway across the map are useless.
2. 10 ships with 10 HP, 2 attack, 0 defense and 2 movement are nowhere near worth as much as 1 ship with 100 HP, 20 attack, 5 defense and 20 movement. Against that ship, they're actually worth about nothing unless they can rush past it along a vast frontier.
3. It's the economy, stupid. Either squash someone right now or out-tech, out-spend and out-build them. If you can't do either, you need to get very good at making friends in a big hurry.
4. It's the economy, stupid (Part II). Raw military power is *not* the best evaluation of a faction's threat level. Military technology rating (especially if very different from your own miltech), current cash reserves, maximum income rate and a variety of other factors are more accurate indications of how dangerous your neighbor really is. I've already done the insta-warfare conversion a couple of times when the fecal matter hits the air circulation device, and point #2 becomes strongly related a turn or two later.
5. Never pass up the cheap hit. When I'm rushing somebody's front lines and a 500 troop transport bumbles across their thinly settled planet, take it from them while you have the chance. You never know, that could be where they're building a Super Project.
6. Never pass up the expensive hit either. If the dread lords have a planet uncovered for a turn and I have a transport anywhere vaguely nearby with at least a 30% chance of succeeding, I need to get my butt down to that planet. It doesn't matter what kind of casualties I take if I have 20 planets and they have 0.

...and so on, and so forth. Take a few dozen general maxims and you have the beginnings of an Expert System for GalCiv2 strategy. You need to go through a painful multi-step process to actually use that expert system.

First, you need to find some experts! Not always the easiest task. Then, you need to get those experts to articulate exactly what they're doing in a clearly defined and yet easily generalized manner. Next you must find some better than average programmers to turn those maxims into a decision-making system. (whether it's a multi-dimensional weighting, a decision tree or whatever else is up to them and their implementation)

Once you've done that, you need to hone your rough-and-ready strategic AI. A good way to do that is through multiple generations of AIs fighting each other. Tweak the values, set it up against your not-so-smart previous AI and run, say, 500 games per generation through a thousand generations. Winner gets a chance to 'breed' with random variations, loser is kicked out of the gene pool. Maybe even make it double-elimination to reduce the luck factor. Genetic programming at work!

Take your top 10 or 25 scoring AIs, look at them to see how close they are in both results and how they get there. If they're very far apart in strategy, examine them carefully to see what each one's strong points are. Maybe one is a victory through superior technology AI, while another is a small-map AI that races for Planetary Invasion and ends the game in under 100 turns. If they're all very close together, get some beta testers to poke at them. Maybe the AIs managed to hit some 'local maximum' in their decision-making tools and you need to restart your testing phase.

Assuming all that is done, you now have a batch of particularly ruthless, nasty expert systems for this version of your game. Less than half of the players will ever match wits with them. Perhaps fewer than 25% even. If a few of those AIs stood above the others and get ranked into Masochistic to Suicidal games, a relative handful of your players will ever get the benefit of all your efforts.

What you've done will probably never show up on a review- game reviewers rarely are the type of strategy player who can look at the rules, play half a game on Medium, and jump straight up to the top difficulty level. Most players will never even be affected by the incredible amount of hard work you and your team have put into the AI. Heck, most of them will never even know about your work and will spend their time complaining about the graphics instead.

That's why you don't see top-notch AIs in video games.