Opened 11 years ago

Closed 10 years ago

#745 closed bug (fixed (in master))

monster group movement bug(s)

Reported by: tigen Owned by:
Milestone: 3.1.1 beta Keywords: ai
Cc:

Description

It looks like the monster group code doesn't check if the monster is next to the player already before trying to "surround" him. It tries to find an empty square next to the player. Only if it happens to already be in that square will it attack; otherwise it moves next to the player.

See melee2.c:2852 /* Monster groups try to surround the player */

Possibly a related problem is that the monster follows a repeating pattern due to the algorithm being only "semi-random" to pick squares. Maybe it should be actually-random.

I have a save file demonstrating the bug here:
http://csua.berkeley.edu/~dcs/angband/movement-3.1.0beta

Attachments (2)

movement-3.1.0beta (45.3 KB) - added by takkaria 11 years ago.
savefile at above url
fixgroupmove (1.3 KB) - added by tigen 11 years ago.
Patch for the group movement AI code. Check adjacency and randomize the square selection.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 11 years ago by tigen

Another possible improvement might be to avoid the group routine if his friends are mostly killed or not in the vicinity.

Changed 11 years ago by takkaria

savefile at above url

comment:2 Changed 11 years ago by takkaria

  • Milestone changed from Triage to 3.1.1 beta

Changed 11 years ago by tigen

Patch for the group movement AI code. Check adjacency and randomize the square selection.

comment:3 Changed 11 years ago by tigen

I've tested a fix that appears to work reasonably. Making the square selection random was needed to avoid exploitable patterns (e.g. walking diagonally back and forth while healing).

comment:4 Changed 11 years ago by tigen

It might be better to check adjacent squares in order of closeness to the monster, instead of randomly. As it is I think monsters will make somewhat erratic moves occasianally (going the "long way around" another monster to get to the player). On the other hand maybe being a bit less predictable is good.

comment:5 Changed 10 years ago by takkaria

  • Resolution set to fixed
  • Status changed from new to closed

[967985e] (SVN r1315)

Note: See TracTickets for help on using tickets.