Frogboy Frogboy

AI: Testing Difficulty Levels

AI: Testing Difficulty Levels

Fallen Enchantress has several different levels of difficulty. The AI doesn’t “cheat” in the sense that it plays by a different set of rules. The difficulty rules have to do with what resources the players get.  At Normal, the AI is the same as the human player which is, arguably not fair to the AI (since humans tend to load saved games and have, one presumes, gotten familiar with quests, mob milling and other strategies. 

I tend to think “Challenging” is the fairest to the AI since all the AI really gets there is a little HP boost.

Anyway, today I’m testing out a series of 1 on 1 battles to see how easily I can cream the AI at different levels.  To make it fun for me, I usually try to minimize the number of turns it takes to crush it. 

My strategy:

Find a champion to join me, go monster hunting to raise level. Find AI and kill him.

Game 17: Normal AI 1 on 1, small map.

It is, admittedly, hard for the AI to deal with rushes. Not to mention, it’s hard strategically to decide when to attack an enemy city versus defending one of your own.  Each play through I end up adding new parameters to the various AI functions to have it spit out, I hope, more intelligent responses.

Game 17 is the result of many many hours of this kind of iteration.  I typically beat the AI within 50 turns (depending on starting locations – the AI had graduated to random maps at this point).

Result:

Victory in 36 turns.

(2 hours of coding later)

Game 18: Normal AI…

image

This one took a lot longer to win because the AI managed to snag two champions early and bottled me up. So I had to build up more first.

It did still expose some dumb AI decision making in the sense that it over defended it city area at the cost of expanding its empire.

image

So this would be the first real test of the tactical combat improvements.

So my strategy here was to stand back and cast haste on my units. Have my archers weaken them and then mop up.

Relias wasn’t in this battle (the enemy sovereign) which would be his doom. Without any champions in the city, it was easy. After that, whack.

In Fallen Enchantress, there aren’t many champions (I had none, just my sovereign in that game). But let me show you how powerful they are:

My sovereign is an army unto himself.

 

More coding…

(game 19 aborted)

Game 20: Normal AI

image

This game I got a particularly good spot.  4 grain, 4 materials. That’s really hitting the jackpot (a normal good city would be like 3 grain, 2 materials).

Victory in 65 turns.

…Iteration

(it’s a real challenge to tell the AI when it should expand and when it should hunker down without it requiring tons of work and CPU time).

Game 21: Normal AI

image

Not quite as nice as my last game but still decent.

The problem, once again, is that it is very difficult for a 1 on 1 contest to end any other way when I’m intentionally mounting up for an attack.

However, the thing is, the game design should be such that it’s relatively easy, early on, to keep players from just doing this.

I think one problem is my use of an early game weapon enchantment (burning blade) that simply grants a numerical bonus to attack rather than a %.

On the other hand, what’s stopping the AI from using it?

coding coding coding…

Really REALLY need put some time into having the Spell data hooked up to the AI better. They’re all set at 5.

Game 24: Normal AI

image

Victory in 70 turns.

Strategic spell coding…

25 aborted…

Game 26: Normal AI

image

In this game, it took me 40 turns before I found the other player.

Victory in 46 turns. I think there’s a bug with faction prestige for AI players.

Coding…

Game 27: Normal AI

Win after 90 turns

AI still casting stupid strategic spells.

Sigh.

coding

Game 28: Normal AI

image

Not a bad starting location except I’m right next to Wildlands.

Getting better.

Took 30 turns to find AI. AI had 2 cities and was effectively using them against me when I did my sneak attack.

Took 100 turns to win.

Fixed some bugs in the way spells are evaluated and distances evaluated.

 

[To be ccontinued…8:30pm]

Game 29: Normal AI

image

Up against a mountain. But good resources.

This time, when I encounter Altar, very early on, they’re slightly ahead of me (power rating 6 to 5).

image

This time, they can’t be just knocked over.

My concern now is that rushed for Civics to get Rush build and they spent their money.

I can’t take them though. So no riding rough shod this time. The question is, will they be able to expand faster than me?

The other thing the AI is struggling with is how much to be worried about monsters. On the one hand, you don’t want the monsters to take out the AI players enmasse but on the other, you need the AI to take some risk.

image

This time, my attempt to rush them has cost me the lead. Altar (AI) has taken an early lead.

And worse, my champion died in battle (they can die, it’s just extremely rare).

image

GRRR!

Monsters took out one of my towns.

 

Dangerous borders

image

OK. This isn’t good for me.  I’ve never seen this before. I normally kill the AI before he gets horses.

My capital just got taken by monsters.

Getting placed near wildlands means more goodies but you gotta defend them better too. I didn’t.

This just get worse..

image

Son of a bitch…

image

And so where my capital is they sent in pioneers to take it.

I’ll take it back.

And I did.

Barely.

Relias (AI) vs. Me.

1 on 1.

Tactical.

image

I win.

He hasn’t picked up as many good weapons as I have.

And he hasn’t shopped enough.

So he’s definitely not anywhere near perfect.

But right now…he is winning.

[10:50 PM]…

[Reminder: all tactical battles are on the same brown  map for now in my build]

image

And here…come the archers. Sad smile

So it’s just me (and pioneers) against his small army.

He never had a chance.  I’m Sauron!

Unfortunately the damn Shrill Lord took out the city I had captgured earlier.

City destroying Shrill Lord

 

I started another city there…

Shrill Lord got it again.

I’m gonna kill that thing!

Quickie video of how powerful my sovereign is (too powerful?)

Sovereign vs. archer army

My opinion here is that my sovereign has too much HP. I like that he can mow down units, but it’s kind of crazy that he has over 120 HP (compared to just a few for others). Should probably be about half that with the player packing health potions and such.

[12:00am] TO be continued…

So there are 5 cities in the world at this point. I have 2, the AI has 3.

The problems with the AI that are affecting its play in this particular game include:

(1) Its researching isn’t very good. This is a known issue that is due to the AITraits not being hooked up yet. This means its armies aren’t as big as they could be.

(2) AI is too timid to send a major force around my strong point (I don’t have a choke hold) to attack my vulnerable rear city (I have a weak city and a strong city but the strong city is relatively close to their capital and they’re not sending units to attack the weak city because that would leave the capital city potentially vulnerable – but not really, they have a lot bigger army than I do).

 

image

I probably shouldn’t quibble too much since it’s not looking very good for me.  The issue here is that players don’t usually have the opportunity to build up overwhelming force like this.  If the monsters hadn’t taken out my capital, I’d not have let them get this far.

..

OK, I’m completely surrounded with only 1 town. It’s a bit of a stalemate because my sovereign is just so powerful.

OK, the AI finally won. 

image

The AI is getting better but the monsters were as much the AI’s helper. You can see where we were neck and neck right until one of my cities got taken down by the Shrill Lord.  So really it wasn’t a 1 on 1 battle, it was AI + Shrill Lord vs. me.  Still, progress.

Now to spend the next couple of hours implementing fixes and additions to the AI based on what I saw.

Good night!

1:42 am, signing off.

49,892 views 55 replies
Reply #26 Top

Tactical battles look really fun!

Reply #27 Top

Maybe it is possible to emulate human thinking with probabilities? Order the list of decisions based on what is good for the AI (make some sort of metric for this). When the computer orders this list based on your metric, and assigns a number to each option, normalize it so they become probabilities. You would get something likes "Defend city from strong player town: 60%,Attack weakest city : 30%, others: 10%". Then make the computer randomly decide upon the top two, based on their probabilities. This might emulate the decision intuition that the human mind has. Maybe make a threshold, so that if the first option is 90%, the rest of the other options aren't chosen.

Reply #28 Top

The difficulty with probabilities is you have to have some randomization of the probabilities from game to game or the AI remains predictable.

 

Also Brad doesn't like scripting in AI's.  (I think scripting makes some sense in 100% no-brainer situations, but it does hurt modding)

 

Reply #29 Top

What time does Game #30 start?

Reply #30 Top

Quoting Grizzyloins, reply 7
I would like to play on higher difficulties but want it to be that they have an extra node/gold mine/iron mine/ food resources/ lvl 2 techs starting off

There's a catch to that. If starting locations are very valuable, then it adds more emphasis on rushing. You'd need that extra bonus for yourself if you want to win.

I'm all for giving extra sight distance or other invisible bonuses. I wouldn't give the AI full access to the map, because that could lead to non-fun events. It's nice to meet AI explorers instead of meeting a huge army on the doorstep of the single colony you left with weak defenses at your rear areas.

Reply #31 Top

Quoting Vallu751, reply 30
Quoting Grizzyloins, reply 7 I would like to play on higher difficulties but want it to be that they have an extra node/gold mine/iron mine/ food resources/ lvl 2 techs starting off

There's a catch to that. If starting locations are very valuable, then it adds more emphasis on rushing. You'd need that extra bonus for yourself if you want to win.

I'm all for giving extra sight distance or other invisible bonuses. I wouldn't give the AI full access to the map, because that could lead to non-fun events. It's nice to meet AI explorers instead of meeting a huge army on the doorstep of the single colony you left with weak defenses at your rear areas.

That's ok on the hardest difficulty level imo. I want FE to kick my ass! Agree on lower difficulty levels players would not want that... :cylon:

Reply #32 Top


Thanks for the update.

2 Questions:

Question - Is there a single AI or will AI players have a chance to use a different AI each game? I.e. AI 1 and AI 2 use the standard melee focused AI, while AI 3 is guided by a magic focused AI in game two. In game 2; AI 1 follows a mount strategy AI while AI 2 and AI 3 use the standard melee AI.

Question - Will the player be able to design new fraction (Sovereign) specific AIs?

Reply #33 Top

The game is looking really nice. Thanks for sharing the development process with us like this.

My BIG concern is still the bloody balance. The champions and sov's look like insta-win all over again. Please please please make their effect important by all means - but not game-breaking which is what it looks like now. I would have thought a boost to adjacent troops would be good. And by boost I'm talking 10 to 20 percent - not 300 percent which is what would have happened in WoM. But having champions destroying whole armies is just going to kill this game before it even begins. What is the point of recruiting troops if champions can dish out that sort of damage?

As I said at the start, the game itself is looking good but seeing this imbalance is really leaving me worried - very worried! You said in a recent post that one of the big lessons you have learned is that 'less is more'. Please take heed of that with regards champions. It doesn't look like the 'less is more' has made it to champions and sovereigns.

Really hope I'm wrong about this.

Reply #34 Top


Historically, if an army commander/king dies untrained levies tended to break and run. If a sovereign falls in battle will his troops be affected? Will they panic, will they run, will their combat strength be affected or will their initiative be impaired for the duration of the battle?

Reply #35 Top

@Das - Like I said in the blog, I felt champions / sovereigns were OP'd.

The issue IMO is not so much how much damage they can do but more like how much damage they take.

The cause is pretty obvious - lots of level up upgrades include constitution bonuses which are just too powerful.

Reply #36 Top

BTW, in November, the issue was the opposite - the champions were pointless.  It's just a matter of balance. That's why we iterate and iterate.

Reply #37 Top

Quoting Trojasmic, reply 29
What time does Game #30 start?

Gonna take me a bit of time to put in all the changes.

There's still so much to do.  One of the biggest changes to FE over anything I've worked on before is the sheer number of treaties.  Rather than monkeying around endlessly with AI on "trading" I've instead put that time into coming up with treaties that players can have with one another.  (and before anyone ask, no, I'm not going to screw around with resource trading or tech trading, it ain't  happening, it's a black hole that could be spent on lots of interesting diplomacy stuff and smarter AI overall).

Having lots of different treaties in the game will give players an incentive to be on good terms with other players as well as allow other players to effectively gang up on whoever they consider a huge threat.

Reply #38 Top

Thanks for the clarification, Brad. :)

Reply #39 Top

One thing I don't understand is how you can develop and reach conclusions about the AI before all the AI is actually working and hooked up (AITraits)?

Reply #40 Top

The traits are likely weights that make one type of AI more likely to choose one option in front of the others. What he's developing is the basic AI from which the other AIs will come. So rather than making 10 different AIs, he's making 1 Ai that can act in 10 different ways.

Reply #41 Top

Quoting AlLanMandragoran, reply 31
That's ok on the hardest difficulty level imo. I want FE to kick my ass! Agree on lower difficulty levels players would not want that...

Hi AlLan!

Definitely want to get that ass-kicking from the AI too  :cylon:

I really appreciate seeing the time and effort Brad is able to commit to the game. Makes me feel warm inside.. probably the fever starting to rise already.. I still haven't even got the game and the disease is hitting, omg it's that bad!!

Reply #42 Top

Quoting Vaul_Darkhour, reply 39
One thing I don't understand is how you can develop and reach conclusions about the AI before all the AI is actually working and hooked up (AITraits)?

Agreed.  This seems like it might be an important step in the process.

Reply #43 Top

Quoting Frogboy, reply 37


Having lots of different treaties in the game will give players an incentive to be on good terms with other players as well as allow other players to effectively gang up on whoever they consider a huge threat.

Perhaps, an intelligence sharing treaty? So that my sovereign sees enemy units spotted by a friendly sovereign?

Perhaps, gaining the services of an allied champion for x months (turns)? Break the treaty and this champion leaves your service early. Lose a battle and this champion returns to his original lord.

Perhaps, loaning the services of your Kingdom's champion to an ally for x turns, for so long as the ally only battles forces of the Empire. (A way to indirectly oppose a fraction, without going to war against the fraction).

Perhaps, loaning a unit of veteran warriors (not untrained militia) to an ally for x turns. (another way to oppose a fraction without going to war against the fraction).

Reply #44 Top

Quoting Frogboy, reply 37
(and before anyone ask, no, I'm not going to screw around with resource trading or tech trading, it ain't happening, it's a black hole that could be spent on lots of interesting diplomacy stuff and smarter AI overall).

Having lots of different treaties in the game will give players an incentive to be on good terms with other players as well as allow other players to effectively gang up on whoever they consider a huge threat.

Well I'm a huge fan of resource trading and economics but if it really takes a lot of effort to implement right then you are probably better off spending the time on something else. The inability of AIs in WoM to work together to take down powerful players was a huge problem and would definitely be a priority.

  If you don't want to have active resource trading between players what about more automatic stuff. When it comes to trading the caravan system in Elemental is marvelous because it is so simple yet realistic. I can recommend a simple little change to caravans that would add a lot of depth without requiring practically any AI work.

Reply #45 Top

Quoting Edwin99, reply 43
Quoting Frogboy, reply 37

Having lots of different treaties in the game will give players an incentive to be on good terms with other players as well as allow other players to effectively gang up on whoever they consider a huge threat.


Perhaps, an intelligence sharing treaty? So that my sovereign sees enemy units spotted by a friendly sovereign?

Perhaps, gaining the services of an allied champion for x months (turns)? Break the treaty and this champion leaves your service early. Lose a battle and this champion returns to his original lord.

Perhaps, loaning the services of your Kingdom's champion to an ally for x turns, for so long as the ally only battles forces of the Empire. (A way to indirectly oppose a fraction, without going to war against the fraction).

Perhaps, loaning a unit of veteran warriors (not untrained militia) to an ally for x turns. (another way to oppose a fraction without going to war against the fraction).

 

I like this & the trade city idea above

Reply #46 Top

I think trading with resources would be simple and useful, if not necessary. 

IE: I need metal and I have plenty of gold.  My ally needs gold and has an abundance of metal.  We trade one for the other.  Why is this so difficult or unsavory?

Reply #47 Top

Quoting mqpiffle, reply 46
I think trading with resources would be simple and useful, if not necessary.

I think he was referring to over-time trade treaties like "I will give you five gold per turn for 30 turns" and such. I don't think they will be removing the existing ability to trade resources, since metal is so important that would be weird.

I believe what he means in general is that you won't be able to do complex trades involving cities, blackmailing, champions, techs, etc. Instead there will be generic treaties that accomplish similar things. ie you can't trade techs but you can enter into research treaties. Perhaps you can't blackmail the AI for 90 gold per turn  but there is a "surrender" treaty that forces them to pay a set amount of their income. Things like that.

Most treaties will probably work like in Sins, so that they give a multiplier to both players allowing players with good diplomacy to have tangible benefits. It also offers incentives to players to seek alliances even if they are not military. Its a good system if done right. 

Reply #48 Top

Quoting Frogboy, reply 37

One of the biggest changes to FE over anything I've worked on before is the sheer number of treaties.  Rather than monkeying around endlessly with AI on "trading" I've instead put that time into coming up with treaties that players can have with one another.  (and before anyone ask, no, I'm not going to screw around with resource trading or tech trading, it ain't  happening, it's a black hole that could be spent on lots of interesting diplomacy stuff and smarter AI overall).

Having lots of different treaties in the game will give players an incentive to be on good terms with other players as well as allow other players to effectively gang up on whoever they consider a huge threat.

Love it!  My eternal desire for all 4X games since I played Civ 1 is to have more intricate diplomacy.

 

Reply #49 Top

Quoting mqpiffle, reply 46
I think trading with resources would be simple and useful, if not necessary. 

IE: I need metal and I have plenty of gold.  My ally needs gold and has an abundance of metal.  We trade one for the other.  Why is this so difficult or unsavory?

 

"Need" is a 3 month coding process, minimum otherwise you'd just have players exploiting it.  I've written this kind of AI for decades and it's a time sink, and for what? It's not even very fun.  

By contrast, treaties ARE fun because there's a lot of interesting choices (you can only have 1 treaty in effect, you can't have the same treaty with every player).  They affect your relations, they give both sides benefits, they are just great tools to make the game more interesting.

Reply #50 Top

Hmm, you can't have the same treaty with every player?  Will Diplomacy tech upgrade the value of those treaties?   I always felt the GC2 treaties were a good idea that needed more work, but didn't work that well in WOM, so curious to see what the changes are.

 

I really would like to see a dev diary on this stuff and how it works.

 

One thing I would like to see is tech diffusion via treaties.  Having treaties with an empire makes it easier to research techs they know.