Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue Report]: Possible ai bug with succubi #6693

Open
FitzRoyX opened this issue Oct 7, 2023 · 5 comments
Open

[Issue Report]: Possible ai bug with succubi #6693

FitzRoyX opened this issue Oct 7, 2023 · 5 comments
Labels
vanilla Bugs found also in the original Diablo 1.09b release

Comments

@FitzRoyX
Copy link

FitzRoyX commented Oct 7, 2023

Operating System

Windows x64

DevilutionX version

1.5.1

Describe

Usually succubi make an effort to move when an obstacle blocks their projectile, but here it seems content to keep firing at it over and over.

dumbai.zip

dumbai.mp4

To Reproduce

load save

Expected Behavior

No response

Additional context

No response

@julealgon
Copy link
Contributor

Fairly well-known vanilla issue. I believe this is caused by the asymmetry in computing line of sight from A to B and B to A, so enemies "think" they should be able to hit you but the calculation for the hit is performed in reverse and the results are different.

@AJenbo AJenbo added the vanilla Bugs found also in the original Diablo 1.09b release label Oct 7, 2023
@StephenCWills
Copy link
Member

I think there is perhaps something a bit off in the AI's judgment regarding the path of their missiles, because sometimes they'll just stand still and stare and other times they'll shoot the wall. However, there's also the discrepancy between line of sight (vision) vs path of missiles (center-of-tile to center-of-tile).

@StephenCWills
Copy link
Member

StephenCWills commented Oct 14, 2023

The difference between a Succubus standing and shooting versus standing and staring is the result of a call to the LineClearMissile() function.

devilutionX/Source/monster.cpp

Lines 1891 to 1899 in 7470862

if (LineClearMissile(monster.position.tile, monster.enemyPosition)) {
MissileID missileType = GetMissileType(monster.ai);
if (monster.ai == MonsterAIID::AcidUnique)
StartRangedSpecialAttack(monster, missileType, 0);
else
StartRangedAttack(monster, missileType, 0);
} else {
monster.checkStandAnimationIsLoaded(md);
}

If the monster is firing and hitting an obstruction, it's because LineClearMissile() doesn't agree with what actually happens during missile collision.


The difference between a Succubus holding position versus repositioning to get a better angle has to do with activeForTicks.

Standing:

if (monster.activeForTicks == UINT8_MAX || (monster.flags & MFLAG_TARGETS_MONSTER) != 0) {

Repositioning:

if (monster.activeForTicks != 0) {

activeForTicks is set to UINT8_MAX on every frame so long as the monster is visible from the player's tile. This means the monster will stand still if the monster is in the player's line of sight. If the monster is not visible, activeForTicks is decremented every frame until it reaches zero after about 12.8 seconds. This means the monster will attempt to reposition to get back in view of the player for about 12.8 seconds before becoming dormant again.

devilutionX/Source/monster.cpp

Lines 4011 to 4016 in 7470862

if (IsTileVisible(monster.position.tile)) {
monster.activeForTicks = UINT8_MAX;
monster.position.last = player.position.future;
} else if (monster.activeForTicks != 0 && monster.type().type != MT_DIABLO) {
monster.activeForTicks--;
}

If the monster is not repositioning but still firing directly at an obstruction, it means the monster is visible around or through the obstruction. It's a discrepancy between vision and missile collision.

@D1-Constantine
Copy link

The succubi AI will eventually ''figure out'' that it cannot hit you and will come in melee range if you stay enough. I'm pretty sure there is RNG aspect to it. In any case I don't think monsters being dumb is a bad thing, it's more of a game mechanic in most old games to abuse and exploit monster AI as it is not very complicated

@julealgon
Copy link
Contributor

The succubi AI will eventually ''figure out'' that it cannot hit you and will come in melee range if you stay enough.

I don't think this is always the case. There are many situations (more often than not) that ranged attackers will never change their behavior and will become permanently stuck if you stay in the same positions.

Otherwise I'd agree with the rest of your statement that this would be an interesting mechanic potentially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vanilla Bugs found also in the original Diablo 1.09b release
Projects
None yet
Development

No branches or pull requests

5 participants