Specific AI Adjustments

Everyone complains about the AI, but there's not a lot of suggestions on very specific things to change, so I wanted to throw some things out there, hopefully make a repository for these things.  I don't have much to start with, unfortunately.  I'm still playing on Normal level difficulty, too, so I don't know if some decisions the AI makes are because of the lower difficulty level, so I would like people to confirm that they've seen these behaviors as well on the higher difficulty levels.

Note: I'd much rather see bugs and UI issues fixed before these are addressed.  Still, some of them might be easy fixes.

 

Tactical Combat:

- Spiders will web someone who just got webbed. I just saw a spider web my archer, and another spider went right after, and webbed the same guy.  They should check their target to see if it's already webbed before committing.  This can be applied to any non-stackable conditions.

- It seems like spiders prefer to web archers when they should be webbing meleers (is that a word?). 

- I've confirmed that this is difficulty-based.  I'm  playing a game on Ridiculous, and the enemy goes after the lower health units.  Enemy units will not go after one of my lower-health units if there's any other unit next to them.  This makes it very easy to retreat a unit that's low on health because I only have to move it 1 or 2 tiles, which makes both the individual battles and the overall game much easier than it should be.

 

Yeah, I really didn't have much to start with.  I was more hoping to get contributions with the above items as examples.

37,484 views 39 replies
Reply #1 Top


Everyone complains about the AI, but there's not a lot of suggestions on very specific things to change

 

ROFL

Where to begin? In fact there have been lots of things suggested to change. Just go digging.

For one is the AI able to recruit heroes from across the damn map. I had the AI recruit a lvl 7 hero that there was no way he had even discovered yet.

I know because he (the hero) was in the middle of my territory and I had JUST discovered this particular AI across the map.

I have had this game shelved for a while and it is going to stay there... prolly for a looong time.

The game is getting better this is true but the gaming community of late is just getting ridiculous in releasing games waaay to early.

Reply #2 Top

That sounds more like a bug that an AI issue.

Reply #3 Top

Quoting Darxim, reply 2
That sounds more like a bug that an AI issue.

There have been quite some AI specific bugs due to the way it was implemented, so to me seeing all the changes my lines on AI bugs and issues have been blurred a lot.

There have been many posts suggesting improvements to the AI, but people like me don't spend too much time reposting old stuff due to the feeling that the devs have read it, and reposting it will get tiresome (feel free to post your ideas though).

Sincerely
~ Kongdej

Reply #4 Top

Quoting Munchies72, reply 1

For one is the AI able to recruit heroes from across the damn map. I had the AI recruit a lvl 7 hero that there was no way he had even discovered yet.

I know because he (the hero) was in the middle of my territory and I had JUST discovered this particular AI across the map.

Or maybe the AI had a caravan that moved next to that hero?


I have had this game shelved for a while and it is going to stay there... prolly for a looong time.

And yet you still linger on this forum, posting unhelpful criticisms/trolling.  The community thanks you for your vigilance.

 

Reply #5 Top

lingering... lol

ok sir if that is what you think.

 

Will check back and
"linger" again in a couple months. Hope things are better then.

I haven't given up hope.

Reply #6 Top

AI can't recruit heroes from across the map.

It uses the same API players do. It'll return an error if they're out of range. So even if I wanted the AI to cheat I couldn't.

Most of the AI suggestions I read on the forums boil down to people making assumptions that the AI isn't already trying to do something or assuming they should do something because they see something they can't see.  

You can always turn on the FOWCheat in the coredifficultylevels.xml and the AI will be able to see everything.

IF I could ignore modders and hard code things, I coudl make things a lot more lethal.  I'm starting to come around to the idea of hard coding more strategies since I don't foresee any total conversions happening.

Reply #7 Top

Give us better interaction between XML objects and AI interpretation instead of hardcoding stuff. There's already so much hardcoded in FE, so many limits on the things we can do. Surely the plan should be to attract modders for total conversions, not drive them away.

Anyway a total conversion really isn't realistic when there's so much hardcoded, just to mention a few:
- environment types
- shard types
- damage formulas for battle
- how the AI picks what units to build
- how the AI decides what to attack in battle

Reply #8 Top

That's the problem though.  I don't have some intern to go and do what you're looking for.  I'm not likely to get more XML interaction in the FE series.  I'm still yelling to get python scripting into whatever comes post-FE which would solve a lot of problems.

But in FE itself, the XML isn't strong enough for total conversions but it's too strong for FE-specific AI coding.  I think the AI in FE is good enough (by far) for most players. But it pains me when I see people post things that the AI already knows how to do but can't do "better" because it doesn't really know the difference between a workshop and a lumber mill.

Reply #9 Top

So let's say you are talking a build order here, because I'm guessing that's what you want to hardcode (and tech order and hero trait order as well). At least you could put those in their own object types so we can make our own for factions/champs that differ significantly.

Reply #10 Top

Quoting Heavenfall, reply 10
So let's say you are talking a build order here, because I'm guessing that's what you want to hardcode (and tech order and hero trait order as well). At least you could put those in their own object types so we can make our own for factions/champs that differ significantly.

That would require XML work, reading in, etc.  That's not my area of coding and that person is currently working on a different game.

But I could probably get that put into whatever comes after the FE series.  In fact, I think we should probably put some thought into that when the time comes.  I can list the things I'm hampered by when doing AI.  I didn't for instance, consider putting build/research orders into XML.

Reply #11 Top

I'm not that worried about the AI having super efficient build orders. I find that it does fairly well right now. The reason it loses is definitely because of its strategic control of units. It sends it's champions and sovereigns out alone into deathtraps way too much. It also builds tons of units but can't deal with players stacks because it splits its units up among all its cities and tons of small armies.  It doesn't react to player's stacks well either. No matter how well it researches techs and builds improvements if it sends it's units to their death constantly it won't win.

Reply #12 Top

frogboy, would it be possible for the pioneers/ no weapon units(eg escorted girls) to be moved to the back row in tactical combat? as in a archer/ranged heavy army the pioneers get put in the front row, and then the pioneer is the weakest unit, which means the opponents make a beeline for the pioneer and attack to kill it while the archer/ranged units are building up their initive to kill the opponents, and it really pisses me off every time a pioneer in my SOD gets killed.

harpo

Reply #13 Top

Actually, I have come across some puzzling AI cities which had no grain, material or essence.  Beats me how they settled it if there's no grain. :P

Reply #14 Top

I was going to suggest the rearrangement of units in tactical combat somewhere else, but I haven't gotten to it, yet.  It doesn't really fit this thread.  I think that in general the AI doesn't look at weapons when making decisions (that would explain the webbing of the archers).  However, archers are usually behind the melee guys, although that might be because they have no defense.  Of course, if they're arranged by defense, I don't know why the Pioneers would be up front.  I've been trying to figure out what it's doing before posting anything about it.

Reply #15 Top

Things I am looking for in this thread are more stuff like "The AI does this action, ignoring this aspect of the situation.  If the AI checked that aspect first, it would take this other action, instead."  Basically, things that can be fixed with a short if-then loop.  

Like, when the spider is going to use it's web ability, it can check IF the target already is webbed.  If it is, THEN it chooses a new target, and performs the check again.  If all potential targets are webbed, it performs a different action.  This type of checking doesn't apply to just spiders webbing guys.  You can replace "web" with any binary effect that has a duration.  You could do the same check for Curse, for instance.  No point putting two curses on the same guy.

It's not even bugs I'm looking for.  It's just things like that.  The AI didn't check for something and made a bad decision. Here's what it could check for.  Nothing vague.

Reply #16 Top

Quoting Frogboy, reply 11

Quoting Heavenfall, reply 10So let's say you are talking a build order here, because I'm guessing that's what you want to hardcode (and tech order and hero trait order as well). At least you could put those in their own object types so we can make our own for factions/champs that differ significantly.

That would require XML work, reading in, etc.  That's not my area of coding and that person is currently working on a different game.

But I could probably get that put into whatever comes after the FE series.  In fact, I think we should probably put some thought into that when the time comes.  I can list the things I'm hampered by when doing AI.  I didn't for instance, consider putting build/research orders into XML.

As you say, FE's objects aren't strong enough for a total conversion so with that in mind, I don't see any reason to hold back on more hardcoded stuff other than perhaps how useful it will be for future titles. While it would be cool to see the AI handle things like spellcasting dynamically or through better XML tags for identification of purpose, if no XML is possible then that's that.

Reply #17 Top


agreed, Fb year or two ago you planned to do a game so flexible, that you wanted to show during the winter break on how to turn it into MOM total conversion.

for financial reasons it is not achievable/desired anymore. If so leave the current level of moddability where it is and focus on making a better game. in this context better definitely is better strategic and tactical AI.

I understand your feeling when you say AI is good (by far) for most of the players. thing is it isn't IMO. after ten games you can use the known AI patterns and win regardless of level. granted ten games are easily worth 400 hours of gameplay which is much more than you get nowadays. still if you want to extend it (and lure more sales of DLCs) - either allow more modding scope, introduce multiplayer or evolve single player experience.

Reply #18 Top

I dunno about hardcoding, seems like a bit of a short term fix (liek real short term), i'd rather see the xml support stuff done.  Even it means waiting for the next expansion or whatever.   Because won't hardcoding stuff essentially just make the AI *more* predictable, which is not really what is desired... it needs to be *smarter* to adapt to different situations.... eg. if the human player it hitting them with a single big stack, consolidate smaller stacks into their own superstack to combat it, that kind of thing.  Plus hardocding stuff runs the risk that it breaks when more content is added... more work overall I would think.

I would like to see more support for modding (cause I like this engine and love the xml support even if it has some issues), not more stuff that limits what we can do  :thumbsdown:

Frogboy - regarding the AI, for a start tidy up some of the little things.... take look at this thread (the Lumberyard Ai build "bug"):

https://forums.elementalgame.com/439188

If that is correct and the AI isn't building lumber yard line of improvements because of the AI tag, then get someone to fix the xml... it's like a 5 min job, comon mate sort out those little things first  :)

Reply #19 Top

What I'd like to see more from expert players are suggestions on the strategic AI.  I hear how "easy" it is but every time we get a saved game from a player it ends up they were doing something super cheesy that has nothing to do with AI (usually champion abuse or endless eating to heal in tactical).

The AI views the world in terms of what it knows and organizes its strategy in terms of units, armies and army groups.  There are a lot of things I can do to improve it. But I also need honesty from players.  I am not accusing anyone here of not being honest. But what I don't want to do is spend 30 hours making the AI smarter only to have someone talk about how "stupid" the AI is only to find out that the only reason they were winning on high levels was because they had figured out some game design exploit (which isn't cheating or anything but has nothing to do with the AI).

For example:

I can beat the AI, on ridiculous, every time by doing this:

I play as Altar and buy quests and henchmen. I use the quests and henchmen to put together an insanely powerful group. Then I buy a ton of food and walk right over the AI's forces (healing between battles with plenty of food).

Now, to me, I don't see that as "bad AI", I see that as a game design issue that should be addressed. I'm not going to write an AI that does that kind of thing because it would absolutely suck for the 99.9% of players who don't do that thing and don't happen to post on forums.

Personaly, I'd love to get rid of henchmen and food and make it so that if a champion falls in battle they're sent away to the nearest friendly town.  Do that and suddenly the game gets a lot harder on ridiculous.

Reply #20 Top

Quoting abob101, reply 19


If that is correct and the AI isn't building lumber yard line of improvements because of the AI tag, then get someone to fix the xml... it's like a 5 min job, comon mate sort out those little things first 

This sort of thing is why game developers don't hang out in forums. ;) A 5 minute job? I look forward to your game. It should only take you 10 minutes then. (I'm just teasing you, don't mind me)

It's not a 5 minute job to implement something like that. Try 40 engineering hours minimum to have something that would still be pretty weak in terms of having some logic for whether it makes sense to build a lumber yard in a given town. And most players wouldn't notice it.  

What would really be nice is if there was some Python logic that it coudl call that would determine "Should this be built in this city"?  However, supporting Python would be a 200 engineering hour endeavor and then another 200 engineering hours to implement it into the actual game XML.  

They're trying something more basic with the spell system so that spiders won't web already webbed units (and not web archer units).

Code: xml
  1. <ValueCalcWrapper>
  2. <ValueType>IsTargetWorthy</ValueType>
  3. <Calculate InternalName="Calc" ValueOwner="TargetUnit">
  4. <Expression><![CDATA[[Unit_GetWeaponTacticalRange]]]></Expression>
  5. </Calculate>
  6. <Calculate InternalName="Value">
  7. <Expression><![CDATA[[Calc] < 2]]></Expression>
  8. </Calculate>
  9. </ValueCalcWrapper>

So that's how that's being addressed.

 

And mind you, all this could be done (lots of $$$ spent) and the players who already beat the game would still beat the game because the AI isn't winning or losing the game due to these things. It's losing mostly due to champions and how they're handled.

 

 

Reply #21 Top

I just want to see tactical combat AI be smarter... xD

there is plenty (yet boring) challenge on ridiculous or insane (I think the amount of hp gets boring, IF you find a viable strategy anyhoo).
I would love to see each faction balanced, also balanced to custom factions, this would go a long way to remove some of the AI moaning out there I figure.
"Look at my factions its overpowered, I picked the "Lucky" trait and based my faction around dodge...
My biggest grievance lies with:
tactical AI
Autoresolve (which is also part of the AI)
and some of the way the AI units moves
the latter is the one I cannot help with, because it is sooooooo difficult that 99-100% of the games can't get it right.
It is simply impossible to write all the know-hows into the AI to make it make the perfect move each single time apart from spending a lifetime teaching it playing the game.

Another thing that could be focused slightly upon is make it moddable which types of units the AI favours (melee's, ranged, maximum upgraded units, cheap pawns), in this way some modders can play around and try to find a few interesting combinations...

A fifth and final problem with the AI lies in almost all games too, its too predictable how the AI moves, reacts and declares its actions, there is not big enough difference between the different AI personality traits... Again, most games have this flaw, so there is no point stating this more than once or twice.
I will explain why it is a problem though: Whenever I learn how the AI react, I will automatically as a gamer focus my strategies around this knowledge, say if I know the AI is going to field a lot of archers no matter what, I will build my units centered around the fact that it will soon rain down arrows.

Some of MY AI issues lies in the game mechanics and how stack-able some items are, in MY elemental each single unit, town and outpost would gain +1 sight radius, and most units would have different movement points.

Sincerely
~ Kongdej

Reply #22 Top

I am not expert. I beat the game without problems. But I am far below Tuijdy level.


for the strategic level - there is one thing AI doesn't do - it is not using it's strategic level spells.

I've see it does, butit does it far to rarely, and there are situation where there is no doubt, to cast a spell if you have mana - it should tremor, freeze antyhign it see within it's borders.

and there are plenty other not so cheesy tactics - if you have many shards of given type use torando or their equivalents

use mages,

always buy a horse,

never buy more than one of a single item (hint: amulet of initiative),

share equipment between champions - identify good path for him and try to follow it (dodger, tanker, assassin, damage mage, support mage) with skill picks and equipment

focus on your main and secondary hero, level up and equip others at opportunities.

heal your injuries from the main champion when possible.

try to reach master quest / master spell / diplo victory if enabled. (I play with all but conquest disabled, as any of them make game too easy)

 

this are not 'expert' player tactics - just basics you do it when you play, and the AI isn't doing so.

 

on tactical level it's good enough but the tactical battles themselves are shallow and you need to improve them first before upgrading AI. What is missing is monster/unit specific tactics routines. Ie. how to play when you have a spider, how to play if you have throwing knifes (hint: you don't use it because you can. you use it finish of 1 hp enemy in range, that you can't reach with move). How you work with high move archer (hint: you don't back one square, you run as fast as you can or at least outside anemy units range, and you run behind a tank). How you work with large group of units (hint: you concentrate on single enemy group as much as possible)

Reply #23 Top

Quoting Frogboy, reply 21

Quoting abob101, reply 19

If that is correct and the AI isn't building lumber yard line of improvements because of the AI tag, then get someone to fix the xml... it's like a 5 min job, comon mate sort out those little things first 

This sort of thing is why game developers don't hang out in forums. A 5 minute job? I look forward to your game. It should only take you 10 minutes then. (I'm just teasing you, don't mind me)

It's not a 5 minute job to implement something like that. Try 40 engineering hours minimum to have something that would still be pretty weak in terms of having some logic for whether it makes sense to build a lumber yard in a given town. And most players wouldn't notice it.  
 

 

@Frogboy - sorry wasn't being a smart arse.  I appreciate your points but pretty sure in this case it might only be a trivial job because the framework is already there to put the "fix" in place (no coding/engineering required), I may very well but wrong but....

Here is the AiTag for a LumberYard improvement as at 1.2:

<AIData AIPersonality="AI_General">
   <AIPriority>5</AIPriority>
   <AITag>Materials</AITag>
</AIData>

Note the "Materials" tag.  Looking in CoreAIDefs.xml which presumably controls the selection of improvements, the "Materials" tag is not mentioned, for example here it the priorities for a level 1 city:

<!--level 1 city-->
<AIConstructionPriority CityLevel="Outpost">
   <AIPriority InternalName="WorkShop">
      <Type>Improvement</Type>
      <PriorityValue>2.0</PriorityValue>   
   </AIPriority>
   <AIPriority InternalName="Study">
      <Type>Improvement</Type>
      <PriorityValue>3.0</PriorityValue>
   </AIPriority>
   <AIPriority InternalName="CommandPost">
      <Type>Improvement</Type>
      <PriorityValue>5.0</PriorityValue>
   </AIPriority>
   <AIPriority InternalName="Housing">
      <Type>Improvement</Type>
      <PriorityValue>2.0</PriorityValue>
   </AIPriority>
   <AIPriority InternalName="Merchant">
      <Type>Improvement</Type>
      <PriorityValue>2.25</PriorityValue>
   </AIPriority>
   <AIPriority InternalName="Farming">
      <Type>Improvement</Type>
      <PriorityValue>3.0</PriorityValue>
   </AIPriority>
   <AIPriority InternalName="Arcane">
      <Type>Improvement</Type>
      <PriorityValue>1.0</PriorityValue>
   </AIPriority>
   <AIPriority InternalName="Prestige">
      <Type>Improvement</Type>
      <PriorityValue>0.10</PriorityValue>
   </AIPriority>
</AIConstructionPriority>

So no materials.  Presumably that's why the AI isn't building any LumberYards.  We know that Lumberyards are good value for money, they're pretty much one of the first things a human player constructs (if they're near a forest).

Here is the AiTag for a Workshop improvement:

<AIData AIPersonality="AI_General">
   <AIPriority>9</AIPriority>
   <AITag>Workshop</AITag>
   <AIEarlyBuildUpMultiplier>10</AIEarlyBuildUpMultiplier>
</AIData>

The Lumberyard provides pretty much the same sort of GameModifier as the Workshop, so presumably if you just give the Workshop AITag to the Lumberyard... the AI will start to build LumberYards... which is good and would make the AI "better".

As I said I could very well be wrong, i'm away from home so can't test this at the minute but I will as soon as I get a chance.

Cheers.

Reply #24 Top

AI does build lumber yards though. 

The issue isn't whether it will or won't build a particular type of building. It's a question of intelilgently priortizing it for a given city better than it currently does.  Whether it's a workshop or a study, the AI only has very general concepts of when to build them.  

There are two ways to solve that.  The first way would be to put "AI logic" into the XML via a scripting language of some kind OR you put it into the C++ source code.

 

Reply #25 Top

So you could define rules in the XML like, for example, if the city has significant unrest, put Bell Tower or Cleric at the head of the build queue.  There's less priority to have those lumber mills if half of production is being wasted.