In a recently posted Dev journal, the topic of AI was brought up. I'd shared some of my experiences in programming AIs in a reply.
One of the maxims I came away with is that AIs can really benefit from supplemental help where the programmer, having a really good understanding of how to win the game, tells the AI how to do certain things.
In a strategy game, what are the top three things you would tell a new player about? You can use specific examples from specific games, or things that are just generally true of most strategy games. Hopefully, we can make a big list of things the AI should "know."
My top three are:
The idea is that each of these boils down to a simple algorithm. Calculate losses, determine how much damage you are inflicting on an enemy by continuing to defend, if it is below a certain value, pull out.
This has been discussed more times already. Here is the latest discussion about it:
https://forums.elementalgame.com/381358
"I’ve been using XML for years for skinning purposes but I’ve never tried to data drive an AI before. It’s not hard, but there is no substitute for experience. So over time, it’ll get better and better so that less and less of the AI is actually hard-coded and what requires “real” coding would be provided as Python."
..yet another answer from Froggie with regard to changing the AI via Python coding:
https://forums.elementalgame.com/376437/page/1/#2544692
So yeah, the AI won't be hardcoded.
Thanks Tormy-!
Geez, I even posted in that thread I gotta do less skimming/talking and more reading/listening!
*off to Wiki to get a quick idea of what the heck 'data drive' means and how it relates to 'hard-coded'*
Hehe, you are welcome Nick!
I have never said it should make perfect decisions, I have said that with for your method to work, auto-resolve has to give realistic results. That's it, if you have two sets:
1) The results produced by auto-resolve
2) The real combat results
There has to be a good overlap between those two sets for the AI to be able to make a good decision using your idea. If there's not enough overlap, it doesn't matter how many times you auto-resolve, instead of one bad result, you will have thousands, which is equally useless.
And from all the auto-resolves I can remember now in games that have tactical combat, there's not enough overlap when a human is involved.
I don't think it has to at all. Because auto-resolve results are a good measure of the comparative strength of the armies; The actual outcome of the battles is irrelevant in this situation. Which is the only information people are really going to consider when deciding to retreat and save strength for a more advantageous battle.
What's a better solution in your opinion?
How they can be auto-resolves a good measure of anything if they don't represent what happens in reality more or less???
About a better solution, no idea, if I had it I would be rich
This is the stupidest argument I've ever been in. Generals don't know exactly how their opponents are going to act. Why should an AI need that information? I'm done with this.
You really don't have any idea how AI works. If you are a human, you see two armies, you process a lot of information before deciding if fighting or retreating: you see the forces balance, how the units counter each other, the spells you know the other guy has or likes to use, how past matches resulted, the global vision taking into account economy,... Humans are very good at processing parallel information like that, while computers aren't.
The AI is the same, it needs to get some information before been able to decide if retreat or fight. And if you give it wrong information to make a decision, then the decision usually won't be good.
Imagine that the AI is not very good in tactical play, so against an average player, it loses nearly always with an equal number of forces (doesn't flank well, use spells well, whatever). But in auto-resolve, two even forces will result normally in a close win or defeat, because the AI is playing with itself. So, with an even number of forces, the AI engages nearly always and loses nearly always against a human player, do you think that's good? Fun? Useful? The problem is that the AI is basing his decision in some information that doesn't represent what will probably happen, so it fails.
Auto-resolve is the AI playing both sides? I would think usually it's just an algorithm run the data between the two armies and some dice rolls.
Your claim that an AI is the same as a human is off. An I is just a series of routines that a computer uses to decide how computer controlled entities act.
AI doesn't need to do all those things a human does. And it doesn't need this perfect information you're suggesting either. If the AI tends to retreat when it shouldn't just change the odds of victory from auto-resolves or whatever other method you're using to determine so that they are less likely to choose it,.And increase the likelihood if he's staying and getting whooped.
Let's see if I can explain the same with another example: chess. Imagine you have to write an AI that bets money on white or black wins.
First, you calculate which side has a bigger % of winning the game, running an algorithm over the chess board. For example, you can add the pieces values (queen 9, rook 5, bishop 3,...), and the color with a bigger value has more possibilities of winning. Your AI can bet based on that information.
But when the AI bet, even if you didn't realize, it used another factor for determining who wins or loses: it assumed that the skill of the players didn't affect the chance of winning or losing, it assumed both of them were equally skilled.
But if apart from the board state, you know you have an average player on one side and a Grand Master on the other one, your AI can also use that info to make a far more accurate bet, because unless the game is very one-sided, player skill has a lot of importance determining who wins or loses the game. If you don't use that information, you can't expect your AI to bet well most of the time.
Btw, auto-resolve can be both things, but in an old developer journal I think Brad posted the summaries of an auto-resolve, telling you what happened turn after turn more or less, so it seems auto-resolve was the battle run without graphics. But in general it doesn't matter to this argument.
Industry is part of military strength. I can't count the number of games where the enemy AI thought it was doing well in a war against me, because it had a slightly bigger army, despite me having a huge advantage in production that would very quickly give me the advantage. While such an advantage obviously can be neutralized with a quick enough assault, I've never seen an AI actually aim to do so.
Indeed, I had the same thing happen to me numerous times in GalCiv2... I almost never build any military units until I'm in a war. Usually an AI attacks me, I design a decent ship and start to build it in as many planets as I think I need. Most of the time I have a decent defense before the AI was able to capture a planet and start capturing his planets soon after.
On diplomacy:
Ask for peace when you're being beaten.Extort from someone you can beat rather than declaring war straight away.
A lot of the time AI doesn't seem to have any sense of impending doom and will attack a faction with a much stronger army.
also, I'd like to see more Dogpiling on the BIG guy as opposed to Dogpiling on the little guy ... I think it would make for more interesting games.
Yeah, that's so true.
In Civ4 at least when an AI is way in the lead they are his servants, when the player's in the lead he gets ganged up on.
That's actually one of my biggest gripes: In a FFA-type game like that when the AI is programmed to treat the human player completely differently.
I am ... FAIRLY confident in saying that Civ IV AI is not programmed to treat the human AI any differently, it is actually human psychology that makes it seem the case. If you learn to copy the behaviors of the AI, as opposed to acting as you have previously ... you will generally make good AI friends who might even gift you techs, etc.
Once an AI even offered to be my vassal during an MP game. While this has happened many times in single player games, it came in quite handy this particular time.
Regardless, it seems that the AI only favors strength, and as soon as it sees a weak element all AI will unite in dividing the spoils of the weaker player/AI.
Also, if you have come to power by stepping on AI's toes and not acceding to their demands, even if you are powerful the AI will not respect you.
In any event, whenever ANYONE has a monopolized hegemony (be it player or AI) and is starting to "divide" and conquer his enemies rather aggressively ... it is at this point that his fractured, vastly smaller rivals need to "unite" (whether human or AI) against the large aggressor, that they may at least carve some of their own empires out of the aggressor's territory, and thus balance the field ... and once the large aggressor dips below 2nd place .... alliance members start to drop out of the alliance and once again pursue their own individualistic goals.
It is the current AI, that tends not to band together, that makes playing the Infernals so fun "Weakling Humans, and your petty rivalries ... one by one you will fall into the ever-growing fold! Muahaha!!"
The Idea being that the AI look after their own interests so solely that they never band together to stop a world-encompassing monster Superpower. (IE my Infernal shadow upon the land)
I hope this helps with what an AI should know, how it should react
It depends what difficultly level you play it on... I'm pretty sure it treats the player differently at monarch and upwards. Just look at the relations grid, there are a lot of penalties for human players with AIs that are non-existent between AIs. Tech trading also, they trade around their techs a lot more freely.
Also, the auto-resolve argument above, VicenteC is right. If the AI's autoresolve data about a battle is bad, it doesn't matter how good the strategic AI is, it'll still try to fight battles it can't win.
The solution to this is to either:
- Make the tactical battle AI excellent enough that it will beat a player half the time with an even match, which is properly reflected in the auto-resolve results. This is the best, but I believe somewhat unrealistic, solution.or- Give the AI units bonuses to the same effect [worst solution]or - Use a fuzzy logic system which feeds past results into its logic so that the AI eventually learns how good a player is at tactical battles, and factors this advantage [or disadvantage if you're really bad at them] into its strategic calculations. So the AI would no longer believe it could win a battle with even forces. This is my favourite solution.
There are many great features available to you once you register, including:
Sign in or Create Account