Author Topic: Difficulty for fully "smart" AI  (Read 6473 times)

Offline Elestan

  • Full Member Mark II
  • ***
  • Posts: 158
Difficulty for fully "smart" AI
« on: September 09, 2015, 09:59:34 pm »
Does increasing the difficulty above 7 make the AI play any smarter, or does it just get more resources?

Offline Wingflier

  • Core Member Mark II
  • *****
  • Posts: 2,753
  • To add me on Steam, click the little Steam icon ^
Re: Difficulty for fully "smart" AI
« Reply #1 on: September 10, 2015, 02:22:09 am »
It gets smarter and it gets more resources.
"Inner peace is the void of expectation. It is the absence of our shared desperation to feel a certain way."

Offline Elestan

  • Full Member Mark II
  • ***
  • Posts: 158
Re: Difficulty for fully "smart" AI
« Reply #2 on: September 10, 2015, 02:56:44 am »
It gets smarter and it gets more resources.

Can you give any specifics on how it gets smarter, and at what difficulty level(s)?

Offline Shrugging Khan

  • Hero Member Mark III
  • *****
  • Posts: 1,217
  • Neinzul Y PzKpfw Tiger!
Re: Difficulty for fully "smart" AI
« Reply #3 on: September 10, 2015, 03:47:42 am »
AFAIK the AI has its full bag of tricks at Difficulty 8. But that's old information, so you might want to hear it from someone else.
The beatings shall continue
until morale improves!

Offline Mánagarmr

  • Core Member Mark V
  • *****
  • Posts: 4,272
  • if (isInRange(target)) { kill(target); }
Re: Difficulty for fully "smart" AI
« Reply #4 on: September 10, 2015, 05:25:03 am »
AFAIK the AI has its full bag of tricks at Difficulty 8. But that's old information, so you might want to hear it from someone else.
I thought that was a 7. The AI will work at full capacity at 7, but start to get increased resources and a few hardcoded tricks on higher diffs?
Click here to get started with Mantis for Suggestions and Bug Reports.

Thank you for contributing to making the game better!

Offline Shrugging Khan

  • Hero Member Mark III
  • *****
  • Posts: 1,217
  • Neinzul Y PzKpfw Tiger!
Re: Difficulty for fully "smart" AI
« Reply #5 on: September 10, 2015, 05:29:52 am »
IIRC, someone (Keith?) told me that there were some few trickeries reserved for diff 8, while 7 was considered normal and best-balanced. Or maybe whoever told me that just wasn't sure and gave it some room.
The beatings shall continue
until morale improves!

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Difficulty for fully "smart" AI
« Reply #6 on: September 10, 2015, 11:34:05 pm »
There are a handful reserved for 8, but largely speaking the AI has "all the tools" at 7.  There's also a few tools that have scalers on them that get sharper as the difficulty increases (how much strategic reserve it will throw at any given event, how much strength it will consider "overpowering," etc).

Offline Elestan

  • Full Member Mark II
  • ***
  • Posts: 158
Re: Difficulty for fully "smart" AI
« Reply #7 on: September 11, 2015, 02:21:49 am »
Could you say what the ones reserved for 8 are?

The reason I ask is that in my current 7/7 game, the AI seems to be nearly always moving on straight-line paths toward obvious targets (usually my command station).  This makes it predictable, and would seem to be contrary to Chris' "NEVER Code The Best Choice In" rule.

This also leads to the dominance of the "25 sq ft of scorched earth" defensive style exemplified in Kahuna's guide.  That guide scoffs at putting defenses around wormhole entrances, preferring instead to create a saturation kill zone at the AI's  flight-path intersections.  But that only works because the AI walks into the kill zone; it seems like if the AI played cleverly, it would path-find around the kill zone, perhaps swinging wide around and coming at the targets from their vulnerable back side.

Does it ever get smart enough not to walk into the oven?

Offline Mánagarmr

  • Core Member Mark V
  • *****
  • Posts: 4,272
  • if (isInRange(target)) { kill(target); }
Re: Difficulty for fully "smart" AI
« Reply #8 on: September 11, 2015, 06:50:05 am »
Could you say what the ones reserved for 8 are?

The reason I ask is that in my current 7/7 game, the AI seems to be nearly always moving on straight-line paths toward obvious targets (usually my command station).  This makes it predictable, and would seem to be contrary to Chris' "NEVER Code The Best Choice In" rule.

This also leads to the dominance of the "25 sq ft of scorched earth" defensive style exemplified in Kahuna's guide.  That guide scoffs at putting defenses around wormhole entrances, preferring instead to create a saturation kill zone at the AI's  flight-path intersections.  But that only works because the AI walks into the kill zone; it seems like if the AI played cleverly, it would path-find around the kill zone, perhaps swinging wide around and coming at the targets from their vulnerable back side.

Does it ever get smart enough not to walk into the oven?
I think we'll have to poke Keith for that one. As far as I'm aware, the individual ship AI isn't very smart, although command level AI (group AI) can be pretty decent. Especially at splitting up and hitting multiple targets. It's possible that the AI doesn't take the path to its target in consideration, just the target location. So if it sees a lot of defense near the target, it'll go for something else. But if the path there is a grinder, it might miss it. I don't know how the AIs perception works.
Click here to get started with Mantis for Suggestions and Bug Reports.

Thank you for contributing to making the game better!

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Difficulty for fully "smart" AI
« Reply #9 on: September 11, 2015, 07:12:04 am »
Does it ever get smart enough not to walk into the oven?
Kind of. The AI (waves) will retreat if it's heavily outnumbered and regroup on an adjacent AI planet. It also wont attack heavily defended planets and will try to go around them. But if the AI "thinks" it has a chance to win it will "happily" "walk into the oven". You can select the "Cowardly" AI as the secondary AI type so it will be more careful about "walking into the oven". Cowardly AI will lead to massive threat fleets with potentially deadly consequences. If you have masochistic tendencies you can also try the Retaliatory AI type which has a huge number of Counterattack Guard Posts. Counterattack waves spawn randomly on the edge of the planet's gravity well so you never know where they're coming from.

EDIT:
I think we'll have to poke Keith for that one. As far as I'm aware, the individual ship AI isn't very smart, although command level AI (group AI) can be pretty decent. Especially at splitting up and hitting multiple targets. It's possible that the AI doesn't take the path to its target in consideration, just the target location. So if it sees a lot of defense near the target, it'll go for something else. But if the path there is a grinder, it might miss it. I don't know how the AIs perception works.
AI always flies straight to it's target.

Also if I remember correctly the AI is at it's full potential at 8 difficulty level. At that point it takes into account the player's mobile firepower (when considering whether to attack the player or not) 2 or 3 hops away.. don't remember which one it was. It's also more careful about "walking into the oven/grinder". There might be some other things too but that's all I can remember now. I'm not sure if difficulty affects on how the AI uses it's Special Forces and the Strategic Reserve but I don't think so. Of course at higher difficulty levels the AI gets more reinforcements and send bigger waves etc.
« Last Edit: September 11, 2015, 07:27:10 am by Kahuna »
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!

Offline Elestan

  • Full Member Mark II
  • ***
  • Posts: 158
Re: Difficulty for fully "smart" AI
« Reply #10 on: September 11, 2015, 09:58:02 am »
It's possible that the AI doesn't take the path to its target in consideration, just the target location. So if it sees a lot of defense near the target, it'll go for something else. But if the path there is a grinder, it might miss it. I don't know how the AIs perception works.
AI always flies straight to it's target.

Also if I remember correctly the AI is at it's full potential at 8 difficulty level. At that point it takes into account the player's mobile firepower (when considering whether to attack the player or not) 2 or 3 hops away.. don't remember which one it was.

Wait, so it can "see" behind your lines, even without having scouts there?  That doesn't seem kosher; it seems like the AI using information it shouldn't have.

I'd love to see how the game would change if the AI gained the ability to see and avoid at least your stationary firepower.  A simple approach might work like this:
  • Have the system-level tactical AI generate a 100x100 "DPS elevation map" of the system, where the "height" of each point is the player's total DPS at that location from stationary sources.  If a point is under a grav effect, multiply the DPS by the speed reduction.
  • Plot a bunch of paths from entry to target along various arcs, ranging from a direct line to circling wide around the edge of the system's gravity well.
  • Sort the paths by the estimated total damage they'll inflict, and probabilistically (to avoid being predictable) pick one of the lower-cost paths.  If there's a lot of mobile defense, maybe split the AI forces between several paths to force the player to react.
The map might take a fraction of a second to generate, but it wouldn't need to be regenerated that often.  There are probably plenty of refinements involving treating the outer edges of the turrets' range circles as possible paths, testing hybrid paths that start as arcs and then go straight-line (or the reverse), using a real hill-climbing (valley-following?) algorithm, and generating hull-type specific DPS maps.

If the AI did this, it might eliminate the need for it to use such overwhelming force on the attack.  It would also reduce the 25 sq. ft. zone of death issue; people would have to focus their defenses on the wormholes, probably with a second defensive line around the target structures.  To me, that would be more fun to play than just trying to maximize the DPS at a single point.

I filed an issue for this at https://arcengames.com/mantisbt/view.php?id=17447.  Vote if you like it!
« Last Edit: September 11, 2015, 04:33:57 pm by Elestan »

Offline Aklyon

  • Core Member
  • *****
  • Posts: 2,089
Re: Difficulty for fully "smart" AI
« Reply #11 on: September 11, 2015, 11:23:13 am »
Previously, you could cheese the AI into attacking an obvious trap by pulling your fleet away from it so it appeared weaker. Then it rushes in, you rush in, and ka-blam! AI loss.

So the AI was reminded to pay attention to your (nearby) shenanigans before assaulting.

Offline Elestan

  • Full Member Mark II
  • ***
  • Posts: 158
Re: Difficulty for fully "smart" AI
« Reply #12 on: September 11, 2015, 11:53:35 am »
Previously, you could cheese the AI into attacking an obvious trap by pulling your fleet away from it so it appeared weaker. Then it rushes in, you rush in, and ka-blam! AI loss.

So the AI was reminded to pay attention to your (nearby) shenanigans before assaulting.
That's fine, IMHO, if the AI does it by remembering that it saw a huge amount of mobile strength in the vicinity.  It would also be fine for the AI to try to send in probing raids with FF/Tractor immune and/or cloaked ships just to try to see whether I had forces nearby.  But it sounds like the AI is being allowed to ignore the fog-of-war, and that's not playing smart; it's just cheating.  The ambush you describe is a perfectly valid tactic, and I think the AI should have to counter using its own tactics, not by breaking the rules.

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Difficulty for fully "smart" AI
« Reply #13 on: September 11, 2015, 11:59:33 am »
Wait, so it can "see" behind your lines, even without having scouts there?  That doesn't seem kosher; it seems like the AI using information it shouldn't have.
It would also be fine for the AI to try to send in probing raids with FF/Tractor immune and/or cloaked ships just to try to see whether I had forces nearby.  But it sounds like the AI is being allowed to ignore the fog-of-war, and that's not playing smart; it's just cheating.
The AI is designed to be asymmetrical. The AI in AI War is not designed to imitate human behavior. The AI has already won the war against humans and dominates the galaxy. It's meant to be omnipotent. I mean the AI has unlimited resources too.

I'd love to see how the game would change if the AI gained the ability to see and avoid at least your stationary firepower.  A simple approach might work like this:
  • Have the system-level tactical AI generate a 100x100 "DPS elevation map" of the system, where the "height" of each point is the player's total DPS at that location from stationary sources.  If a point is under a grav effect, multiply the DPS by the speed reduction.
  • Plot a bunch of paths from entry to target along various arcs, ranging from a direct line to circling wide around the edge of the system's gravity well.
  • Sort the paths by total DPS cost, and probabilistically (to avoid being predictable) pick one of the lower-cost paths.  If there's a lot of mobile defense, maybe split the AI forces between several paths to force the player to react.
The map might take a fraction of a second to generate, but it wouldn't need to be regenerated that often.  There are probably plenty of refinements involving treating the outer edges of the turrets' range circles as possible paths, testing hybrid paths that start as arcs and then go straight-line (or the reverse), using a real hill-climbing (valley-following?) algorithm, and generating hull-type specific DPS maps.

If the AI did this, it might eliminate the need for it to use such overwhelming force on the attack.  It would also reduce the 25 sq. ft. zone of death issue; people would have to focus their defenses on the wormholes, probably with a second defensive line around the target structures.  To me, that would be more fun to play than just trying to maximize the DPS at a single point.
Something like that would surely make the game somewhat harder. Defending against that would require different turret positioning.

On the other hand:
Quote from: Chris Park
First, the way that AI systems in most games work is via giant decision trees (IF A, then C, IF B, then D, etc, etc). This can make for human-like behavior up to a point, but it requires a lot of development and ultimately winds up with exploitable flaws. My favorite example from pretty much every RTS game since 1998 is how they pathfind around walls; if you leave a small gap in your wall, the AI will almost always try to go through that hole, which lets human players mass their units at these choke points since they are “tricking” the AI into using a hole in the wall that is actually a trap. The AI thus sends wave after wave through the hole, dying every time.
If the AI did that it would also have to take into account turrets' ranges and stay away from them. Sniper and Spider Turrets have infinite range. Missile Turrets and Military Command Stations have a very long range. So the AI trying to abuse the "weak points" could buy the player more time to whittle it down with long range turrets and engine damage. And to get in range of the player's Command Station the AI would have to get in range of all (or at least most) of the player's turrets anyway. That AI change could also render some of the shorter range turrets mostly useless so the turrets would have to be rebalanced.

On the topic.. here's an interesting article about the design decisions:
Designing Emergent AI, Part 1: An Introduction
(That article has 6 parts.)
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!

Offline Elestan

  • Full Member Mark II
  • ***
  • Posts: 158
Re: Difficulty for fully "smart" AI
« Reply #14 on: September 11, 2015, 01:58:12 pm »
The AI is designed to be asymmetrical. The AI in AI War is not designed to imitate human behavior. The AI has already won the war against humans and dominates the galaxy. It's meant to be omnipotent. I mean the AI has unlimited resources too.

There's a difference between fighting an asymmetric opponent (which can be fun), and a cheating opponent (which is not, at least for me).  The AI, I think, is designed to have a superior starting position, but its resources in this galaxy are limited by how quickly it can move forces in from the other galaxy.  And just because it has a resource advantage does not mean that it deserves to be allowed to break other rules, like fog-of-war.  For me, fighting against an opponent who counters my tactics by breaking the rules is not fun.

Quote
On the other hand:
Quote from: Chris Park
...“tricking” the AI into using a hole in the wall that is actually a trap.

Right, which is why my recommendation was to choose the path probabilistically, not deterministically, so the player can never be sure what route the AI will take.  It's more likely to pick a route with lower cumulative DPS, but it might pick another.  But in any case, flying through the intersection of every turret's firing arc is almost certainly not a good move on the AI's part; no human would make that mistake.

Quote
If the AI did that it would also have to take into account turrets' ranges and stay away from them. Sniper and Spider Turrets have infinite range. Missile Turrets and Military Command Stations have a very long range. So the AI trying to abuse the "weak points" could buy the player more time to whittle it down with long range turrets and engine damage. And to get in range of the player's Command Station the AI would have to get in range of all (or at least most) of the player's turrets anyway. That AI change could also render some of the shorter range turrets mostly useless so the turrets would have to be rebalanced.

The algorithm I posited implicitly takes the turret ranges into account by building the DPS map; the infinite range stuff would be essentially ignored since it affects all points equally.  It would strike a "fuzzy" balance between cutting through the kill zones and going around them.  I'm certain that it would require some rebalancing, especially to the "attack vs. build up more" decision logic.

Quote
On the topic.. here's an interesting article about the design decisions: Designing Emergent AI, Part 1: An Introduction
Yep; I read all six parts before I bought the game, and one of the things that convinced me to buy it was this statement:
Quote from: Chris Park
The AI ships never get bonuses above the players, the AI does not have undue information about player activities, and the AI does not get bonuses or penalties based on player actions beyond the visible AI Progress indicator (more on that below). The strategic and tactical code for the AI in the game uses the exact same rules as constrain the human players, and that’s where the intelligence of our system really shines.
Letting the AI bypass the fog-of-war is a direct violation of this design precept.