[Experimental] Loading a save have an odd effect on creatures

Whilst playing on the latest experimental build, I came across something very odd. I would sometimes get in a fight with a creature that, for lack of a better term, wasn’t there.

Let’s say this would happen with a zombie dog; I would see the green ‘d’, and the compass would tell me that, yes, that is a zombie dog over there, but e(x)amining the tile would have me believe that the tile was empty. Trying to attack it would lead to me stepping into that tile like said zombie dog wasn’t there, it’s existence only betrayed by the fact that it was attacking me, and causing damage. In short, it became a very one-sided fight due to the fact that I couldn’t strike back.

Doing some troubleshooting on a fresh install revealed what causes this phenomenon, or at least a way to recreate it:

  1. Start new game. It doesn’t matter if it’s static spawn or dynamic.
  2. Get an enemy in your line of sight.
  3. Save the game and quit.
  4. Upon loading the game the enemy will be undetectable by e(x)amining, and you will be able to walk right through them.

Interestingly enough, the targeting system will still “snap to” them, even though it also says there’s nothing there.

I’m experiencing the same issue, except occasionally the enemy will appear to be a different type of creature when I e(x)amine it.

Oddly enough I don’t need to save and load to experience this bug.

See attached:

I think ill give git bisect a try…

in the mean time: GitHub Issue

This is almost certainly due to the performance-related refactoring of how monsters are stored when on the active map, there’s now a x,y, map of indices to the main vector of monster objects for faster lookup, and this is exactly the behavior I expect if the two get out of sync.
Caching is a pain.