The Sinister Design Forums

Games => TSoG => TSoG Bugs => Topic started by: KZ on February 05, 2010, 06:48:12 PM

Title: Gaps in and bugs in enemy AI
Post by: KZ on February 05, 2010, 06:48:12 PM
The initial thread can be found here (http://sinisterdesign.freepowerboards.com/viewtopic.php?f=13&t=1929). Essentially, help CraigStern imrpove the enemy AI in TSoG by making it more efficient- if you find a situation where the enemy could've made a better move, or attack in a way as to deal more damage to teammates, or simply glitched, write a short summary here (on occaison a screenshot can come in handy).
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on February 07, 2010, 10:56:07 PM
(on occaison a screenshot can come in handy).

I just want to emphasize this more--always post a screenshot if you can! It saves me a huge amount of trouble trying to figure out the placement of the various units involved.
Title: Re: Gaps in and bugs in enemy AI
Post by: algebra15 on February 20, 2010, 06:23:04 AM
I'm not quite sure that this is a bug, but with one-move-per-turn units, like the Ghost Knight and the Bronze Golem, in the battle "Bug Hunting," when you are separated from the unit by only a wall object, they will move off to one side, but then go right back to where they were, and get no closer to the Hero. Very useful for regenerating Psy points, but I don't think that was intended. Maybe smarter AI, or maybe a low percentage of a random motion so as to break the monotony. If the character has destroyed all of the units but a slow mover, this means they can sit still for as long as they like and win the battle by surviving 35 turns.
Title: Re: Gaps in and bugs in enemy AI
Post by: Alan on February 24, 2010, 01:48:36 PM
similarly, you can trick the units in the parent rescue mission, with Arman, even though they have more than one move.  Once the AI sends some units in one of the corridors, if you go to a different corrridor and keep moving up and down it, the AI units in their corridors keep moving up and down their corridor trying to match you, and end up not trying to get closer to you horizontally- although the best move (splitting the AI forces so that some approach the final corridor from the bottom and the top) would likely be difficult to program...
Title: Re: Gaps in and bugs in enemy AI
Post by: algebra15 on February 28, 2010, 04:46:37 PM
Just figured something out. If you want to take down a slow mover like a B. Golem or a Ghost Knight or Stone Golem, you can draw their fire with a Solid State Shield. You can use Set to make the shield, then keep people out of range. Use Set's static shield to boost the Solid State's health, then let the opponent damage it. If Set has a high Psy Defense level, you have one or two turns in between each time you need to heal the shield with Mega, and can regenerate the Psy Points. If you need to increase the Shield's health, this is something of a drain on Set's PsP, and having to maintain the shield's health doesn't help; so... you can recruit the Hero to help maintain the Shield while Set gets the PsP necesary to upgrade the Solid State Shield. The Hero also helps if the shield is taking more than half of Set's Mega Shield healing power per turn. 
Once this shield is in place, the enemy is facing it, and you are free to hit it with attacks of any type, even the ones it may be resistant to, or ones that take a lot of PsP-- without getting hit once by the opponent. However, it's mostly just fun for the player to have an almost-invincible shield standing there, and to know that the actual characters aren't getting hit, and I don't know that this allows you to do anything you couldn't already do. Just thought I'd let you know!


(http://www.mediafire.com/imgbnc.php/5cc7377fd712d23019b1d8a39c8a5fa84g.jpg)

Oh, it works for Shadow Bugs too!
Title: Re: Gaps in and bugs in enemy AI
Post by: Ertxiem on March 01, 2010, 08:04:12 PM
The "corridor blocking" gap referred by Alan exists since TRPG2.
I think that the AI could be programmed to overcame that problem in 4 ways:
- The deterministic way would rely on an unit advancing preferably on the direction where the distance is bigger;
- The probabilistic way would rely on tossing a coin when 2 paths are available;
- The (occasionally) random way would rely on, from time to time (or with probability 20%), an enemy would move in a random direction, while the rest of the time the enemy would use the regular AI with one of the above 2 choices, if necessary.
- The hard way would imply a (shortest) path finding algorithm by the AI.

The hard way would be the best way, if not for the fact that it's hard to code and potentially slows down the execution time. The way that the Telepath World is made (deterministically) is more consistent with the first option. However, the second option may result more often in the enemies finding a way out.
Title: Re: Gaps in and bugs in enemy AI
Post by: Frosty on March 11, 2010, 08:27:27 PM
I can't post a screenshot, but if you use Luca's juxtapose while she is over a chasm, the person gets over the chasm, wether they float or not. Sorry I can't post a screenshot.
Title: Re: Gaps in and bugs in enemy AI
Post by: Presentiment on March 11, 2010, 09:28:53 PM
^ that isn't an AI problem, and

I thought it was intentional.
Title: Re: Gaps in and bugs in enemy AI
Post by: Zhampir on March 11, 2010, 09:49:56 PM
Correct Presentiment, this is not a bug in enemy AI but it is a bug in the AI. There should likely be a check ran to see if the space Luca is on is normally reachable by non fliers. Sure she can teleport them to the other side of a wall but she shouldn't be able to teleport them into the wall.
Title: Re: Gaps in and bugs in enemy AI
Post by: KZ on March 14, 2010, 04:07:26 PM
She doesn't teleport folks into a wall, as she herself cannot be over it. However, she can teleport folks over chasms, lava, etc. It would be too difficult and time consuming to code othersiwe, hence I suggest giving an explanation to the said phenomena: Luca continues to link-up to and support the unit she just juxtaposed with, such that some of here characteristics, like flying, are still partly residuent with the person she swapped places with, thus, she is more alive after juxtapose, whilst the person is more in the spirit realm, and has a few lingering properties for a short period of time.
Title: Re: Gaps in and bugs in enemy AI
Post by: Zhampir on March 14, 2010, 04:11:03 PM
That... is very interesting, but couldn't that suggest that if Luca wanted(and knew how to) to she could switch her ghostly form for the form of a living person? (that would be an interesting plot twist, especially if  an odd romance was started between Luca and Duvalier before she turned human)
Title: Re: Gaps in and bugs in enemy AI
Post by: KZ on March 20, 2010, 07:16:37 AM
Ok, here is a small AI improvement that can be made for the Lesser Ghost: as indicated on the image, the ghost was on the red tile, it could've easily backstabbed Arman (green path), but instead it went for a side-attack (red path), methinks the AI could be more powerful, if it would go for back-stabbing more often

(http://s2.postimage.org/eMyt9.jpg) (http://www.postimage.org/image.php?v=TseMyt9)
Title: Re: Gaps in and bugs in enemy AI
Post by: Zhampir on March 20, 2010, 08:48:29 AM
perhaps the AI was trying to keep from being attacked itself?
Title: Re: Gaps in and bugs in enemy AI
Post by: Alan on March 20, 2010, 10:38:08 AM
Yes, that is possible what Zhampir said... In my experience I have found the AI takes backstabbing opportunities most, if not all, of the time... although a look at the image makes it apparent that not only did the ghost take the less powerful attack, but I believe made itself more, not less open to attack... If it had backstabbed Arman, it would have its side and back covered because of the board edge and line of barrels... now it not only had a weaker attack, but arman can walk around the barrels and backstab the ghost... its two positions also don't really put it farther from anyone else who can hit the ghost (except  Set, who couldn't harm the ghost anyways, and could probably still reach the ghost in its current position if he did have attacks.)
Title: Re: Gaps in and bugs in enemy AI
Post by: Alan on March 20, 2010, 10:43:31 AM
Okay, looked at the map agian, Zhampir could still be right... depending on skills and turn order in the backstab position the ghost could be in range of Rahel, Griffin, and the Hero, and possibly can't be reached by some or all of those.  But even if there was some sort of self-protection code, it wouldn't make sense in this sort of situation, as a good number of ghosts are still alive and the AI should just do as much damage as possible... since there are other targets for the heroes, dealing less damage to protect a single ghost makes no sense.
Title: Re: Gaps in and bugs in enemy AI
Post by: Presentiment on March 20, 2010, 12:28:01 PM
My main beef with the AI is that it will never attack anything five squares away. For example, in the Guards battle, your main has 18 HP and a guard is five squares away. It will not walk three squares and throw a spear to kill you, but it will just move two.

The AI needs to be more aggressive.
Title: Re: Gaps in and bugs in enemy AI
Post by: Zackirus on March 20, 2010, 12:36:42 PM
My main beef with the AI is that it will never attack anything five squares away. For example, in the Guards battle, your main has 18 HP and a guard is five squares away. It will not walk three squares and throw a spear to kill you, but it will just move two.

The AI needs to be more aggressive.

I argee with Presentiment, the A.I should attack you when ever possible, and if they can reach it, always go for a backstab or your party.
Title: Re: Gaps in and bugs in enemy AI
Post by: KZ on March 20, 2010, 03:28:07 PM
perhaps the AI was trying to keep from being attacked itself?
As far as I am aware, the AI doesn't have self-preservation mechanism - if it can, it will attack and try to deal the most damage.
In fact, from what I see, TSoG employs units that have had their AI written over very long period of time, such that some of the most basic and oldest units have realtively primitive AI- 'cause the latest AI to roll out is pretty good in comparison- take the Greater Ghost,for instance. But then again, the old AI has been patched up during TPA2 production. All I know is that if all AI is of the level of Greater Ghost, the enemies will pose a greater challenge.
Title: Re: Gaps in and bugs in enemy AI
Post by: MikeW781 on March 28, 2010, 04:00:14 PM
i agree, with Presentiment, whenever I am more than a melee fighters immeadiate reach (i.e. they cannot attack me this turn) the enemy will only move 1 step at a time, making the solo fight with Arman really easy (I just leap on to the largest roof and stay there)
Title: Re: Gaps in and bugs in enemy AI
Post by: MikeW781 on April 02, 2010, 04:21:36 PM
addition to the point of the AI not being aggresive:
OOX
OXO
OXO
OOO
OMO
X=GAURD
M=MAIN
O=EMPTY

Next turn I kill the two guards nearest to me, and the remaining guard, who could have finished me by using all 3 steps then his spear throw, only moves 1 step.
This is easy for me, and I feel as though the AI could use a little work in this section
Title: Re: Gaps in and bugs in enemy AI
Post by: Ertxiem on May 12, 2010, 07:34:31 PM
The bandit AI doesn't choose to move 3 squares to attack.
In the image below, one bandit moved 2 squares to attack Arman (green arrow).
However, the bandit that was 3 squares away only moved 2 squares and didn't get near Arman (red arrow). If he moved another square, he could attack Arman.
Another thing is that bandits make a frontal attack to Griffin, instead of trying to to move to the side to avoid Griffin's counter (I didn't take a screen shot of that one).
Title: Re: Gaps in and bugs in enemy AI
Post by: Bromtaghon on June 07, 2010, 04:21:21 PM
(http://img130.imageshack.us/img130/8238/glitchi.jpg)
The bandit moved to the right of my Hero, but chose not to attack.

Also, he could have moved in front of the Hero to avoid exposing his backside, but he didn't do that either.
Title: Re: Gaps in and bugs in enemy AI
Post by: SmartyPants on June 10, 2010, 02:47:48 PM
In the first cellar battle, a ghost approached and faced Luca, but didn't attack.
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on June 11, 2010, 08:44:14 AM
I've optimized the enemy AI a bit more--hopefully that should resolve any issues with enemies not running the attack AI.
Title: Re: Gaps in and bugs in enemy AI
Post by: Bromtaghon on June 12, 2010, 03:50:51 PM
I was in the Deeper Downs, and none of the Nymphs attacked my characters, even if there weren't wounded units to heal- they just walked around doing nothing until we slaughtered them.
Title: Re: Gaps in and bugs in enemy AI
Post by: MikeW781 on June 12, 2010, 05:42:55 PM
I was wondering which has priority-healing or attacking?
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on June 13, 2010, 10:47:22 AM
That depends on the enemy. (I believe most healer units are programmed to prioritize healing.)
Title: Re: Gaps in and bugs in enemy AI
Post by: MikeW781 on June 13, 2010, 11:25:34 AM
Does the priority include how much the unit needs healing versus who the Nymph can kill? I believe that the Nymph healed his barely wounded ally instead of killing Arman when i was checking the AI....
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on June 13, 2010, 11:30:00 AM
Currently, it does not. I haven't gotten around to revamping the healer AI just yet. :)
Title: Re: Gaps in and bugs in enemy AI
Post by: MikeW781 on June 14, 2010, 12:33:54 PM
Next up, do you intend to have static shield at such a low priority? Its only above attacking non-damaged, non-healer foes right now.
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on June 14, 2010, 08:16:24 PM
Next up, do you intend to have static shield at such a low priority?

Yes--that's deliberate. Static shield isn't a decoy attack, it's an obstacle.
Title: Re: Gaps in and bugs in enemy AI
Post by: algebra15 on July 01, 2010, 06:08:24 PM
I had a problem with a bandit longbowman attacking me through a tree.

M = me
X = bandit longbow
O = empty
T = tree

OOOO
MTOX
OOOO

Also, I was doing a solo battle and the randomly generated trees boxed me in the corner.
Title: Re: Gaps in and bugs in enemy AI
Post by: KZ on July 02, 2010, 03:15:29 PM
Also, I was doing a solo battle and the randomly generated trees boxed me in the corner.

That happens on occaison- got reported to when the randomly generated battles were initially added into the game, but Craig said it's the way the coding works. (I take it re-coding that would be a lot of hassle.)
Title: Re: Gaps in and bugs in enemy AI
Post by: Zhampir on July 02, 2010, 11:26:28 PM
Yes, randomly generating followable paths... pretty difficult, unless it simply uses pre-generated maps with randomly generated actors (the NPCs and the PCs) That's do-able.. in fact if the Arena's coding isn't so different... that's a ton of premade maps right there...
Title: Re: Gaps in and bugs in enemy AI
Post by: Duskling on July 04, 2010, 11:44:02 AM
I made a map using 10 Greater Ghosts for enemies, the newer ones, at one point in the battle, the Ghost used Cryo Cross in a totally random place where it didn't do any damage to my teammates, being too far away to. Has anyone else experienced this?
Title: Re: Gaps in and bugs in enemy AI
Post by: KZ on July 04, 2010, 03:47:50 PM
Just today, on the online version, but I wanted to verify with Craig first if he's updated AI since- the greater ghost gave a couple of very strange bugs whilst I was experimenting with it today, this one included.
Title: Re: Gaps in and bugs in enemy AI
Post by: Ertxiem on July 18, 2010, 12:01:49 PM
A bandit attacked Griffin from his front instead of moving to his free side and attacking, thus avoiding Griffin's counter.
(In the Prison Escape Battle #2 of the game, I moved Griffin left to attack the bandit.)

OOO
OBO
OGW
OOW

G - Griffin
B - Bandit
W - Wall
O - Empty space


Also, I was doing a solo battle and the randomly generated trees boxed me in the corner.

That happens on occaison- got reported to when the randomly generated battles were initially added into the game, but Craig said it's the way the coding works. (I take it re-coding that would be a lot of hassle.)

Actually, there's an easy way to avoid blocking our characters in the randomly generated maps: just don't allow obstacles in the top line of the map (where our team starts).

A bit harder way would be to generate a position to put an obstacle and try again if one of the diagonals is occupied, this would reduce drastically the probability of being blocked.
OAO
BXC
ODO
X - generated position of the obstacle. The obstacle would be placed if the adjacent corners are free (O), regardless of what is on A, B, C and D (each one could be empty or with an obstacle).
Title: Re: Gaps in and bugs in enemy AI
Post by: Zhampir on July 18, 2010, 08:48:05 PM
still wouldn't work. you could end up with

0X0X0X0X0X
XPXPXOXOXO
OXOXOXOXO

in which P is a person, X is an obstacle and O is an object.
The people are trapped.
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on July 19, 2010, 04:02:38 PM
Just today, on the online version, but I wanted to verify with Craig first if he's updated AI since- the greater ghost gave a couple of very strange bugs whilst I was experimenting with it today, this one included.

If possible, a screenie would be helpful. Otherwise, I won't know where to look for the problem. :)
Title: Re: Gaps in and bugs in enemy AI
Post by: Ertxiem on July 19, 2010, 04:05:07 PM
still wouldn't work. you could end up with

0X0X0X0X0X
XPXPXOXOXO
OXOXOXOXO

in which P is a person, X is an obstacle and O is an object.
The people are trapped.

Not really. Notice that I propose forbidding placing an obstacle if another one is on the adjacent diagonal.

Nevertheless, we could end up with N-S walls
OXO
OXO
OXO
OXO

Or with E-W walls
OOOO
XXXX
OOOO

But not diagonal walls.

And if the number of obstacles is low, it would be very hard to have more than 3 close to each other.
Title: Re: Gaps in and bugs in enemy AI
Post by: Duskling on July 19, 2010, 04:06:02 PM
Just today, on the online version, but I wanted to verify with Craig first if he's updated AI since- the greater ghost gave a couple of very strange bugs whilst I was experimenting with it today, this one included.

If possible, a screenie would be helpful. Otherwise, I won't know where to look for the problem. :)
I'm not sure about a screenshot, but I can tell you that it transpired in the map editor.
Title: Re: Gaps in and bugs in enemy AI
Post by: SmartyPants on July 30, 2010, 05:28:37 PM
In Distract the Guards, I killed the bowmen and then the swordsman faces Arman without attacking him.  I almost always play on Normal.
Title: Re: Gaps in and bugs in enemy AI
Post by: algebra15 on July 31, 2010, 07:25:14 AM
That is a movement "gap". It occurs on all difficulties, and it shows up quite a bit when enemies are going around  corners of some sort, but otherwise, is quite rare. It showed up in TPA2, 1, TRPG2, and SoG. So it's something that, if 'twere to be fixed, 'twould have to be fixed all 'round.
Title: Re: Gaps in and bugs in enemy AI
Post by: ArtDrake on August 22, 2010, 01:09:53 PM
Picture of the longbowman glitch I mentioned earlier:

(http://sinisterdesign.net/forum/index.php?action=dlattach;topic=28.0;attach=225;image)
Title: Re: Gaps in and bugs in enemy AI
Post by: mezzoforte on August 23, 2010, 08:45:11 PM
You can shoot through a tree.  The only time you can't attack/shoot is when you are right in front of the obstacle.

In Distract the Guards, I killed the bowmen and then the swordsman faces Arman without attacking him.  I almost always play on Normal.

I've noticed that theme elsewhere too: a character could attack, but just chooses not to.  I can only imagine that it was to save on Psy points because an "ambush" on your character would have been non-fatal, and/or to regenerate Psy points.  (But the swordsman doesn't use Psy attacks.)

If the swordsman had faced away from you and had his back to a wall, I'd say it was to avoid a backstab.  (But he faced you.)


There's one other explanation, that might fit, but I don't know if the AI does this:  An enemy chooses "suicide" and tries to appear harmless by not attacking.  If you kill him off the next turn, he'll make room for more enemies (or a stronger or healthier one) that will hurt you more than he could have alone.... it's kind of a stretch, but I've seen it happen, though maybe for a different reason than this.
Title: Re: Gaps in and bugs in enemy AI
Post by: mezzoforte on August 24, 2010, 02:43:16 PM
Hey, I found an example where the AI does nothing but dance around (indefinitely).  Here, the Bandit Raider just moves around the two sides of Arman, while I do nothing each turn.  It's kind of funny!

I have recognized that the AI is programmed to play positionally (it's quite clever in those ways!!).  Perhaps it's playing purely positionally here in this unlikely formation.  I know he's just waiting to get Set or to backstab someone.  But he can't do any of these in ONE turn.  So from his point of view, it's a stalemate (if I don't attack).

P.S. It's in Brutal mode
Title: Re: Gaps in and bugs in enemy AI
Post by: bugfartboy on August 29, 2010, 07:34:24 PM
I've noticed that in the cellar battles for Baz, the lesser ghosts have had the opportunity to backstab or just attack, and they havn't. I don't have any screenshots unfortunately. Sorry about that.
Title: Re: Gaps in and bugs in enemy AI
Post by: mezzoforte on September 07, 2010, 09:40:57 PM
By the way, I thought about it one day and realized that it's maybe not a "bug":  It's unlikely that players will do what I'm doing (i.e. nothing), and the fact that the AI does almost nothing as well simply says that it's a stalemate!  Since there's no way that the bandit can kill the stronger team members, all he can do is wait for Set to show himself.

Overall, I think it's okay, because I find the AI to be most clever in normal situations.
Title: Re: Gaps in and bugs in enemy AI
Post by: Zackirus on October 04, 2010, 04:25:37 PM
It also happens when you click the red merchant right beside the blue merchant.
Title: Re: Gaps in and bugs in enemy AI
Post by: SmartyPants on October 04, 2010, 04:51:46 PM
The bandit healer (http://telepath.wikia.com/wiki/Bandit Healer) healed the Stack of Moldy Barrels.  Can they do that?
Title: Re: Gaps in and bugs in enemy AI
Post by: bugfartboy on October 04, 2010, 05:35:21 PM
Wait. The games been updated!?!
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on October 05, 2010, 04:29:41 AM
The bandit healer (http://telepath.wikia.com/wiki/Bandit Healer) healed the Stack of Moldy Barrels.  Can they do that?

Ah, yes. I still haven't gotten around to rewriting the enemy healer AI. It's one of the few AI routines left untouched from before TPA2. (I'll get around to it eventually.)
Title: Re: Gaps in and bugs in enemy AI
Post by: ArtDrake on November 28, 2010, 11:23:53 AM
The Bandit longbowman missed. Is this common?
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on December 16, 2010, 06:32:34 AM
That's the first I've heard of it. Where was he standing before he moved to take that shot?
Title: Re: Gaps in and bugs in enemy AI
Post by: ArtDrake on December 16, 2010, 08:41:41 AM
Oh.. I should go back and see.

I think they must have been one square above the square the attacked from, because they would have stayed back for a three, and I know they weren't in the square to start with; they would have moved back.

Any higher and they would have shot from North by going right, and if they were two North and one left, they would have used the far shot.

So I'm fairly sure they moved one square South to take the shot.
Title: Re: Gaps in and bugs in enemy AI
Post by: bugfartboy on January 03, 2011, 02:56:14 PM
In the first assasination mission, the bandit healer doesn't defend itself when I attack it. Is it supposed to do that?
Title: Re: Gaps in and bugs in enemy AI
Post by: Dean_Lukas on March 06, 2011, 07:18:09 PM
In the fight against the Warden at the end of the prologue mission, if I attack him with Rahel's Bow 2 he won't close to attack her. I probably could've killed him without him moving. (I know he's standing on the escape spot, so maybe that's intentional).
Title: Re: Gaps in and bugs in enemy AI
Post by: bugfartboy on March 06, 2011, 07:24:15 PM
It's intentional. None of the enemies put on capture spaces ever move.
Title: Re: Gaps in and bugs in enemy AI
Post by: Idozen Cair on March 07, 2011, 01:01:02 AM
In the fight against the Warden at the end of the prologue mission, if I attack him with Rahel's Bow 2 he won't close to attack her. I probably could've killed him without him moving. (I know he's standing on the escape spot, so maybe that's intentional).
That's why I put the 'Rahel's Bow 2 way' as the safe way against the Warden on the wiki. It's garunteed to work.
Title: Re: Gaps in and bugs in enemy AI
Post by: sarlok on August 21, 2011, 09:54:43 PM
When Arman is delaying the guards during the rescue of your parents, I found a spot where you can go and the guards will not move.  I just have to move Arman here and wait out the battle.  I am playing on brutal difficulty.  I'm attaching a screenshot of the position that does this.
Title: Re: Gaps in and bugs in enemy AI
Post by: CraigStern on August 21, 2011, 10:08:36 PM
Hey sarlok, that bug was reported a few days ago, and has been fixed in the latest version. Thanks for noticing it, though. ;)