Coding frustrations with AI

By on July 14, 2013 9:42:37 PM from JoeUser Forums JoeUser Forums

Frogboy

Join Date 03/2001
+1469

Since the beginning of Fallen Enchantress, people have claimed that the AI monsters will sit next to any enemy city and not attack.  They concluded that the monsters were giving AI players a pass. 

I have responded that I have looked at the code over and over and the monsters do not treat computer players any differently.

Well, tonight I’m seeing the behavior very starkly.

image

These ogres should be wiping out this AI city.

image

The code says that the ogres want to wipe out the AI city.

They are explicitly targeting it.

..

And yet..

The attack never happens.

As a result, the monsters are just standing there, stuck outside the city.   Now, I’ve got a few thousand hours of game time on this and this is the first time I’ve seen it where I knew it should be attacking (i.e. I’ve seen well defended cities with monsters outside).  So it’s not that common.  But based on forum feedback, it’s definitely something others have seen.

Now, I have to find out why they are being prevented from attacking.

Stay tuned..

 

Update 1: Seems to be path finding related. This is going to take some digging.

 

Update 2:

New check in.

+ AI Removed conflicting code that caused monsters to behave outside the control of the AI
+ AI Monsters more careful about leaving their lairs unguarded.
+ AI Updated the area threat evaluation to include stationed units.
+ AI champions significantly better about taking out enemy outposts and grabbing goodie huts on the way to another destination
+ AI better at building more lethal armies
+ AI much better at protecting its cities
+ AI fixed a bug where certain AI personalities had a chance of not building units when they should depending on the type of city
+ AI more aggressive about training units when it feels that city is vulnerable
+ AI no longer has a "auto patrol" system. Instead, the monster AI directly controls monsters and not the mobileobject system.
+ Fixed a pathfinding bug that caused monsters that were calculating a destination to not be able to set a destination IF the target was 1 tile away and it is a city.

Locked Post 37 Replies
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2013 10:01:36 PM from Elemental Forums Elemental Forums

  should you choose to accept the mission.... (theme song running in background...)

Good luck!

 

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2013 10:56:07 PM from Elemental Forums Elemental Forums

Unackowledged bug;

Monsters ruin only me.

It is pathfinding

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2013 11:11:00 PM from Elemental Forums Elemental Forums

I'm glad that you are finding these issues. I can't imagine that it will be easy to ferret these problems out. Thanks for fixing the IsTargetWorthy tags or (who ever did that)

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 1:45:11 AM from Elemental Forums Elemental Forums

Thanks Frogboy.  We may be crazy, but we aren't crazy..

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 4:19:40 AM from Elemental Forums Elemental Forums

It's actually a problem if you're in a crazy world and you're supposedly sane.  Although I do think there's more good than bad in the world, especially now.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 6:18:10 AM from Elemental Forums Elemental Forums

Im glad you are checking into this, because in my games Ive seen this alot.  I tend to play with lots of monsters running around, and watching them just ignore the AI players, and yet come for me is very aggravating.  GL and thanks for starting this post to keep us in the loop!

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 6:55:58 AM from Elemental Forums Elemental Forums

Omg, it's first time i see that dev talk with users on forum and explain problems.

keep up good work!

 

PS. yes, sometimes monsters are too passive with AI.

Also it'll be cool, that monsters in zone of city are more likely to attack this city (to protect it's lair).

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 7:20:54 AM from Sins of a Solar Empire Forums Sins of a Solar Empire Forums

first seen in wom, then in FE , and now LH, monsters favour the AI(and not attack) and attack humans at first sight.

check, are they monsters?

if they do not attack ai and do attack humans, then yes they ARE monsters.

thanks for finally seeing the issue and even posting that you have seen the issue, and are even working on it

thanks frogboy

harpo

 

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 7:55:54 AM from GalCiv II Forums GalCiv II Forums

Pathfinding sounds like it should be easy, but isn't.  I have noticed that there is a weird bias towards attacking north-west.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 11:55:17 AM from Elemental Forums Elemental Forums

Could it have anything to do with the AI factions and monsters going at the same time?

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 12:12:03 PM from Elemental Forums Elemental Forums

The frustrating thing is that it's 1 tile away.  How hard is that to find  path for?

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 12:27:05 PM from Elemental Forums Elemental Forums

If it is pathfinding, I would guess that it's trying to pathfind to the other side of the city.  It can't do that because the city takes up the tiles between the ocean and the gorge.  So the monsters just stand there scratching their butts.

Hmm, could it be that AI improvements are somehow blocking monsters from pathfinding into cities?  So when the player takes the city over the improvements are destroyed and then the pathfinding succeeds and the monster beelines to the city.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 12:33:32 PM from Elemental Forums Elemental Forums

Quoting hedetet,

Unackowledged bug;

Monsters ruin only me.

It is pathfinding

Actually the bug affects everyone equally. It just seems like it only affects you because you see cases where there are monsters sitting right outside a city unable to attack.  Monsters DO attack cities very often. But there is a case (which I think I've tracked down) where the pathfinding gets stuck.  It would happen to a human too but humans tend to deal with monsters before they get to their front door.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 12:49:35 PM from Elemental Forums Elemental Forums

Quoting Frogboy,
The frustrating thing is that it's 1 tile away.  How hard is that to find  path for?

I feel and see the pain. When the AI targets the city, is it trying to target the closest city tile or is it targeting another tile within the city that it cannot reach? From your screenshot it may be that the Ogre is trying to target the part on the other side of the city that it cannot reach since there is a chasm in the way. The center of that city, if I put a tack in it would be on that small building on the other side.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 12:58:23 PM from Elemental Forums Elemental Forums

Quoting sweatyboatman,

If it is pathfinding, I would guess that it's trying to pathfind to the other side of the city.  It can't do that because the city takes up the tiles between the ocean and the gorge.  So the monsters just stand there scratching their butts.

Hmm, could it be that AI improvements are somehow blocking monsters from pathfinding into cities?  So when the player takes the city over the improvements are destroyed and then the pathfinding succeeds and the monster beelines to the city.

That is what I'm thinking too.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 2:14:53 PM from Elemental Forums Elemental Forums

at city border (or cant move) = attack next move + random % (still using brains)

Dont make it hard on yourself.  finally got to put 8 hrs in this weekend and loved it.  You guys finally nailed it.

 

Thanks frog!

 

Edit-

 

If they already are moving (left the lair or a city) put in a check to make sure they dont sit in one spot for more than 2 turns or something.  Even if its 8 turns till they can re-pathfind (they try each direction).  Just make a movement in one of the directions and let the path finding work.  That would scare the crap out of me also. NE didnt work,  well try SE kinda thing.

 

just a thought.  I pay you guys to make games.  lol.  If I could do what your doing I wouldnt have to.

 

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 4:35:07 PM from Elemental Forums Elemental Forums

The AI factions will do the same thing as speculated at here.  I had Kulan and his army camping outside a city of mine for at least 20 turns as the whole city occupied the passable terrain between a mountain range and the sea.  I think he moved again when the Night of Haunted Dreams event was launched...

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 7:34:42 PM from Elemental Forums Elemental Forums

I hate path finding.  Ugh.  It's one of those things you have to debug by seeing it and stepping through tile by tile. 

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2013 8:38:36 PM from Elemental Forums Elemental Forums

Good post. Looking forward to seeing these long standing problems fixed, it is what is needed to make an already good game great.

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2013 12:30:46 AM from Elemental Forums Elemental Forums

Good Luck!  Awesome challenge pickup.

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2013 12:41:06 AM from Elemental Forums Elemental Forums

I don't envy you on this one.  It might also tie into why Monsters will beeline 10 squares away to attack my stuff while disregarding AI units/cities/outposts.

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2013 6:38:20 AM from Elemental Forums Elemental Forums

AI updates look good.  Will be nice to play a game where you actually feel threatened in the early stages.  I rarely see the need to garrison my cities until an A.I. declares war in current games.  Is there an ETA for these?

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2013 10:20:36 AM from Elemental Forums Elemental Forums

Quoting ,

 

Update 2:

New check in.

+ AI Removed conflicting code that caused monsters to behave outside the control of the AI
+ AI Monsters more careful about leaving their lairs unguarded.
+ AI Updated the area threat evaluation to include stationed units.
+ AI champions significantly better about taking out enemy outposts and grabbing goodie huts on the way to another destination
+ AI better at building more lethal armies
+ AI much better at protecting its cities
+ AI fixed a bug where certain AI personalities had a chance of not building units when they should depending on the type of city
+ AI more aggressive about training units when it feels that city is vulnerable
+ AI no longer has a "auto patrol" system. Instead, the monster AI directly controls monsters and not the mobileobject system.
+ Fixed a pathfinding bug that caused monsters that were calculating a destination to not be able to set a destination IF the target was 1 tile away and it is a city.

I think I'm going back down to challenging/challenging.

Great work Brad!! 

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2013 11:04:16 AM from GalCiv II Forums GalCiv II Forums

Fantastic.  There's an incentive to keep cities better protected now.

Thanks for the hard work.

Reason for Karma (Optional)
Successfully updated karma reason!
July 16, 2013 2:19:06 PM from Elemental Forums Elemental Forums

Awesome job. Looks like a great improvement to the comfort factor when playing. I always had great "fun" with mobs killing my newly captured AI cities a couple of turns after I left coming from nowhere ^^

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108433  walnut3   Server Load Time: 00:00:00.0000500   Page Render Time: