Monster AI

https://attnam.com/topics/Monster-AI

The Cathedral of Attnam > Other Coding

#1 May 19, 2016, 3:51 am Hide

fejoa

Serin-Delaunay wrote
That's the kind of thing safety maps are designed for (see here and here). Rather than pathfinding away from the player (as in those examples), it would pathfind away from a combination of hostile creatures and environmental dangers. Once the NPC is in a tile it judges to be safe, and isn't panicked, its normal AI can take over again.
The same code could also make magpies much more difficult to track down. If that's not how they already work.

I enjoyed reading the links. Yep, monster AI is fairly rudimentary in IVAN as it stands. Petrus standing around in a gas cloud is a recurring example that spurred the suggestion quoted above. Improving the AI is an area we can potentially get more gameplay bang for our coding buck. The code additions are often minimal, and are suitably self-contained.

Does anyone have more observations about AI behaviour that could potentially be improved upon, or AI that can be added to make improvements?

EDIT: AI improvements listed here:
* Banana growers getting stuck outside the shop
* Pets avoiding standing next to the player, get them to stand next to the player, or improve this for sci-talk purposes
* Monsters avoiding environmental dangers
* When an NPC is in StandIdleAI(), get them to move in response to hazards like gas clouds and return when the home square is safe
* Monsters using equipment, wands, throwables and rooting around in chests
* Social creatures, pack animals, simple group behaviour
* Ambushes
#2 May 19, 2016, 7:18 am Hide

Serin-Delaunay

In 0.50.5, the banana growers can still get stuck outside the shop window, which makes it easy to scitalk them.
Pets which are following the player won't try to stay next to the player, which makes scitalk more difficult the faster the pet is.
Pets which aren't following the player normally wander randomly, but past a certain number they form a clump which is difficult to break up (and fills the message buffer very quickly).
Monsters don't seem concerned by hazardous liquids on the floor. I haven't tested this, so it's possible that wise creatures avoid them, or that following the player ranks above pathing around environmental dangers.
Monsters use equipment, food, and drink from the floor, but not wands, scrolls, traps, throwables, chests, etc. That might be difficult to balance.
It's not clear what enemies can kick down locked doors, or what prompts them to do it.
#3 May 19, 2016, 10:53 am Hide

JoKe

Social creatures would be a neat addition, instead of having every NPC act as an individual only. Even simple group behaviour similar to player pets for things like orc patrols or wolf packs could go a long way.
#4 May 19, 2016, 11:15 am Hide

Serin-Delaunay

Angband has (and variants inherit) a really evil social behaviour that hides in the corners of a room, and ambushes the player when they enter. That way they avoid being fought one at a time in chokepoints. When the player is low on health they become more aggressive.
It's not without problems - because of a combination of asymmetry in the line of sight code, telepathy, differences between LOS for vision and ranged attacks, and the fact that not all of the pack fits in the corners, the player can snipe a lot of the pack without retaliation before facing the "ambush".
With IVAN's more restrictive approach to ranged combat, that would be less of a problem.
#5 May 19, 2016, 1:17 pm Hide

red_kangaroo

Wolf packs would be very interesting addition, indeed. I was also thinking about Angband, reading this.

I really really like the way monsters use wands against you in CLIVAN. Especially the goblin warlocks, with their wands of door creation, acid rain and teleportation are deliciously aggravating.
#6 May 20, 2016, 12:24 am Hide

chaostrom

There's already a wolf pack in IVAN. They're led by a werewolf and spawn in a special room.
#7 May 20, 2016, 3:53 am Hide

Serin-Delaunay

They don't behave as a pack, though.
#8 May 20, 2016, 7:33 am Hide

chaostrom

Yes, I know. I was just pointing out that there's already an opportunity to implement better AI in-game.
#9 May 20, 2016, 11:32 am Hide

capristo

If we add wolf packs and such then I really want more "wilderness" exploring and fighting. That would be so awesome to be in the woods with a little campfire at night and suddenly surrounded by wolves
#10 May 20, 2016, 6:35 pm Hide

fejoa

JoKe wrote
Social creatures would be a neat addition, instead of having every NPC act as an individual only. Even simple group behaviour similar to player pets for things like orc patrols or wolf packs could go a long way.

This would be super cool, orc patrols could have pet dogs or wolves!


red_kangaroo wrote
I really really like the way monsters use wands against you in CLIVAN. Especially the goblin warlocks, with their wands of door creation, acid rain and teleportation are deliciously aggravating.

I remember coding this, it seemed to work okay. The main problems with what I wrote was that it was possibly inefficient, and that the warlocks would zap the wand or throw an item as often as they could, which was quite often too quick. Monsters that can zap or throw would need a "time since last zap" to make it fairer on the player. Plus the algorithm didn't check if there was a wall in the way, so the monster would just throw things at the wall while the player was behind it. That said, it could still be improved upon.